cdk-comprehend-s3olap 2.0.301 → 2.0.302
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +2 -2
- package/lib/cdk-comprehend-s3olap.js +2 -2
- package/lib/comprehend-lambdas.js +2 -2
- package/lib/iam-roles.js +4 -4
- package/package.json +2 -2
- package/node_modules/@esbuild/linux-x64/README.md +0 -3
- package/node_modules/@esbuild/linux-x64/bin/esbuild +0 -0
- package/node_modules/@esbuild/linux-x64/package.json +0 -17
- package/node_modules/esbuild/LICENSE.md +0 -21
- package/node_modules/esbuild/README.md +0 -3
- package/node_modules/esbuild/bin/esbuild +0 -221
- package/node_modules/esbuild/install.js +0 -287
- package/node_modules/esbuild/lib/main.d.ts +0 -660
- package/node_modules/esbuild/lib/main.js +0 -2404
- package/node_modules/esbuild/package.json +0 -42
@@ -1,221 +0,0 @@
|
|
1
|
-
#!/usr/bin/env node
|
2
|
-
"use strict";
|
3
|
-
var __create = Object.create;
|
4
|
-
var __defProp = Object.defineProperty;
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
11
|
-
for (let key of __getOwnPropNames(from))
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14
|
-
}
|
15
|
-
return to;
|
16
|
-
};
|
17
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
18
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
19
|
-
// file that has been converted to a CommonJS file using a Babel-
|
20
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
21
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
22
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
23
|
-
mod
|
24
|
-
));
|
25
|
-
|
26
|
-
// lib/npm/node-platform.ts
|
27
|
-
var fs = require("fs");
|
28
|
-
var os = require("os");
|
29
|
-
var path = require("path");
|
30
|
-
var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH;
|
31
|
-
var isValidBinaryPath = (x) => !!x && x !== "/usr/bin/esbuild";
|
32
|
-
var packageDarwin_arm64 = "@esbuild/darwin-arm64";
|
33
|
-
var packageDarwin_x64 = "@esbuild/darwin-x64";
|
34
|
-
var knownWindowsPackages = {
|
35
|
-
"win32 arm64 LE": "@esbuild/win32-arm64",
|
36
|
-
"win32 ia32 LE": "@esbuild/win32-ia32",
|
37
|
-
"win32 x64 LE": "@esbuild/win32-x64"
|
38
|
-
};
|
39
|
-
var knownUnixlikePackages = {
|
40
|
-
"android arm64 LE": "@esbuild/android-arm64",
|
41
|
-
"darwin arm64 LE": "@esbuild/darwin-arm64",
|
42
|
-
"darwin x64 LE": "@esbuild/darwin-x64",
|
43
|
-
"freebsd arm64 LE": "@esbuild/freebsd-arm64",
|
44
|
-
"freebsd x64 LE": "@esbuild/freebsd-x64",
|
45
|
-
"linux arm LE": "@esbuild/linux-arm",
|
46
|
-
"linux arm64 LE": "@esbuild/linux-arm64",
|
47
|
-
"linux ia32 LE": "@esbuild/linux-ia32",
|
48
|
-
"linux mips64el LE": "@esbuild/linux-mips64el",
|
49
|
-
"linux ppc64 LE": "@esbuild/linux-ppc64",
|
50
|
-
"linux riscv64 LE": "@esbuild/linux-riscv64",
|
51
|
-
"linux s390x BE": "@esbuild/linux-s390x",
|
52
|
-
"linux x64 LE": "@esbuild/linux-x64",
|
53
|
-
"linux loong64 LE": "@esbuild/linux-loong64",
|
54
|
-
"netbsd x64 LE": "@esbuild/netbsd-x64",
|
55
|
-
"openbsd x64 LE": "@esbuild/openbsd-x64",
|
56
|
-
"sunos x64 LE": "@esbuild/sunos-x64"
|
57
|
-
};
|
58
|
-
var knownWebAssemblyFallbackPackages = {
|
59
|
-
"android arm LE": "@esbuild/android-arm",
|
60
|
-
"android x64 LE": "@esbuild/android-x64"
|
61
|
-
};
|
62
|
-
function pkgAndSubpathForCurrentPlatform() {
|
63
|
-
let pkg;
|
64
|
-
let subpath;
|
65
|
-
let isWASM2 = false;
|
66
|
-
let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`;
|
67
|
-
if (platformKey in knownWindowsPackages) {
|
68
|
-
pkg = knownWindowsPackages[platformKey];
|
69
|
-
subpath = "esbuild.exe";
|
70
|
-
} else if (platformKey in knownUnixlikePackages) {
|
71
|
-
pkg = knownUnixlikePackages[platformKey];
|
72
|
-
subpath = "bin/esbuild";
|
73
|
-
} else if (platformKey in knownWebAssemblyFallbackPackages) {
|
74
|
-
pkg = knownWebAssemblyFallbackPackages[platformKey];
|
75
|
-
subpath = "bin/esbuild";
|
76
|
-
isWASM2 = true;
|
77
|
-
} else {
|
78
|
-
throw new Error(`Unsupported platform: ${platformKey}`);
|
79
|
-
}
|
80
|
-
return { pkg, subpath, isWASM: isWASM2 };
|
81
|
-
}
|
82
|
-
function pkgForSomeOtherPlatform() {
|
83
|
-
const libMainJS = require.resolve("esbuild");
|
84
|
-
const nodeModulesDirectory = path.dirname(path.dirname(path.dirname(libMainJS)));
|
85
|
-
if (path.basename(nodeModulesDirectory) === "node_modules") {
|
86
|
-
for (const unixKey in knownUnixlikePackages) {
|
87
|
-
try {
|
88
|
-
const pkg = knownUnixlikePackages[unixKey];
|
89
|
-
if (fs.existsSync(path.join(nodeModulesDirectory, pkg)))
|
90
|
-
return pkg;
|
91
|
-
} catch {
|
92
|
-
}
|
93
|
-
}
|
94
|
-
for (const windowsKey in knownWindowsPackages) {
|
95
|
-
try {
|
96
|
-
const pkg = knownWindowsPackages[windowsKey];
|
97
|
-
if (fs.existsSync(path.join(nodeModulesDirectory, pkg)))
|
98
|
-
return pkg;
|
99
|
-
} catch {
|
100
|
-
}
|
101
|
-
}
|
102
|
-
}
|
103
|
-
return null;
|
104
|
-
}
|
105
|
-
function downloadedBinPath(pkg, subpath) {
|
106
|
-
const esbuildLibDir = path.dirname(require.resolve("esbuild"));
|
107
|
-
return path.join(esbuildLibDir, `downloaded-${pkg.replace("/", "-")}-${path.basename(subpath)}`);
|
108
|
-
}
|
109
|
-
function generateBinPath() {
|
110
|
-
if (isValidBinaryPath(ESBUILD_BINARY_PATH)) {
|
111
|
-
if (!fs.existsSync(ESBUILD_BINARY_PATH)) {
|
112
|
-
console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ESBUILD_BINARY_PATH}`);
|
113
|
-
} else {
|
114
|
-
return { binPath: ESBUILD_BINARY_PATH, isWASM: false };
|
115
|
-
}
|
116
|
-
}
|
117
|
-
const { pkg, subpath, isWASM: isWASM2 } = pkgAndSubpathForCurrentPlatform();
|
118
|
-
let binPath2;
|
119
|
-
try {
|
120
|
-
binPath2 = require.resolve(`${pkg}/${subpath}`);
|
121
|
-
} catch (e) {
|
122
|
-
binPath2 = downloadedBinPath(pkg, subpath);
|
123
|
-
if (!fs.existsSync(binPath2)) {
|
124
|
-
try {
|
125
|
-
require.resolve(pkg);
|
126
|
-
} catch {
|
127
|
-
const otherPkg = pkgForSomeOtherPlatform();
|
128
|
-
if (otherPkg) {
|
129
|
-
let suggestions = `
|
130
|
-
Specifically the "${otherPkg}" package is present but this platform
|
131
|
-
needs the "${pkg}" package instead. People often get into this
|
132
|
-
situation by installing esbuild on Windows or macOS and copying "node_modules"
|
133
|
-
into a Docker image that runs Linux, or by copying "node_modules" between
|
134
|
-
Windows and WSL environments.
|
135
|
-
|
136
|
-
If you are installing with npm, you can try not copying the "node_modules"
|
137
|
-
directory when you copy the files over, and running "npm ci" or "npm install"
|
138
|
-
on the destination platform after the copy. Or you could consider using yarn
|
139
|
-
instead of npm which has built-in support for installing a package on multiple
|
140
|
-
platforms simultaneously.
|
141
|
-
|
142
|
-
If you are installing with yarn, you can try listing both this platform and the
|
143
|
-
other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
|
144
|
-
feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
|
145
|
-
Keep in mind that this means multiple copies of esbuild will be present.
|
146
|
-
`;
|
147
|
-
if (pkg === packageDarwin_x64 && otherPkg === packageDarwin_arm64 || pkg === packageDarwin_arm64 && otherPkg === packageDarwin_x64) {
|
148
|
-
suggestions = `
|
149
|
-
Specifically the "${otherPkg}" package is present but this platform
|
150
|
-
needs the "${pkg}" package instead. People often get into this
|
151
|
-
situation by installing esbuild with npm running inside of Rosetta 2 and then
|
152
|
-
trying to use it with node running outside of Rosetta 2, or vice versa (Rosetta
|
153
|
-
2 is Apple's on-the-fly x86_64-to-arm64 translation service).
|
154
|
-
|
155
|
-
If you are installing with npm, you can try ensuring that both npm and node are
|
156
|
-
not running under Rosetta 2 and then reinstalling esbuild. This likely involves
|
157
|
-
changing how you installed npm and/or node. For example, installing node with
|
158
|
-
the universal installer here should work: https://nodejs.org/en/download/. Or
|
159
|
-
you could consider using yarn instead of npm which has built-in support for
|
160
|
-
installing a package on multiple platforms simultaneously.
|
161
|
-
|
162
|
-
If you are installing with yarn, you can try listing both "arm64" and "x64"
|
163
|
-
in your ".yarnrc.yml" file using the "supportedArchitectures" feature:
|
164
|
-
https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
|
165
|
-
Keep in mind that this means multiple copies of esbuild will be present.
|
166
|
-
`;
|
167
|
-
}
|
168
|
-
throw new Error(`
|
169
|
-
You installed esbuild for another platform than the one you're currently using.
|
170
|
-
This won't work because esbuild is written with native code and needs to
|
171
|
-
install a platform-specific binary executable.
|
172
|
-
${suggestions}
|
173
|
-
Another alternative is to use the "esbuild-wasm" package instead, which works
|
174
|
-
the same way on all platforms. But it comes with a heavy performance cost and
|
175
|
-
can sometimes be 10x slower than the "esbuild" package, so you may also not
|
176
|
-
want to do that.
|
177
|
-
`);
|
178
|
-
}
|
179
|
-
throw new Error(`The package "${pkg}" could not be found, and is needed by esbuild.
|
180
|
-
|
181
|
-
If you are installing esbuild with npm, make sure that you don't specify the
|
182
|
-
"--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature
|
183
|
-
of "package.json" is used by esbuild to install the correct binary executable
|
184
|
-
for your current platform.`);
|
185
|
-
}
|
186
|
-
throw e;
|
187
|
-
}
|
188
|
-
}
|
189
|
-
if (/\.zip\//.test(binPath2)) {
|
190
|
-
let pnpapi;
|
191
|
-
try {
|
192
|
-
pnpapi = require("pnpapi");
|
193
|
-
} catch (e) {
|
194
|
-
}
|
195
|
-
if (pnpapi) {
|
196
|
-
const root = pnpapi.getPackageInformation(pnpapi.topLevel).packageLocation;
|
197
|
-
const binTargetPath = path.join(
|
198
|
-
root,
|
199
|
-
"node_modules",
|
200
|
-
".cache",
|
201
|
-
"esbuild",
|
202
|
-
`pnpapi-${pkg.replace("/", "-")}-${"0.19.4"}-${path.basename(subpath)}`
|
203
|
-
);
|
204
|
-
if (!fs.existsSync(binTargetPath)) {
|
205
|
-
fs.mkdirSync(path.dirname(binTargetPath), { recursive: true });
|
206
|
-
fs.copyFileSync(binPath2, binTargetPath);
|
207
|
-
fs.chmodSync(binTargetPath, 493);
|
208
|
-
}
|
209
|
-
return { binPath: binTargetPath, isWASM: isWASM2 };
|
210
|
-
}
|
211
|
-
}
|
212
|
-
return { binPath: binPath2, isWASM: isWASM2 };
|
213
|
-
}
|
214
|
-
|
215
|
-
// lib/npm/node-shim.ts
|
216
|
-
var { binPath, isWASM } = generateBinPath();
|
217
|
-
if (isWASM) {
|
218
|
-
require("child_process").execFileSync("node", [binPath].concat(process.argv.slice(2)), { stdio: "inherit" });
|
219
|
-
} else {
|
220
|
-
require("child_process").execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" });
|
221
|
-
}
|
@@ -1,287 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __create = Object.create;
|
3
|
-
var __defProp = Object.defineProperty;
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
10
|
-
for (let key of __getOwnPropNames(from))
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
12
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
13
|
-
}
|
14
|
-
return to;
|
15
|
-
};
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
22
|
-
mod
|
23
|
-
));
|
24
|
-
|
25
|
-
// lib/npm/node-platform.ts
|
26
|
-
var fs = require("fs");
|
27
|
-
var os = require("os");
|
28
|
-
var path = require("path");
|
29
|
-
var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH;
|
30
|
-
var isValidBinaryPath = (x) => !!x && x !== "/usr/bin/esbuild";
|
31
|
-
var knownWindowsPackages = {
|
32
|
-
"win32 arm64 LE": "@esbuild/win32-arm64",
|
33
|
-
"win32 ia32 LE": "@esbuild/win32-ia32",
|
34
|
-
"win32 x64 LE": "@esbuild/win32-x64"
|
35
|
-
};
|
36
|
-
var knownUnixlikePackages = {
|
37
|
-
"android arm64 LE": "@esbuild/android-arm64",
|
38
|
-
"darwin arm64 LE": "@esbuild/darwin-arm64",
|
39
|
-
"darwin x64 LE": "@esbuild/darwin-x64",
|
40
|
-
"freebsd arm64 LE": "@esbuild/freebsd-arm64",
|
41
|
-
"freebsd x64 LE": "@esbuild/freebsd-x64",
|
42
|
-
"linux arm LE": "@esbuild/linux-arm",
|
43
|
-
"linux arm64 LE": "@esbuild/linux-arm64",
|
44
|
-
"linux ia32 LE": "@esbuild/linux-ia32",
|
45
|
-
"linux mips64el LE": "@esbuild/linux-mips64el",
|
46
|
-
"linux ppc64 LE": "@esbuild/linux-ppc64",
|
47
|
-
"linux riscv64 LE": "@esbuild/linux-riscv64",
|
48
|
-
"linux s390x BE": "@esbuild/linux-s390x",
|
49
|
-
"linux x64 LE": "@esbuild/linux-x64",
|
50
|
-
"linux loong64 LE": "@esbuild/linux-loong64",
|
51
|
-
"netbsd x64 LE": "@esbuild/netbsd-x64",
|
52
|
-
"openbsd x64 LE": "@esbuild/openbsd-x64",
|
53
|
-
"sunos x64 LE": "@esbuild/sunos-x64"
|
54
|
-
};
|
55
|
-
var knownWebAssemblyFallbackPackages = {
|
56
|
-
"android arm LE": "@esbuild/android-arm",
|
57
|
-
"android x64 LE": "@esbuild/android-x64"
|
58
|
-
};
|
59
|
-
function pkgAndSubpathForCurrentPlatform() {
|
60
|
-
let pkg;
|
61
|
-
let subpath;
|
62
|
-
let isWASM = false;
|
63
|
-
let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`;
|
64
|
-
if (platformKey in knownWindowsPackages) {
|
65
|
-
pkg = knownWindowsPackages[platformKey];
|
66
|
-
subpath = "esbuild.exe";
|
67
|
-
} else if (platformKey in knownUnixlikePackages) {
|
68
|
-
pkg = knownUnixlikePackages[platformKey];
|
69
|
-
subpath = "bin/esbuild";
|
70
|
-
} else if (platformKey in knownWebAssemblyFallbackPackages) {
|
71
|
-
pkg = knownWebAssemblyFallbackPackages[platformKey];
|
72
|
-
subpath = "bin/esbuild";
|
73
|
-
isWASM = true;
|
74
|
-
} else {
|
75
|
-
throw new Error(`Unsupported platform: ${platformKey}`);
|
76
|
-
}
|
77
|
-
return { pkg, subpath, isWASM };
|
78
|
-
}
|
79
|
-
function downloadedBinPath(pkg, subpath) {
|
80
|
-
const esbuildLibDir = path.dirname(require.resolve("esbuild"));
|
81
|
-
return path.join(esbuildLibDir, `downloaded-${pkg.replace("/", "-")}-${path.basename(subpath)}`);
|
82
|
-
}
|
83
|
-
|
84
|
-
// lib/npm/node-install.ts
|
85
|
-
var fs2 = require("fs");
|
86
|
-
var os2 = require("os");
|
87
|
-
var path2 = require("path");
|
88
|
-
var zlib = require("zlib");
|
89
|
-
var https = require("https");
|
90
|
-
var child_process = require("child_process");
|
91
|
-
var versionFromPackageJSON = require(path2.join(__dirname, "package.json")).version;
|
92
|
-
var toPath = path2.join(__dirname, "bin", "esbuild");
|
93
|
-
var isToPathJS = true;
|
94
|
-
function validateBinaryVersion(...command) {
|
95
|
-
command.push("--version");
|
96
|
-
let stdout;
|
97
|
-
try {
|
98
|
-
stdout = child_process.execFileSync(command.shift(), command, {
|
99
|
-
// Without this, this install script strangely crashes with the error
|
100
|
-
// "EACCES: permission denied, write" but only on Ubuntu Linux when node is
|
101
|
-
// installed from the Snap Store. This is not a problem when you download
|
102
|
-
// the official version of node. The problem appears to be that stderr
|
103
|
-
// (i.e. file descriptor 2) isn't writable?
|
104
|
-
//
|
105
|
-
// More info:
|
106
|
-
// - https://snapcraft.io/ (what the Snap Store is)
|
107
|
-
// - https://nodejs.org/dist/ (download the official version of node)
|
108
|
-
// - https://github.com/evanw/esbuild/issues/1711#issuecomment-1027554035
|
109
|
-
//
|
110
|
-
stdio: "pipe"
|
111
|
-
}).toString().trim();
|
112
|
-
} catch (err) {
|
113
|
-
if (os2.platform() === "darwin" && /_SecTrustEvaluateWithError/.test(err + "")) {
|
114
|
-
let os3 = "this version of macOS";
|
115
|
-
try {
|
116
|
-
os3 = "macOS " + child_process.execFileSync("sw_vers", ["-productVersion"]).toString().trim();
|
117
|
-
} catch {
|
118
|
-
}
|
119
|
-
throw new Error(`The "esbuild" package cannot be installed because ${os3} is too outdated.
|
120
|
-
|
121
|
-
The Go compiler (which esbuild relies on) no longer supports ${os3},
|
122
|
-
which means the "esbuild" binary executable can't be run. You can either:
|
123
|
-
|
124
|
-
* Update your version of macOS to one that the Go compiler supports
|
125
|
-
* Use the "esbuild-wasm" package instead of the "esbuild" package
|
126
|
-
* Build esbuild yourself using an older version of the Go compiler
|
127
|
-
`);
|
128
|
-
}
|
129
|
-
throw err;
|
130
|
-
}
|
131
|
-
if (stdout !== versionFromPackageJSON) {
|
132
|
-
throw new Error(`Expected ${JSON.stringify(versionFromPackageJSON)} but got ${JSON.stringify(stdout)}`);
|
133
|
-
}
|
134
|
-
}
|
135
|
-
function isYarn() {
|
136
|
-
const { npm_config_user_agent } = process.env;
|
137
|
-
if (npm_config_user_agent) {
|
138
|
-
return /\byarn\//.test(npm_config_user_agent);
|
139
|
-
}
|
140
|
-
return false;
|
141
|
-
}
|
142
|
-
function fetch(url) {
|
143
|
-
return new Promise((resolve, reject) => {
|
144
|
-
https.get(url, (res) => {
|
145
|
-
if ((res.statusCode === 301 || res.statusCode === 302) && res.headers.location)
|
146
|
-
return fetch(res.headers.location).then(resolve, reject);
|
147
|
-
if (res.statusCode !== 200)
|
148
|
-
return reject(new Error(`Server responded with ${res.statusCode}`));
|
149
|
-
let chunks = [];
|
150
|
-
res.on("data", (chunk) => chunks.push(chunk));
|
151
|
-
res.on("end", () => resolve(Buffer.concat(chunks)));
|
152
|
-
}).on("error", reject);
|
153
|
-
});
|
154
|
-
}
|
155
|
-
function extractFileFromTarGzip(buffer, subpath) {
|
156
|
-
try {
|
157
|
-
buffer = zlib.unzipSync(buffer);
|
158
|
-
} catch (err) {
|
159
|
-
throw new Error(`Invalid gzip data in archive: ${err && err.message || err}`);
|
160
|
-
}
|
161
|
-
let str = (i, n) => String.fromCharCode(...buffer.subarray(i, i + n)).replace(/\0.*$/, "");
|
162
|
-
let offset = 0;
|
163
|
-
subpath = `package/${subpath}`;
|
164
|
-
while (offset < buffer.length) {
|
165
|
-
let name = str(offset, 100);
|
166
|
-
let size = parseInt(str(offset + 124, 12), 8);
|
167
|
-
offset += 512;
|
168
|
-
if (!isNaN(size)) {
|
169
|
-
if (name === subpath)
|
170
|
-
return buffer.subarray(offset, offset + size);
|
171
|
-
offset += size + 511 & ~511;
|
172
|
-
}
|
173
|
-
}
|
174
|
-
throw new Error(`Could not find ${JSON.stringify(subpath)} in archive`);
|
175
|
-
}
|
176
|
-
function installUsingNPM(pkg, subpath, binPath) {
|
177
|
-
const env = { ...process.env, npm_config_global: void 0 };
|
178
|
-
const esbuildLibDir = path2.dirname(require.resolve("esbuild"));
|
179
|
-
const installDir = path2.join(esbuildLibDir, "npm-install");
|
180
|
-
fs2.mkdirSync(installDir);
|
181
|
-
try {
|
182
|
-
fs2.writeFileSync(path2.join(installDir, "package.json"), "{}");
|
183
|
-
child_process.execSync(
|
184
|
-
`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${versionFromPackageJSON}`,
|
185
|
-
{ cwd: installDir, stdio: "pipe", env }
|
186
|
-
);
|
187
|
-
const installedBinPath = path2.join(installDir, "node_modules", pkg, subpath);
|
188
|
-
fs2.renameSync(installedBinPath, binPath);
|
189
|
-
} finally {
|
190
|
-
try {
|
191
|
-
removeRecursive(installDir);
|
192
|
-
} catch {
|
193
|
-
}
|
194
|
-
}
|
195
|
-
}
|
196
|
-
function removeRecursive(dir) {
|
197
|
-
for (const entry of fs2.readdirSync(dir)) {
|
198
|
-
const entryPath = path2.join(dir, entry);
|
199
|
-
let stats;
|
200
|
-
try {
|
201
|
-
stats = fs2.lstatSync(entryPath);
|
202
|
-
} catch {
|
203
|
-
continue;
|
204
|
-
}
|
205
|
-
if (stats.isDirectory())
|
206
|
-
removeRecursive(entryPath);
|
207
|
-
else
|
208
|
-
fs2.unlinkSync(entryPath);
|
209
|
-
}
|
210
|
-
fs2.rmdirSync(dir);
|
211
|
-
}
|
212
|
-
function applyManualBinaryPathOverride(overridePath) {
|
213
|
-
const pathString = JSON.stringify(overridePath);
|
214
|
-
fs2.writeFileSync(toPath, `#!/usr/bin/env node
|
215
|
-
require('child_process').execFileSync(${pathString}, process.argv.slice(2), { stdio: 'inherit' });
|
216
|
-
`);
|
217
|
-
const libMain = path2.join(__dirname, "lib", "main.js");
|
218
|
-
const code = fs2.readFileSync(libMain, "utf8");
|
219
|
-
fs2.writeFileSync(libMain, `var ESBUILD_BINARY_PATH = ${pathString};
|
220
|
-
${code}`);
|
221
|
-
}
|
222
|
-
function maybeOptimizePackage(binPath) {
|
223
|
-
if (os2.platform() !== "win32" && !isYarn()) {
|
224
|
-
const tempPath = path2.join(__dirname, "bin-esbuild");
|
225
|
-
try {
|
226
|
-
fs2.linkSync(binPath, tempPath);
|
227
|
-
fs2.renameSync(tempPath, toPath);
|
228
|
-
isToPathJS = false;
|
229
|
-
fs2.unlinkSync(tempPath);
|
230
|
-
} catch {
|
231
|
-
}
|
232
|
-
}
|
233
|
-
}
|
234
|
-
async function downloadDirectlyFromNPM(pkg, subpath, binPath) {
|
235
|
-
const url = `https://registry.npmjs.org/${pkg}/-/${pkg.replace("@esbuild/", "")}-${versionFromPackageJSON}.tgz`;
|
236
|
-
console.error(`[esbuild] Trying to download ${JSON.stringify(url)}`);
|
237
|
-
try {
|
238
|
-
fs2.writeFileSync(binPath, extractFileFromTarGzip(await fetch(url), subpath));
|
239
|
-
fs2.chmodSync(binPath, 493);
|
240
|
-
} catch (e) {
|
241
|
-
console.error(`[esbuild] Failed to download ${JSON.stringify(url)}: ${e && e.message || e}`);
|
242
|
-
throw e;
|
243
|
-
}
|
244
|
-
}
|
245
|
-
async function checkAndPreparePackage() {
|
246
|
-
if (isValidBinaryPath(ESBUILD_BINARY_PATH)) {
|
247
|
-
if (!fs2.existsSync(ESBUILD_BINARY_PATH)) {
|
248
|
-
console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ESBUILD_BINARY_PATH}`);
|
249
|
-
} else {
|
250
|
-
applyManualBinaryPathOverride(ESBUILD_BINARY_PATH);
|
251
|
-
return;
|
252
|
-
}
|
253
|
-
}
|
254
|
-
const { pkg, subpath } = pkgAndSubpathForCurrentPlatform();
|
255
|
-
let binPath;
|
256
|
-
try {
|
257
|
-
binPath = require.resolve(`${pkg}/${subpath}`);
|
258
|
-
} catch (e) {
|
259
|
-
console.error(`[esbuild] Failed to find package "${pkg}" on the file system
|
260
|
-
|
261
|
-
This can happen if you use the "--no-optional" flag. The "optionalDependencies"
|
262
|
-
package.json feature is used by esbuild to install the correct binary executable
|
263
|
-
for your current platform. This install script will now attempt to work around
|
264
|
-
this. If that fails, you need to remove the "--no-optional" flag to use esbuild.
|
265
|
-
`);
|
266
|
-
binPath = downloadedBinPath(pkg, subpath);
|
267
|
-
try {
|
268
|
-
console.error(`[esbuild] Trying to install package "${pkg}" using npm`);
|
269
|
-
installUsingNPM(pkg, subpath, binPath);
|
270
|
-
} catch (e2) {
|
271
|
-
console.error(`[esbuild] Failed to install package "${pkg}" using npm: ${e2 && e2.message || e2}`);
|
272
|
-
try {
|
273
|
-
await downloadDirectlyFromNPM(pkg, subpath, binPath);
|
274
|
-
} catch (e3) {
|
275
|
-
throw new Error(`Failed to install package "${pkg}"`);
|
276
|
-
}
|
277
|
-
}
|
278
|
-
}
|
279
|
-
maybeOptimizePackage(binPath);
|
280
|
-
}
|
281
|
-
checkAndPreparePackage().then(() => {
|
282
|
-
if (isToPathJS) {
|
283
|
-
validateBinaryVersion(process.execPath, toPath);
|
284
|
-
} else {
|
285
|
-
validateBinaryVersion(toPath);
|
286
|
-
}
|
287
|
-
});
|