Skip to content

Commit 279257f

Browse files
committed
pin esbuild
1 parent f04e833 commit 279257f

File tree

3 files changed

+15
-18
lines changed

3 files changed

+15
-18
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"@typescript-eslint/parser": "4.30.0",
4040
"chai": "^4.2.0",
4141
"chai-as-promised": "^7.1.1",
42-
"esbuild": "^0.19.9",
42+
"esbuild": "0.19.11",
4343
"eslint": "7.32.0",
4444
"eslint-config-prettier": "8.3.0",
4545
"eslint-plugin-prettier": "3.4.1",

scripts/compilation/Inliner.js

+12-15
Original file line numberDiff line numberDiff line change
@@ -138,18 +138,9 @@ module.exports = class Inliner {
138138
allowOverwrite: true,
139139
entryPoints: [path.join(root, this.subfolder, this.package, "src", "index.ts")],
140140
outfile: this.outfile,
141-
external: [
142-
"tslib",
143-
"@aws-crypto/*",
144-
"@smithy/*",
145-
"@aws-sdk/*",
146-
"typescript",
147-
"vscode-oniguruma",
148-
"pnpapi",
149-
"fast-xml-parser",
150-
"node_modules/*",
151-
...this.variantExternalsForEsBuild,
152-
],
141+
keepNames: true,
142+
packages: "external",
143+
external: [...this.variantExternalsForEsBuild],
153144
});
154145
return this;
155146
}
@@ -161,6 +152,12 @@ module.exports = class Inliner {
161152
async rewriteStubs() {
162153
for await (const file of walk(path.join(this.packageDirectory, "dist-cjs"))) {
163154
const relativePath = file.replace(path.join(this.packageDirectory, "dist-cjs"), "").slice(1);
155+
156+
if (!file.endsWith(".js")) {
157+
console.log("Skipping", path.basename(file), "file extension is not .js.");
158+
continue;
159+
}
160+
164161
if (relativePath === "index.js") {
165162
console.log("Skipping index.js");
166163
continue;
@@ -198,12 +195,12 @@ module.exports = class Inliner {
198195
const basename = path.basename(variant).replace(/.js$/, "");
199196
const dirname = path.dirname(variant);
200197

201-
const find = new RegExp(`require\\("./(.*?)/${basename}"\\)`);
198+
const find = new RegExp(`require\\("\\.(.*?)/${basename}"\\)`);
202199
const replace = `require("./${dirname}/${basename}")`;
203200

204201
this.indexContents = this.indexContents.replace(find, replace);
205202

206-
console.log("replacing", find, "with", replace);
203+
console.log("Replacing", find, "with", replace);
207204
}
208205

209206
fs.writeFileSync(this.outfile, this.indexContents, "utf-8");
@@ -235,7 +232,7 @@ module.exports = class Inliner {
235232
const redundantVariable = `import_${variableSuffix}${redundancyIndex}`;
236233

237234
if (this.indexContents.match(new RegExp(redundantRequire))) {
238-
console.log("replacing", redundantVariable);
235+
console.log("Replacing var", redundantVariable);
239236
this.indexContents = this.indexContents
240237
.replace(new RegExp(redundantRequire, "g"), "")
241238
.replace(new RegExp(redundantVariable, "g"), `import_${variableSuffix}`);

yarn.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -5430,7 +5430,7 @@ __metadata:
54305430
languageName: node
54315431
linkType: hard
54325432

5433-
"esbuild@npm:^0.19.9":
5433+
"esbuild@npm:0.19.11":
54345434
version: 0.19.11
54355435
resolution: "esbuild@npm:0.19.11"
54365436
dependencies:
@@ -9966,7 +9966,7 @@ __metadata:
99669966
"@typescript-eslint/parser": 4.30.0
99679967
chai: ^4.2.0
99689968
chai-as-promised: ^7.1.1
9969-
esbuild: ^0.19.9
9969+
esbuild: 0.19.11
99709970
eslint: 7.32.0
99719971
eslint-config-prettier: 8.3.0
99729972
eslint-plugin-prettier: 3.4.1

0 commit comments

Comments
 (0)