Skip to content

Commit da42c01

Browse files
committed
Removed unneeded dep, updated browser bundle
1 parent 7f834f9 commit da42c01

File tree

4 files changed

+53
-863
lines changed

4 files changed

+53
-863
lines changed

esbuild.js

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,14 @@ const browserConfig = {
125125
),
126126
"process.env.EXTENSION_VERSION": JSON.stringify(extensionPackage.version),
127127
"process.env.BROWSER_ENV": JSON.stringify("true"),
128-
"process.platform": JSON.stringify("browser"),
128+
global: "globalThis",
129129
},
130130
alias: {
131131
path: "path-browserify",
132132
},
133+
banner: {
134+
js: `var process = {env: {EXTENSION_NAME: "${extensionPackage.publisher}.${extensionPackage.name}", EXTENSION_VERSION: "${extensionPackage.version}", BROWSER_ENV: "true"}, platform: "browser", cwd: function() { return "/"; }, nextTick: function(cb) { setTimeout(cb, 0); }};`,
135+
},
133136
logLevel: "silent",
134137
plugins: [
135138
browserAliasPlugin,
@@ -138,15 +141,50 @@ const browserConfig = {
138141
],
139142
};
140143

144+
// Web test bundle configuration
145+
const webTestConfig = {
146+
entryPoints: ["src/test/web/suite/index.ts"],
147+
bundle: true,
148+
format: "cjs",
149+
minify: false,
150+
sourcemap: true,
151+
sourcesContent: false,
152+
platform: "browser",
153+
outfile: "dist/web/test/suite/index.js",
154+
external: ["vscode"],
155+
define: {
156+
"process.env.BROWSER_ENV": JSON.stringify("true"),
157+
"process.platform": JSON.stringify("browser"),
158+
},
159+
alias: {
160+
path: "path-browserify",
161+
},
162+
logLevel: "silent",
163+
plugins: [esbuildProblemMatcherPlugin],
164+
};
165+
141166
async function main() {
142167
const nodeCtx = await esbuild.context(nodeConfig);
143168
const browserCtx = await esbuild.context(browserConfig);
169+
const webTestCtx = await esbuild.context(webTestConfig);
144170

145171
if (watch) {
146-
await Promise.all([nodeCtx.watch(), browserCtx.watch()]);
172+
await Promise.all([
173+
nodeCtx.watch(),
174+
browserCtx.watch(),
175+
webTestCtx.watch(),
176+
]);
147177
} else {
148-
await Promise.all([nodeCtx.rebuild(), browserCtx.rebuild()]);
149-
await Promise.all([nodeCtx.dispose(), browserCtx.dispose()]);
178+
await Promise.all([
179+
nodeCtx.rebuild(),
180+
browserCtx.rebuild(),
181+
webTestCtx.rebuild(),
182+
]);
183+
await Promise.all([
184+
nodeCtx.dispose(),
185+
browserCtx.dispose(),
186+
webTestCtx.dispose(),
187+
]);
150188
}
151189
}
152190

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"prettier": "prettier --write .",
7676
"compile": "pnpm check-types && node esbuild.js",
7777
"check-types": "tsc --noEmit",
78-
"watch": "npm-run-all -p watch:*",
78+
"watch": "pnpm run --parallel watch:esbuild watch:tsc",
7979
"watch:esbuild": "node esbuild.js --watch",
8080
"watch:tsc": "tsc --noEmit --watch --project tsconfig.json",
8181
"test-compile": "pnpm clean && tsc -p ./ && pnpm compile && cp -r ./src/worker ./out",
@@ -119,7 +119,6 @@
119119
"husky": "^9.1.4",
120120
"lint-staged": "^15.2.9",
121121
"mocha": "^10.7.3",
122-
"npm-run-all": "^4.1.5",
123122
"path-browserify": "^1.0.1",
124123
"process": "^0.11.10",
125124
"sinon": "^17.0.1",

0 commit comments

Comments
 (0)