@northlight/ui 2.43.0 → 2.43.1
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/dist/es/northlight.js +84 -43
- package/dist/es/northlight.js.map +1 -1
- package/dist/sandbox/index.cjs +88 -45
- package/dist/sandbox/index.cjs.map +1 -1
- package/dist/sandbox/index.js +88 -45
- package/dist/sandbox/index.js.map +1 -1
- package/dist/umd/northlight.cjs +84 -43
- package/dist/umd/northlight.cjs.map +1 -1
- package/dist/umd/northlight.min.cjs +3 -3
- package/dist/umd/northlight.min.cjs.map +1 -1
- package/lib/theme/components/textarea/index.ts +82 -41
- package/package.json +2 -2
- package/sandbox/lib/run-scenarios.ts +4 -1
- package/sandbox/node_modules/.yarn-integrity +0 -38
- package/sandbox/node_modules/@originjs/vite-plugin-commonjs/LICENSE +0 -127
- package/sandbox/node_modules/@originjs/vite-plugin-commonjs/README.md +0 -50
- package/sandbox/node_modules/@originjs/vite-plugin-commonjs/lib/filter.d.ts +0 -2
- package/sandbox/node_modules/@originjs/vite-plugin-commonjs/lib/filter.js +0 -39
- package/sandbox/node_modules/@originjs/vite-plugin-commonjs/lib/filter.js.map +0 -1
- package/sandbox/node_modules/@originjs/vite-plugin-commonjs/lib/index.d.ts +0 -11
- package/sandbox/node_modules/@originjs/vite-plugin-commonjs/lib/index.js +0 -78
- package/sandbox/node_modules/@originjs/vite-plugin-commonjs/lib/index.js.map +0 -1
- package/sandbox/node_modules/@originjs/vite-plugin-commonjs/lib/lib.d.ts +0 -6
- package/sandbox/node_modules/@originjs/vite-plugin-commonjs/lib/lib.js +0 -79
- package/sandbox/node_modules/@originjs/vite-plugin-commonjs/lib/lib.js.map +0 -1
- package/sandbox/node_modules/@originjs/vite-plugin-commonjs/package.json +0 -34
- package/sandbox/node_modules/esbuild/LICENSE.md +0 -21
- package/sandbox/node_modules/esbuild/README.md +0 -3
- package/sandbox/node_modules/esbuild/bin/esbuild +0 -178
- package/sandbox/node_modules/esbuild/install.js +0 -244
- package/sandbox/node_modules/esbuild/lib/main.d.ts +0 -602
- package/sandbox/node_modules/esbuild/lib/main.js +0 -2332
- package/sandbox/node_modules/esbuild/package.json +0 -41
- package/sandbox/node_modules/esbuild-linux-64/README.md +0 -3
- package/sandbox/node_modules/esbuild-linux-64/bin/esbuild +0 -0
- package/sandbox/node_modules/esbuild-linux-64/package.json +0 -17
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@originjs/vite-plugin-commonjs",
|
|
3
|
-
"version": "1.0.3",
|
|
4
|
-
"description": "A vite plugin that support commonjs to esm in vite",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"build": "tsc -p tsconfig.json"
|
|
7
|
-
},
|
|
8
|
-
"main": "lib/index.js",
|
|
9
|
-
"files": [
|
|
10
|
-
"lib"
|
|
11
|
-
],
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "git+https://github.com/originjs/vite-plugins.git"
|
|
15
|
-
},
|
|
16
|
-
"keywords": [
|
|
17
|
-
"vite-plugin",
|
|
18
|
-
"commonjs"
|
|
19
|
-
],
|
|
20
|
-
"author": "jiawulin@vip.qq.com",
|
|
21
|
-
"license": "MulanPSL2",
|
|
22
|
-
"bugs": {
|
|
23
|
-
"url": "https://github.com/originjs/vite-plugins/issues"
|
|
24
|
-
},
|
|
25
|
-
"homepage": "https://github.com/originjs/vite-plugins/tree/main/packages/vite-plugin-commonjs",
|
|
26
|
-
"dependencies": {
|
|
27
|
-
"esbuild": "^0.14.14"
|
|
28
|
-
},
|
|
29
|
-
"devDependencies": {
|
|
30
|
-
"@types/node": "^15.12.2",
|
|
31
|
-
"typescript": "^4.3.2",
|
|
32
|
-
"vite": "^2.3.6"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020 Evan Wallace
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,178 +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
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
19
|
-
mod
|
|
20
|
-
));
|
|
21
|
-
|
|
22
|
-
// lib/npm/node-platform.ts
|
|
23
|
-
var fs = require("fs");
|
|
24
|
-
var os = require("os");
|
|
25
|
-
var path = require("path");
|
|
26
|
-
var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH;
|
|
27
|
-
var knownWindowsPackages = {
|
|
28
|
-
"win32 arm64 LE": "esbuild-windows-arm64",
|
|
29
|
-
"win32 ia32 LE": "esbuild-windows-32",
|
|
30
|
-
"win32 x64 LE": "esbuild-windows-64"
|
|
31
|
-
};
|
|
32
|
-
var knownUnixlikePackages = {
|
|
33
|
-
"android arm64 LE": "esbuild-android-arm64",
|
|
34
|
-
"darwin arm64 LE": "esbuild-darwin-arm64",
|
|
35
|
-
"darwin x64 LE": "esbuild-darwin-64",
|
|
36
|
-
"freebsd arm64 LE": "esbuild-freebsd-arm64",
|
|
37
|
-
"freebsd x64 LE": "esbuild-freebsd-64",
|
|
38
|
-
"linux arm LE": "esbuild-linux-arm",
|
|
39
|
-
"linux arm64 LE": "esbuild-linux-arm64",
|
|
40
|
-
"linux ia32 LE": "esbuild-linux-32",
|
|
41
|
-
"linux mips64el LE": "esbuild-linux-mips64le",
|
|
42
|
-
"linux ppc64 LE": "esbuild-linux-ppc64le",
|
|
43
|
-
"linux riscv64 LE": "esbuild-linux-riscv64",
|
|
44
|
-
"linux s390x BE": "esbuild-linux-s390x",
|
|
45
|
-
"linux x64 LE": "esbuild-linux-64",
|
|
46
|
-
"linux loong64 LE": "@esbuild/linux-loong64",
|
|
47
|
-
"netbsd x64 LE": "esbuild-netbsd-64",
|
|
48
|
-
"openbsd x64 LE": "esbuild-openbsd-64",
|
|
49
|
-
"sunos x64 LE": "esbuild-sunos-64"
|
|
50
|
-
};
|
|
51
|
-
var knownWebAssemblyFallbackPackages = {
|
|
52
|
-
"android x64 LE": "esbuild-android-64"
|
|
53
|
-
};
|
|
54
|
-
function pkgAndSubpathForCurrentPlatform() {
|
|
55
|
-
let pkg;
|
|
56
|
-
let subpath;
|
|
57
|
-
let isWASM2 = false;
|
|
58
|
-
let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`;
|
|
59
|
-
if (platformKey in knownWindowsPackages) {
|
|
60
|
-
pkg = knownWindowsPackages[platformKey];
|
|
61
|
-
subpath = "esbuild.exe";
|
|
62
|
-
} else if (platformKey in knownUnixlikePackages) {
|
|
63
|
-
pkg = knownUnixlikePackages[platformKey];
|
|
64
|
-
subpath = "bin/esbuild";
|
|
65
|
-
} else if (platformKey in knownWebAssemblyFallbackPackages) {
|
|
66
|
-
pkg = knownWebAssemblyFallbackPackages[platformKey];
|
|
67
|
-
subpath = "bin/esbuild";
|
|
68
|
-
isWASM2 = true;
|
|
69
|
-
} else {
|
|
70
|
-
throw new Error(`Unsupported platform: ${platformKey}`);
|
|
71
|
-
}
|
|
72
|
-
return { pkg, subpath, isWASM: isWASM2 };
|
|
73
|
-
}
|
|
74
|
-
function pkgForSomeOtherPlatform() {
|
|
75
|
-
const libMainJS = require.resolve("esbuild");
|
|
76
|
-
const nodeModulesDirectory = path.dirname(path.dirname(path.dirname(libMainJS)));
|
|
77
|
-
if (path.basename(nodeModulesDirectory) === "node_modules") {
|
|
78
|
-
for (const unixKey in knownUnixlikePackages) {
|
|
79
|
-
try {
|
|
80
|
-
const pkg = knownUnixlikePackages[unixKey];
|
|
81
|
-
if (fs.existsSync(path.join(nodeModulesDirectory, pkg)))
|
|
82
|
-
return pkg;
|
|
83
|
-
} catch {
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
for (const windowsKey in knownWindowsPackages) {
|
|
87
|
-
try {
|
|
88
|
-
const pkg = knownWindowsPackages[windowsKey];
|
|
89
|
-
if (fs.existsSync(path.join(nodeModulesDirectory, pkg)))
|
|
90
|
-
return pkg;
|
|
91
|
-
} catch {
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
function downloadedBinPath(pkg, subpath) {
|
|
98
|
-
const esbuildLibDir = path.dirname(require.resolve("esbuild"));
|
|
99
|
-
return path.join(esbuildLibDir, `downloaded-${pkg}-${path.basename(subpath)}`);
|
|
100
|
-
}
|
|
101
|
-
function generateBinPath() {
|
|
102
|
-
if (ESBUILD_BINARY_PATH) {
|
|
103
|
-
return { binPath: ESBUILD_BINARY_PATH, isWASM: false };
|
|
104
|
-
}
|
|
105
|
-
const { pkg, subpath, isWASM: isWASM2 } = pkgAndSubpathForCurrentPlatform();
|
|
106
|
-
let binPath2;
|
|
107
|
-
try {
|
|
108
|
-
binPath2 = require.resolve(`${pkg}/${subpath}`);
|
|
109
|
-
} catch (e) {
|
|
110
|
-
binPath2 = downloadedBinPath(pkg, subpath);
|
|
111
|
-
if (!fs.existsSync(binPath2)) {
|
|
112
|
-
try {
|
|
113
|
-
require.resolve(pkg);
|
|
114
|
-
} catch {
|
|
115
|
-
const otherPkg = pkgForSomeOtherPlatform();
|
|
116
|
-
if (otherPkg) {
|
|
117
|
-
throw new Error(`
|
|
118
|
-
You installed esbuild on another platform than the one you're currently using.
|
|
119
|
-
This won't work because esbuild is written with native code and needs to
|
|
120
|
-
install a platform-specific binary executable.
|
|
121
|
-
|
|
122
|
-
Specifically the "${otherPkg}" package is present but this platform
|
|
123
|
-
needs the "${pkg}" package instead. People often get into this
|
|
124
|
-
situation by installing esbuild on Windows or macOS and copying "node_modules"
|
|
125
|
-
into a Docker image that runs Linux, or by copying "node_modules" between
|
|
126
|
-
Windows and WSL environments.
|
|
127
|
-
|
|
128
|
-
If you are installing with npm, you can try not copying the "node_modules"
|
|
129
|
-
directory when you copy the files over, and running "npm ci" or "npm install"
|
|
130
|
-
on the destination platform after the copy. Or you could consider using yarn
|
|
131
|
-
instead which has built-in support for installing a package on multiple
|
|
132
|
-
platforms simultaneously.
|
|
133
|
-
|
|
134
|
-
If you are installing with yarn, you can try listing both this platform and the
|
|
135
|
-
other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
|
|
136
|
-
feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
|
|
137
|
-
Keep in mind that this means multiple copies of esbuild will be present.
|
|
138
|
-
|
|
139
|
-
Another alternative is to use the "esbuild-wasm" package instead, which works
|
|
140
|
-
the same way on all platforms. But it comes with a heavy performance cost and
|
|
141
|
-
can sometimes be 10x slower than the "esbuild" package, so you may also not
|
|
142
|
-
want to do that.
|
|
143
|
-
`);
|
|
144
|
-
}
|
|
145
|
-
throw new Error(`The package "${pkg}" could not be found, and is needed by esbuild.
|
|
146
|
-
|
|
147
|
-
If you are installing esbuild with npm, make sure that you don't specify the
|
|
148
|
-
"--no-optional" flag. The "optionalDependencies" package.json feature is used
|
|
149
|
-
by esbuild to install the correct binary executable for your current platform.`);
|
|
150
|
-
}
|
|
151
|
-
throw e;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
let isYarnPnP = false;
|
|
155
|
-
try {
|
|
156
|
-
require("pnpapi");
|
|
157
|
-
isYarnPnP = true;
|
|
158
|
-
} catch (e) {
|
|
159
|
-
}
|
|
160
|
-
if (isYarnPnP) {
|
|
161
|
-
const esbuildLibDir = path.dirname(require.resolve("esbuild"));
|
|
162
|
-
const binTargetPath = path.join(esbuildLibDir, `pnpapi-${pkg}-${path.basename(subpath)}`);
|
|
163
|
-
if (!fs.existsSync(binTargetPath)) {
|
|
164
|
-
fs.copyFileSync(binPath2, binTargetPath);
|
|
165
|
-
fs.chmodSync(binTargetPath, 493);
|
|
166
|
-
}
|
|
167
|
-
return { binPath: binTargetPath, isWASM: isWASM2 };
|
|
168
|
-
}
|
|
169
|
-
return { binPath: binPath2, isWASM: isWASM2 };
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// lib/npm/node-shim.ts
|
|
173
|
-
var { binPath, isWASM } = generateBinPath();
|
|
174
|
-
if (isWASM) {
|
|
175
|
-
require("child_process").execFileSync("node", [binPath].concat(process.argv.slice(2)), { stdio: "inherit" });
|
|
176
|
-
} else {
|
|
177
|
-
require("child_process").execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" });
|
|
178
|
-
}
|
|
@@ -1,244 +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
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
18
|
-
mod
|
|
19
|
-
));
|
|
20
|
-
|
|
21
|
-
// lib/npm/node-platform.ts
|
|
22
|
-
var fs = require("fs");
|
|
23
|
-
var os = require("os");
|
|
24
|
-
var path = require("path");
|
|
25
|
-
var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH;
|
|
26
|
-
var knownWindowsPackages = {
|
|
27
|
-
"win32 arm64 LE": "esbuild-windows-arm64",
|
|
28
|
-
"win32 ia32 LE": "esbuild-windows-32",
|
|
29
|
-
"win32 x64 LE": "esbuild-windows-64"
|
|
30
|
-
};
|
|
31
|
-
var knownUnixlikePackages = {
|
|
32
|
-
"android arm64 LE": "esbuild-android-arm64",
|
|
33
|
-
"darwin arm64 LE": "esbuild-darwin-arm64",
|
|
34
|
-
"darwin x64 LE": "esbuild-darwin-64",
|
|
35
|
-
"freebsd arm64 LE": "esbuild-freebsd-arm64",
|
|
36
|
-
"freebsd x64 LE": "esbuild-freebsd-64",
|
|
37
|
-
"linux arm LE": "esbuild-linux-arm",
|
|
38
|
-
"linux arm64 LE": "esbuild-linux-arm64",
|
|
39
|
-
"linux ia32 LE": "esbuild-linux-32",
|
|
40
|
-
"linux mips64el LE": "esbuild-linux-mips64le",
|
|
41
|
-
"linux ppc64 LE": "esbuild-linux-ppc64le",
|
|
42
|
-
"linux riscv64 LE": "esbuild-linux-riscv64",
|
|
43
|
-
"linux s390x BE": "esbuild-linux-s390x",
|
|
44
|
-
"linux x64 LE": "esbuild-linux-64",
|
|
45
|
-
"linux loong64 LE": "@esbuild/linux-loong64",
|
|
46
|
-
"netbsd x64 LE": "esbuild-netbsd-64",
|
|
47
|
-
"openbsd x64 LE": "esbuild-openbsd-64",
|
|
48
|
-
"sunos x64 LE": "esbuild-sunos-64"
|
|
49
|
-
};
|
|
50
|
-
var knownWebAssemblyFallbackPackages = {
|
|
51
|
-
"android x64 LE": "esbuild-android-64"
|
|
52
|
-
};
|
|
53
|
-
function pkgAndSubpathForCurrentPlatform() {
|
|
54
|
-
let pkg;
|
|
55
|
-
let subpath;
|
|
56
|
-
let isWASM = false;
|
|
57
|
-
let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`;
|
|
58
|
-
if (platformKey in knownWindowsPackages) {
|
|
59
|
-
pkg = knownWindowsPackages[platformKey];
|
|
60
|
-
subpath = "esbuild.exe";
|
|
61
|
-
} else if (platformKey in knownUnixlikePackages) {
|
|
62
|
-
pkg = knownUnixlikePackages[platformKey];
|
|
63
|
-
subpath = "bin/esbuild";
|
|
64
|
-
} else if (platformKey in knownWebAssemblyFallbackPackages) {
|
|
65
|
-
pkg = knownWebAssemblyFallbackPackages[platformKey];
|
|
66
|
-
subpath = "bin/esbuild";
|
|
67
|
-
isWASM = true;
|
|
68
|
-
} else {
|
|
69
|
-
throw new Error(`Unsupported platform: ${platformKey}`);
|
|
70
|
-
}
|
|
71
|
-
return { pkg, subpath, isWASM };
|
|
72
|
-
}
|
|
73
|
-
function downloadedBinPath(pkg, subpath) {
|
|
74
|
-
const esbuildLibDir = path.dirname(require.resolve("esbuild"));
|
|
75
|
-
return path.join(esbuildLibDir, `downloaded-${pkg}-${path.basename(subpath)}`);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// lib/npm/node-install.ts
|
|
79
|
-
var fs2 = require("fs");
|
|
80
|
-
var os2 = require("os");
|
|
81
|
-
var path2 = require("path");
|
|
82
|
-
var zlib = require("zlib");
|
|
83
|
-
var https = require("https");
|
|
84
|
-
var child_process = require("child_process");
|
|
85
|
-
var toPath = path2.join(__dirname, "bin", "esbuild");
|
|
86
|
-
var isToPathJS = true;
|
|
87
|
-
function validateBinaryVersion(...command) {
|
|
88
|
-
command.push("--version");
|
|
89
|
-
const stdout = child_process.execFileSync(command.shift(), command, {
|
|
90
|
-
stdio: "pipe"
|
|
91
|
-
}).toString().trim();
|
|
92
|
-
if (stdout !== "0.14.54") {
|
|
93
|
-
throw new Error(`Expected ${JSON.stringify("0.14.54")} but got ${JSON.stringify(stdout)}`);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
function isYarn() {
|
|
97
|
-
const { npm_config_user_agent } = process.env;
|
|
98
|
-
if (npm_config_user_agent) {
|
|
99
|
-
return /\byarn\//.test(npm_config_user_agent);
|
|
100
|
-
}
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
function fetch(url) {
|
|
104
|
-
return new Promise((resolve, reject) => {
|
|
105
|
-
https.get(url, (res) => {
|
|
106
|
-
if ((res.statusCode === 301 || res.statusCode === 302) && res.headers.location)
|
|
107
|
-
return fetch(res.headers.location).then(resolve, reject);
|
|
108
|
-
if (res.statusCode !== 200)
|
|
109
|
-
return reject(new Error(`Server responded with ${res.statusCode}`));
|
|
110
|
-
let chunks = [];
|
|
111
|
-
res.on("data", (chunk) => chunks.push(chunk));
|
|
112
|
-
res.on("end", () => resolve(Buffer.concat(chunks)));
|
|
113
|
-
}).on("error", reject);
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
function extractFileFromTarGzip(buffer, subpath) {
|
|
117
|
-
try {
|
|
118
|
-
buffer = zlib.unzipSync(buffer);
|
|
119
|
-
} catch (err) {
|
|
120
|
-
throw new Error(`Invalid gzip data in archive: ${err && err.message || err}`);
|
|
121
|
-
}
|
|
122
|
-
let str = (i, n) => String.fromCharCode(...buffer.subarray(i, i + n)).replace(/\0.*$/, "");
|
|
123
|
-
let offset = 0;
|
|
124
|
-
subpath = `package/${subpath}`;
|
|
125
|
-
while (offset < buffer.length) {
|
|
126
|
-
let name = str(offset, 100);
|
|
127
|
-
let size = parseInt(str(offset + 124, 12), 8);
|
|
128
|
-
offset += 512;
|
|
129
|
-
if (!isNaN(size)) {
|
|
130
|
-
if (name === subpath)
|
|
131
|
-
return buffer.subarray(offset, offset + size);
|
|
132
|
-
offset += size + 511 & ~511;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
throw new Error(`Could not find ${JSON.stringify(subpath)} in archive`);
|
|
136
|
-
}
|
|
137
|
-
function installUsingNPM(pkg, subpath, binPath) {
|
|
138
|
-
const env = { ...process.env, npm_config_global: void 0 };
|
|
139
|
-
const esbuildLibDir = path2.dirname(require.resolve("esbuild"));
|
|
140
|
-
const installDir = path2.join(esbuildLibDir, "npm-install");
|
|
141
|
-
fs2.mkdirSync(installDir);
|
|
142
|
-
try {
|
|
143
|
-
fs2.writeFileSync(path2.join(installDir, "package.json"), "{}");
|
|
144
|
-
child_process.execSync(
|
|
145
|
-
`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"0.14.54"}`,
|
|
146
|
-
{ cwd: installDir, stdio: "pipe", env }
|
|
147
|
-
);
|
|
148
|
-
const installedBinPath = path2.join(installDir, "node_modules", pkg, subpath);
|
|
149
|
-
fs2.renameSync(installedBinPath, binPath);
|
|
150
|
-
} finally {
|
|
151
|
-
try {
|
|
152
|
-
removeRecursive(installDir);
|
|
153
|
-
} catch {
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
function removeRecursive(dir) {
|
|
158
|
-
for (const entry of fs2.readdirSync(dir)) {
|
|
159
|
-
const entryPath = path2.join(dir, entry);
|
|
160
|
-
let stats;
|
|
161
|
-
try {
|
|
162
|
-
stats = fs2.lstatSync(entryPath);
|
|
163
|
-
} catch {
|
|
164
|
-
continue;
|
|
165
|
-
}
|
|
166
|
-
if (stats.isDirectory())
|
|
167
|
-
removeRecursive(entryPath);
|
|
168
|
-
else
|
|
169
|
-
fs2.unlinkSync(entryPath);
|
|
170
|
-
}
|
|
171
|
-
fs2.rmdirSync(dir);
|
|
172
|
-
}
|
|
173
|
-
function applyManualBinaryPathOverride(overridePath) {
|
|
174
|
-
const pathString = JSON.stringify(overridePath);
|
|
175
|
-
fs2.writeFileSync(toPath, `#!/usr/bin/env node
|
|
176
|
-
require('child_process').execFileSync(${pathString}, process.argv.slice(2), { stdio: 'inherit' });
|
|
177
|
-
`);
|
|
178
|
-
const libMain = path2.join(__dirname, "lib", "main.js");
|
|
179
|
-
const code = fs2.readFileSync(libMain, "utf8");
|
|
180
|
-
fs2.writeFileSync(libMain, `var ESBUILD_BINARY_PATH = ${pathString};
|
|
181
|
-
${code}`);
|
|
182
|
-
}
|
|
183
|
-
function maybeOptimizePackage(binPath) {
|
|
184
|
-
if (os2.platform() !== "win32" && !isYarn()) {
|
|
185
|
-
const tempPath = path2.join(__dirname, "bin-esbuild");
|
|
186
|
-
try {
|
|
187
|
-
fs2.linkSync(binPath, tempPath);
|
|
188
|
-
fs2.renameSync(tempPath, toPath);
|
|
189
|
-
isToPathJS = false;
|
|
190
|
-
fs2.unlinkSync(tempPath);
|
|
191
|
-
} catch {
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
async function downloadDirectlyFromNPM(pkg, subpath, binPath) {
|
|
196
|
-
const url = `https://registry.npmjs.org/${pkg}/-/${pkg}-${"0.14.54"}.tgz`;
|
|
197
|
-
console.error(`[esbuild] Trying to download ${JSON.stringify(url)}`);
|
|
198
|
-
try {
|
|
199
|
-
fs2.writeFileSync(binPath, extractFileFromTarGzip(await fetch(url), subpath));
|
|
200
|
-
fs2.chmodSync(binPath, 493);
|
|
201
|
-
} catch (e) {
|
|
202
|
-
console.error(`[esbuild] Failed to download ${JSON.stringify(url)}: ${e && e.message || e}`);
|
|
203
|
-
throw e;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
async function checkAndPreparePackage() {
|
|
207
|
-
if (ESBUILD_BINARY_PATH) {
|
|
208
|
-
applyManualBinaryPathOverride(ESBUILD_BINARY_PATH);
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
const { pkg, subpath } = pkgAndSubpathForCurrentPlatform();
|
|
212
|
-
let binPath;
|
|
213
|
-
try {
|
|
214
|
-
binPath = require.resolve(`${pkg}/${subpath}`);
|
|
215
|
-
} catch (e) {
|
|
216
|
-
console.error(`[esbuild] Failed to find package "${pkg}" on the file system
|
|
217
|
-
|
|
218
|
-
This can happen if you use the "--no-optional" flag. The "optionalDependencies"
|
|
219
|
-
package.json feature is used by esbuild to install the correct binary executable
|
|
220
|
-
for your current platform. This install script will now attempt to work around
|
|
221
|
-
this. If that fails, you need to remove the "--no-optional" flag to use esbuild.
|
|
222
|
-
`);
|
|
223
|
-
binPath = downloadedBinPath(pkg, subpath);
|
|
224
|
-
try {
|
|
225
|
-
console.error(`[esbuild] Trying to install package "${pkg}" using npm`);
|
|
226
|
-
installUsingNPM(pkg, subpath, binPath);
|
|
227
|
-
} catch (e2) {
|
|
228
|
-
console.error(`[esbuild] Failed to install package "${pkg}" using npm: ${e2 && e2.message || e2}`);
|
|
229
|
-
try {
|
|
230
|
-
await downloadDirectlyFromNPM(pkg, subpath, binPath);
|
|
231
|
-
} catch (e3) {
|
|
232
|
-
throw new Error(`Failed to install package "${pkg}"`);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
maybeOptimizePackage(binPath);
|
|
237
|
-
}
|
|
238
|
-
checkAndPreparePackage().then(() => {
|
|
239
|
-
if (isToPathJS) {
|
|
240
|
-
validateBinaryVersion("node", toPath);
|
|
241
|
-
} else {
|
|
242
|
-
validateBinaryVersion(toPath);
|
|
243
|
-
}
|
|
244
|
-
});
|