isomorfeus-asset-manager 0.14.25 → 0.14.26

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,6 +23,8 @@ interface CommonOptions {
23
23
  target?: string | string[];
24
24
  /** Documentation: https://esbuild.github.io/api/#supported */
25
25
  supported?: Record<string, boolean>;
26
+ /** Documentation: https://esbuild.github.io/api/#platform */
27
+ platform?: Platform;
26
28
 
27
29
  /** Documentation: https://esbuild.github.io/api/#mangle-props */
28
30
  mangleProps?: RegExp;
@@ -50,11 +52,15 @@ interface CommonOptions {
50
52
  ignoreAnnotations?: boolean;
51
53
 
52
54
  /** Documentation: https://esbuild.github.io/api/#jsx */
53
- jsx?: 'transform' | 'preserve';
55
+ jsx?: 'transform' | 'preserve' | 'automatic';
54
56
  /** Documentation: https://esbuild.github.io/api/#jsx-factory */
55
57
  jsxFactory?: string;
56
58
  /** Documentation: https://esbuild.github.io/api/#jsx-fragment */
57
59
  jsxFragment?: string;
60
+ /** Documentation: https://esbuild.github.io/api/#jsx-import-source */
61
+ jsxImportSource?: string;
62
+ /** Documentation: https://esbuild.github.io/api/#jsx-development */
63
+ jsxDev?: boolean;
58
64
 
59
65
  /** Documentation: https://esbuild.github.io/api/#define */
60
66
  define?: { [key: string]: string };
@@ -88,8 +94,6 @@ export interface BuildOptions extends CommonOptions {
88
94
  outdir?: string;
89
95
  /** Documentation: https://esbuild.github.io/api/#outbase */
90
96
  outbase?: string;
91
- /** Documentation: https://esbuild.github.io/api/#platform */
92
- platform?: Platform;
93
97
  /** Documentation: https://esbuild.github.io/api/#external */
94
98
  external?: string[];
95
99
  /** Documentation: https://esbuild.github.io/api/#loader */
@@ -143,7 +147,7 @@ export interface WatchMode {
143
147
  }
144
148
 
145
149
  export interface StdinOptions {
146
- contents: string;
150
+ contents: string | Uint8Array;
147
151
  resolveDir?: string;
148
152
  sourcefile?: string;
149
153
  loader?: Loader;
@@ -495,7 +499,7 @@ export declare function serve(serveOptions: ServeOptions, buildOptions: BuildOpt
495
499
  *
496
500
  * Documentation: https://esbuild.github.io/api/#transform-api
497
501
  */
498
- export declare function transform(input: string, options?: TransformOptions): Promise<TransformResult>;
502
+ export declare function transform(input: string | Uint8Array, options?: TransformOptions): Promise<TransformResult>;
499
503
 
500
504
  /**
501
505
  * Converts log messages to formatted message strings suitable for printing in
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  }
18
18
  return to;
19
19
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
21
24
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
25
 
23
26
  // lib/npm/node.ts
@@ -301,11 +304,14 @@ function pushCommonFlags(flags, options, keys) {
301
304
  let jsx = getFlag(options, keys, "jsx", mustBeString);
302
305
  let jsxFactory = getFlag(options, keys, "jsxFactory", mustBeString);
303
306
  let jsxFragment = getFlag(options, keys, "jsxFragment", mustBeString);
307
+ let jsxImportSource = getFlag(options, keys, "jsxImportSource", mustBeString);
308
+ let jsxDev = getFlag(options, keys, "jsxDev", mustBeBoolean);
304
309
  let define = getFlag(options, keys, "define", mustBeObject);
305
310
  let logOverride = getFlag(options, keys, "logOverride", mustBeObject);
306
311
  let supported = getFlag(options, keys, "supported", mustBeObject);
307
312
  let pure = getFlag(options, keys, "pure", mustBeArray);
308
313
  let keepNames = getFlag(options, keys, "keepNames", mustBeBoolean);
314
+ let platform = getFlag(options, keys, "platform", mustBeString);
309
315
  if (legalComments)
310
316
  flags.push(`--legal-comments=${legalComments}`);
311
317
  if (sourceRoot !== void 0)
@@ -322,6 +328,8 @@ function pushCommonFlags(flags, options, keys) {
322
328
  flags.push(`--format=${format}`);
323
329
  if (globalName)
324
330
  flags.push(`--global-name=${globalName}`);
331
+ if (platform)
332
+ flags.push(`--platform=${platform}`);
325
333
  if (minify)
326
334
  flags.push("--minify");
327
335
  if (minifySyntax)
@@ -351,6 +359,10 @@ function pushCommonFlags(flags, options, keys) {
351
359
  flags.push(`--jsx-factory=${jsxFactory}`);
352
360
  if (jsxFragment)
353
361
  flags.push(`--jsx-fragment=${jsxFragment}`);
362
+ if (jsxImportSource)
363
+ flags.push(`--jsx-import-source=${jsxImportSource}`);
364
+ if (jsxDev)
365
+ flags.push(`--jsx-dev`);
354
366
  if (define) {
355
367
  for (let key in define) {
356
368
  if (key.indexOf("=") >= 0)
@@ -397,7 +409,6 @@ function flagsForBuildOptions(callName, options, isTTY2, logLevelDefault, writeD
397
409
  let outfile = getFlag(options, keys, "outfile", mustBeString);
398
410
  let outdir = getFlag(options, keys, "outdir", mustBeString);
399
411
  let outbase = getFlag(options, keys, "outbase", mustBeString);
400
- let platform = getFlag(options, keys, "platform", mustBeString);
401
412
  let tsconfig = getFlag(options, keys, "tsconfig", mustBeString);
402
413
  let resolveExtensions = getFlag(options, keys, "resolveExtensions", mustBeArray);
403
414
  let nodePathsInput = getFlag(options, keys, "nodePaths", mustBeArray);
@@ -451,8 +462,6 @@ function flagsForBuildOptions(callName, options, isTTY2, logLevelDefault, writeD
451
462
  flags.push(`--outdir=${outdir}`);
452
463
  if (outbase)
453
464
  flags.push(`--outbase=${outbase}`);
454
- if (platform)
455
- flags.push(`--platform=${platform}`);
456
465
  if (tsconfig)
457
466
  flags.push(`--tsconfig=${tsconfig}`);
458
467
  if (resolveExtensions) {
@@ -540,7 +549,7 @@ function flagsForBuildOptions(callName, options, isTTY2, logLevelDefault, writeD
540
549
  }
541
550
  if (stdin) {
542
551
  let stdinKeys = /* @__PURE__ */ Object.create(null);
543
- let contents = getFlag(stdin, stdinKeys, "contents", mustBeString);
552
+ let contents = getFlag(stdin, stdinKeys, "contents", mustBeStringOrUint8Array);
544
553
  let resolveDir = getFlag(stdin, stdinKeys, "resolveDir", mustBeString);
545
554
  let sourcefile = getFlag(stdin, stdinKeys, "sourcefile", mustBeString);
546
555
  let loader2 = getFlag(stdin, stdinKeys, "loader", mustBeString);
@@ -551,7 +560,10 @@ function flagsForBuildOptions(callName, options, isTTY2, logLevelDefault, writeD
551
560
  flags.push(`--loader=${loader2}`);
552
561
  if (resolveDir)
553
562
  stdinResolveDir = resolveDir + "";
554
- stdinContents = contents ? contents + "" : "";
563
+ if (typeof contents === "string")
564
+ stdinContents = encodeUTF8(contents);
565
+ else if (contents instanceof Uint8Array)
566
+ stdinContents = contents;
555
567
  }
556
568
  let nodePaths = [];
557
569
  if (nodePathsInput) {
@@ -746,8 +758,8 @@ function createChannel(streamIn) {
746
758
  if (isFirstPacket) {
747
759
  isFirstPacket = false;
748
760
  let binaryVersion = String.fromCharCode(...bytes);
749
- if (binaryVersion !== "0.14.49") {
750
- throw new Error(`Cannot start service: Host version "${"0.14.49"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
761
+ if (binaryVersion !== "0.14.53") {
762
+ throw new Error(`Cannot start service: Host version "${"0.14.53"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
751
763
  }
752
764
  return;
753
765
  }
@@ -1134,25 +1146,28 @@ function createChannel(streamIn) {
1134
1146
  if (plugins && plugins.length > 0) {
1135
1147
  if (streamIn.isSync)
1136
1148
  return handleError(new Error("Cannot use plugins in synchronous API calls"), "");
1137
- handlePlugins(options, plugins, key, details, refs).then((result) => {
1138
- if (!result.ok) {
1139
- handleError(result.error, result.pluginName);
1140
- } else {
1141
- try {
1142
- buildOrServeContinue({
1143
- ...args,
1144
- key,
1145
- details,
1146
- logPluginError,
1147
- requestPlugins: result.requestPlugins,
1148
- runOnEndCallbacks: result.runOnEndCallbacks,
1149
- pluginRefs: result.pluginRefs
1150
- });
1151
- } catch (e) {
1152
- handleError(e, "");
1149
+ handlePlugins(options, plugins, key, details, refs).then(
1150
+ (result) => {
1151
+ if (!result.ok) {
1152
+ handleError(result.error, result.pluginName);
1153
+ } else {
1154
+ try {
1155
+ buildOrServeContinue({
1156
+ ...args,
1157
+ key,
1158
+ details,
1159
+ logPluginError,
1160
+ requestPlugins: result.requestPlugins,
1161
+ runOnEndCallbacks: result.runOnEndCallbacks,
1162
+ pluginRefs: result.pluginRefs
1163
+ });
1164
+ } catch (e) {
1165
+ handleError(e, "");
1166
+ }
1153
1167
  }
1154
- }
1155
- }, (e) => handleError(e, ""));
1168
+ },
1169
+ (e) => handleError(e, "")
1170
+ );
1156
1171
  } else {
1157
1172
  try {
1158
1173
  buildOrServeContinue({
@@ -1256,18 +1271,22 @@ function createChannel(streamIn) {
1256
1271
  rebuild = () => new Promise((resolve, reject) => {
1257
1272
  if (isDisposed || closeData)
1258
1273
  throw new Error("Cannot rebuild");
1259
- sendRequest(refs, { command: "rebuild", key }, (error2, response2) => {
1260
- if (error2) {
1261
- const message = { id: "", pluginName: "", text: error2, location: null, notes: [], detail: void 0 };
1262
- return callback2(failureErrorWithLog("Build failed", [message], []), null);
1274
+ sendRequest(
1275
+ refs,
1276
+ { command: "rebuild", key },
1277
+ (error2, response2) => {
1278
+ if (error2) {
1279
+ const message = { id: "", pluginName: "", text: error2, location: null, notes: [], detail: void 0 };
1280
+ return callback2(failureErrorWithLog("Build failed", [message], []), null);
1281
+ }
1282
+ buildResponseToResult(response2, (error3, result3) => {
1283
+ if (error3)
1284
+ reject(error3);
1285
+ else
1286
+ resolve(result3);
1287
+ });
1263
1288
  }
1264
- buildResponseToResult(response2, (error3, result3) => {
1265
- if (error3)
1266
- reject(error3);
1267
- else
1268
- resolve(result3);
1269
- });
1270
- });
1289
+ );
1271
1290
  });
1272
1291
  refs.ref();
1273
1292
  rebuild.dispose = () => {
@@ -1362,8 +1381,8 @@ function createChannel(streamIn) {
1362
1381
  const details = createObjectStash();
1363
1382
  let start = (inputPath) => {
1364
1383
  try {
1365
- if (typeof input !== "string")
1366
- throw new Error('The input to "transform" must be a string');
1384
+ if (typeof input !== "string" && !(input instanceof Uint8Array))
1385
+ throw new Error('The input to "transform" must be a string or a Uint8Array');
1367
1386
  let {
1368
1387
  flags,
1369
1388
  mangleCache
@@ -1372,7 +1391,7 @@ function createChannel(streamIn) {
1372
1391
  command: "transform",
1373
1392
  flags,
1374
1393
  inputFS: inputPath !== null,
1375
- input: inputPath !== null ? inputPath : input
1394
+ input: inputPath !== null ? encodeUTF8(inputPath) : typeof input === "string" ? encodeUTF8(input) : input
1376
1395
  };
1377
1396
  if (mangleCache)
1378
1397
  request.mangleCache = mangleCache;
@@ -1429,7 +1448,7 @@ function createChannel(streamIn) {
1429
1448
  });
1430
1449
  }
1431
1450
  };
1432
- if (typeof input === "string" && input.length > 1024 * 1024) {
1451
+ if ((typeof input === "string" || input instanceof Uint8Array) && input.length > 1024 * 1024) {
1433
1452
  let next = start;
1434
1453
  start = () => fs3.writeFile(input, next);
1435
1454
  }
@@ -1688,8 +1707,11 @@ function convertOutputFiles({ path: path3, contents }) {
1688
1707
  path: path3,
1689
1708
  contents,
1690
1709
  get text() {
1691
- if (text === null)
1692
- text = decodeUTF8(contents);
1710
+ const binary = this.contents;
1711
+ if (text === null || binary !== contents) {
1712
+ contents = binary;
1713
+ text = decodeUTF8(binary);
1714
+ }
1693
1715
  return text;
1694
1716
  }
1695
1717
  };
@@ -1719,6 +1741,7 @@ var knownUnixlikePackages = {
1719
1741
  "linux riscv64 LE": "esbuild-linux-riscv64",
1720
1742
  "linux s390x BE": "esbuild-linux-s390x",
1721
1743
  "linux x64 LE": "esbuild-linux-64",
1744
+ "linux loong64 LE": "@esbuild/linux-loong64",
1722
1745
  "netbsd x64 LE": "esbuild-netbsd-64",
1723
1746
  "openbsd x64 LE": "esbuild-openbsd-64",
1724
1747
  "sunos x64 LE": "esbuild-sunos-64"
@@ -1863,12 +1886,14 @@ if (process.env.ESBUILD_WORKER_THREADS !== "0") {
1863
1886
  }
1864
1887
  }
1865
1888
  var _a;
1866
- var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.14.49";
1889
+ var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.14.53";
1867
1890
  var esbuildCommandAndArgs = () => {
1868
1891
  if ((!ESBUILD_BINARY_PATH || true) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
1869
- throw new Error(`The esbuild JavaScript API cannot be bundled. Please mark the "esbuild" package as external so it's not included in the bundle.
1892
+ throw new Error(
1893
+ `The esbuild JavaScript API cannot be bundled. Please mark the "esbuild" package as external so it's not included in the bundle.
1870
1894
 
1871
- More information: The file containing the code for esbuild's JavaScript API (${__filename}) does not appear to be inside the esbuild package on the file system, which usually means that the esbuild package was bundled into another file. This is problematic because the API needs to run a binary executable inside the esbuild package which is located using a relative path from the API code to the executable. If the esbuild package is bundled, the relative path will be incorrect and the executable won't be found.`);
1895
+ More information: The file containing the code for esbuild's JavaScript API (${__filename}) does not appear to be inside the esbuild package on the file system, which usually means that the esbuild package was bundled into another file. This is problematic because the API needs to run a binary executable inside the esbuild package which is located using a relative path from the API code to the executable. If the esbuild package is bundled, the relative path will be incorrect and the executable won't be found.`
1896
+ );
1872
1897
  }
1873
1898
  if (true) {
1874
1899
  return ["node", [path2.join(__dirname, "..", "bin", "esbuild")]];
@@ -1927,7 +1952,7 @@ var fsAsync = {
1927
1952
  }
1928
1953
  }
1929
1954
  };
1930
- var version = "0.14.49";
1955
+ var version = "0.14.53";
1931
1956
  var build = (options) => ensureServiceIsRunning().build(options);
1932
1957
  var serve = (serveOptions, buildOptions) => ensureServiceIsRunning().serve(serveOptions, buildOptions);
1933
1958
  var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
@@ -2038,7 +2063,7 @@ var ensureServiceIsRunning = () => {
2038
2063
  if (longLivedService)
2039
2064
  return longLivedService;
2040
2065
  let [command, args] = esbuildCommandAndArgs();
2041
- let child = child_process.spawn(command, args.concat(`--service=${"0.14.49"}`, "--ping"), {
2066
+ let child = child_process.spawn(command, args.concat(`--service=${"0.14.53"}`, "--ping"), {
2042
2067
  windowsHide: true,
2043
2068
  stdio: ["pipe", "pipe", "inherit"],
2044
2069
  cwd: defaultWD
@@ -2152,7 +2177,7 @@ var runServiceSync = (callback) => {
2152
2177
  esbuild: node_exports
2153
2178
  });
2154
2179
  callback(service);
2155
- let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.14.49"}`), {
2180
+ let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.14.53"}`), {
2156
2181
  cwd: defaultWD,
2157
2182
  windowsHide: true,
2158
2183
  input: stdin,
@@ -2168,12 +2193,11 @@ var workerThreadService = null;
2168
2193
  var startWorkerThreadService = (worker_threads2) => {
2169
2194
  let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
2170
2195
  let worker = new worker_threads2.Worker(__filename, {
2171
- workerData: { workerPort, defaultWD, esbuildVersion: "0.14.49" },
2196
+ workerData: { workerPort, defaultWD, esbuildVersion: "0.14.53" },
2172
2197
  transferList: [workerPort],
2173
2198
  execArgv: []
2174
2199
  });
2175
2200
  let nextID = 0;
2176
- let wasStopped = false;
2177
2201
  let fakeBuildError = (text) => {
2178
2202
  let error = new Error(`Build failed with 1 error:
2179
2203
  error: ${text}`);
@@ -2201,8 +2225,6 @@ error: ${text}`);
2201
2225
  }
2202
2226
  };
2203
2227
  let runCallSync = (command, args) => {
2204
- if (wasStopped)
2205
- throw new Error("The service was stopped");
2206
2228
  let id = nextID++;
2207
2229
  let sharedBuffer = new SharedArrayBuffer(8);
2208
2230
  let sharedBufferView = new Int32Array(sharedBuffer);
@@ -2240,8 +2262,6 @@ error: ${text}`);
2240
2262
  var startSyncServiceWorker = () => {
2241
2263
  let workerPort = worker_threads.workerData.workerPort;
2242
2264
  let parentPort = worker_threads.parentPort;
2243
- let service = ensureServiceIsRunning();
2244
- defaultWD = worker_threads.workerData.defaultWD;
2245
2265
  let extractProperties = (object) => {
2246
2266
  let properties = {};
2247
2267
  if (object && typeof object === "object") {
@@ -2251,34 +2271,46 @@ var startSyncServiceWorker = () => {
2251
2271
  }
2252
2272
  return properties;
2253
2273
  };
2254
- parentPort.on("message", (msg) => {
2255
- (async () => {
2256
- let { sharedBuffer, id, command, args } = msg;
2257
- let sharedBufferView = new Int32Array(sharedBuffer);
2258
- try {
2259
- switch (command) {
2260
- case "build":
2261
- workerPort.postMessage({ id, resolve: await service.build(args[0]) });
2262
- break;
2263
- case "transform":
2264
- workerPort.postMessage({ id, resolve: await service.transform(args[0], args[1]) });
2265
- break;
2266
- case "formatMessages":
2267
- workerPort.postMessage({ id, resolve: await service.formatMessages(args[0], args[1]) });
2268
- break;
2269
- case "analyzeMetafile":
2270
- workerPort.postMessage({ id, resolve: await service.analyzeMetafile(args[0], args[1]) });
2271
- break;
2272
- default:
2273
- throw new Error(`Invalid command: ${command}`);
2274
+ try {
2275
+ let service = ensureServiceIsRunning();
2276
+ defaultWD = worker_threads.workerData.defaultWD;
2277
+ parentPort.on("message", (msg) => {
2278
+ (async () => {
2279
+ let { sharedBuffer, id, command, args } = msg;
2280
+ let sharedBufferView = new Int32Array(sharedBuffer);
2281
+ try {
2282
+ switch (command) {
2283
+ case "build":
2284
+ workerPort.postMessage({ id, resolve: await service.build(args[0]) });
2285
+ break;
2286
+ case "transform":
2287
+ workerPort.postMessage({ id, resolve: await service.transform(args[0], args[1]) });
2288
+ break;
2289
+ case "formatMessages":
2290
+ workerPort.postMessage({ id, resolve: await service.formatMessages(args[0], args[1]) });
2291
+ break;
2292
+ case "analyzeMetafile":
2293
+ workerPort.postMessage({ id, resolve: await service.analyzeMetafile(args[0], args[1]) });
2294
+ break;
2295
+ default:
2296
+ throw new Error(`Invalid command: ${command}`);
2297
+ }
2298
+ } catch (reject) {
2299
+ workerPort.postMessage({ id, reject, properties: extractProperties(reject) });
2274
2300
  }
2275
- } catch (reject) {
2276
- workerPort.postMessage({ id, reject, properties: extractProperties(reject) });
2277
- }
2301
+ Atomics.add(sharedBufferView, 0, 1);
2302
+ Atomics.notify(sharedBufferView, 0, Infinity);
2303
+ })();
2304
+ });
2305
+ } catch (reject) {
2306
+ parentPort.on("message", (msg) => {
2307
+ let { sharedBuffer, id } = msg;
2308
+ let sharedBufferView = new Int32Array(sharedBuffer);
2309
+ workerPort.postMessage({ id, reject, properties: extractProperties(reject) });
2278
2310
  Atomics.add(sharedBufferView, 0, 1);
2279
2311
  Atomics.notify(sharedBufferView, 0, Infinity);
2280
- })();
2281
- });
2312
+ });
2313
+ }
2282
2314
  };
2283
2315
  if (isInternalWorkerThread) {
2284
2316
  startSyncServiceWorker();
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esbuild-wasm",
3
- "version": "0.14.49",
3
+ "version": "0.14.53",
4
4
  "description": "The cross-platform WebAssembly binary for esbuild, a JavaScript bundler.",
5
5
  "repository": "https://github.com/evanw/esbuild",
6
6
  "license": "MIT",
data/package.json CHANGED
@@ -4,6 +4,6 @@
4
4
  "license": "MIT",
5
5
  "homepage": "https://github.com/isomorfeus/isomorfeus-asset-manager",
6
6
  "dependencies": {
7
- "esbuild-wasm": "0.14.49"
7
+ "esbuild-wasm": "0.14.53"
8
8
  }
9
9
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isomorfeus-asset-manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.25
4
+ version: 0.14.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-11 00:00:00.000000000 Z
11
+ date: 2022-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: brotli