+884
-165
lines changedFilter options
+884
-165
lines changed Original file line number Diff line number Diff line change
@@ -46,6 +46,10 @@ test-endpoints:
46
46
test-e2e: bundles
47
47
yarn g:vitest run -c vitest.config.e2e.ts --retry=4
48
48
yarn g:vitest run -c vitest.config.browser.e2e.ts --retry=4
49
+
make test-bundlers
50
+
51
+
test-bundlers:
52
+
(cd ./tests/bundlers && make build test)
49
53
50
54
build-s3-browser-bundle:
51
55
node ./clients/client-s3/test/browser-build/esbuild
Original file line number Diff line number Diff line change
@@ -111,8 +111,9 @@
111
111
"turbo": "2.5.3",
112
112
"typescript": "~5.8.3",
113
113
"verdaccio": "5.25.0",
114
+
"vite": "7.0.6",
114
115
"vitest": "2.1.9",
115
-
"webpack": "5.76.0",
116
+
"webpack": "5.101.0",
116
117
"webpack-cli": "4.10.0",
117
118
"yargs": "17.5.1"
118
119
},
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
1
+
.PHONY: test build vite webpack
2
+
3
+
# asserts that bundles contain expected content.
4
+
test:
5
+
node test.spec.mjs
6
+
7
+
# create bundles
8
+
build:
9
+
make vite webpack
10
+
11
+
vite:
12
+
npx vite build
13
+
14
+
webpack:
15
+
npx webpack
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
1
+
{
2
+
"dependencies": {},
3
+
"type": "module"
4
+
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1
+
import { GetObjectCommand, S3Client } from "@aws-sdk/client-s3";
2
+
3
+
export { GetObjectCommand, S3Client };
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
1
+
import assert from "node:assert";
2
+
3
+
import fs from "node:fs";
4
+
import path from "node:path";
5
+
import { fileURLToPath } from "node:url";
6
+
7
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
8
+
9
+
const webpackDist = {
10
+
name: "webpack",
11
+
content: fs.readFileSync(path.join(__dirname, "dist", "webpack-dist.js"), "utf-8"),
12
+
};
13
+
const viteDist = {
14
+
name: "vite",
15
+
content: fs.readFileSync(path.join(__dirname, "dist", "vite-dist.js"), "utf-8"),
16
+
};
17
+
18
+
for (const { content: fileContents, name } of [webpackDist, viteDist]) {
19
+
console.log(name);
20
+
21
+
const contentSize = fileContents.replaceAll(/\s+/g, "").length;
22
+
const callsToClassBuilder = fileContents.match(/\.classBuilder\(\)/g);
23
+
const runtimeConfig = fileContents.match(/runtime: "browser"/);
24
+
25
+
try {
26
+
assert(contentSize < 1_000_000);
27
+
console.info(`✅ content size is under 1M char.`);
28
+
} catch (e) {
29
+
throw new Error("Content size should be less than 1M characters.");
30
+
}
31
+
32
+
try {
33
+
assert(callsToClassBuilder.length <= 2); // only GetObject and CreateSession should be present.
34
+
console.info(`✅ two commands bundled (tree shaken).`);
35
+
} catch (e) {
36
+
throw new Error("there should only be 2 calls to the Command classBuilder. Tree-shaking failure?");
37
+
}
38
+
39
+
try {
40
+
assert(runtimeConfig.length > 0); // browser runtimeConfig should be loaded.
41
+
console.info(`✅ runtimeConfig is browser.`);
42
+
} catch (e) {
43
+
throw new Error("the browser runtimeConfig should be present in the bundle.");
44
+
}
45
+
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
1
+
import { defineConfig } from "vite";
2
+
import * as path from "node:path";
3
+
4
+
export default defineConfig({
5
+
build: {
6
+
lib: {
7
+
entry: path.join(__dirname, "source.ts"),
8
+
name: "dist",
9
+
// the proper extensions will be added
10
+
fileName: "vite-dist",
11
+
},
12
+
rollupOptions: {
13
+
// make sure to externalize deps that shouldn't be bundled
14
+
// into your library
15
+
external: [],
16
+
output: {
17
+
// Provide global variables to use in the UMD build
18
+
// for externalized deps
19
+
globals: {},
20
+
},
21
+
},
22
+
minify: false,
23
+
terserOptions: {
24
+
mangle: false,
25
+
},
26
+
},
27
+
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
1
+
import path from "node:path";
2
+
import { fileURLToPath } from "node:url";
3
+
4
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
5
+
6
+
export default {
7
+
mode: "production",
8
+
entry: "./source.ts",
9
+
output: {
10
+
path: path.resolve(__dirname, "dist"),
11
+
filename: "webpack-dist.js",
12
+
library: "dist",
13
+
},
14
+
optimization: {
15
+
minimize: false,
16
+
},
17
+
};
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4