isomorfeus-asset-manager 0.14.5 → 0.14.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -272,6 +272,21 @@ function validateInitializeOptions(options) {
272
272
  worker
273
273
  };
274
274
  }
275
+ function validateMangleCache(mangleCache) {
276
+ let validated;
277
+ if (mangleCache !== void 0) {
278
+ validated = /* @__PURE__ */ Object.create(null);
279
+ for (let key of Object.keys(mangleCache)) {
280
+ let value = mangleCache[key];
281
+ if (typeof value === "string" || value === false) {
282
+ validated[key] = value;
283
+ } else {
284
+ throw new Error(`Expected ${JSON.stringify(key)} in mangle cache to map to either a string or false`);
285
+ }
286
+ }
287
+ }
288
+ return validated;
289
+ }
275
290
  function pushLogFlags(flags, options, keys, isTTY2, logLevelDefault) {
276
291
  let color = getFlag(options, keys, "color", mustBeBoolean);
277
292
  let logLevel = getFlag(options, keys, "logLevel", mustBeString);
@@ -290,6 +305,8 @@ function pushCommonFlags(flags, options, keys) {
290
305
  let target = getFlag(options, keys, "target", mustBeStringOrArray);
291
306
  let format = getFlag(options, keys, "format", mustBeString);
292
307
  let globalName = getFlag(options, keys, "globalName", mustBeString);
308
+ let mangleProps = getFlag(options, keys, "mangleProps", mustBeRegExp);
309
+ let reserveProps = getFlag(options, keys, "reserveProps", mustBeRegExp);
293
310
  let minify = getFlag(options, keys, "minify", mustBeBoolean);
294
311
  let minifySyntax = getFlag(options, keys, "minifySyntax", mustBeBoolean);
295
312
  let minifyWhitespace = getFlag(options, keys, "minifyWhitespace", mustBeBoolean);
@@ -337,6 +354,10 @@ function pushCommonFlags(flags, options, keys) {
337
354
  if (drop)
338
355
  for (let what of drop)
339
356
  flags.push(`--drop:${what}`);
357
+ if (mangleProps)
358
+ flags.push(`--mangle-props=${mangleProps.source}`);
359
+ if (reserveProps)
360
+ flags.push(`--reserve-props=${reserveProps.source}`);
340
361
  if (jsx)
341
362
  flags.push(`--jsx=${jsx}`);
342
363
  if (jsxFactory)
@@ -397,6 +418,7 @@ function flagsForBuildOptions(callName, options, isTTY2, logLevelDefault, writeD
397
418
  let write = (_a2 = getFlag(options, keys, "write", mustBeBoolean)) != null ? _a2 : writeDefault;
398
419
  let allowOverwrite = getFlag(options, keys, "allowOverwrite", mustBeBoolean);
399
420
  let incremental = getFlag(options, keys, "incremental", mustBeBoolean) === true;
421
+ let mangleCache = getFlag(options, keys, "mangleCache", mustBeObject);
400
422
  keys.plugins = true;
401
423
  checkForInvalidFlags(options, keys, `in ${callName}() call`);
402
424
  if (sourcemap)
@@ -546,7 +568,8 @@ function flagsForBuildOptions(callName, options, isTTY2, logLevelDefault, writeD
546
568
  absWorkingDir,
547
569
  incremental,
548
570
  nodePaths,
549
- watch: watchMode
571
+ watch: watchMode,
572
+ mangleCache: validateMangleCache(mangleCache)
550
573
  };
551
574
  }
552
575
  function flagsForTransformOptions(callName, options, isTTY2, logLevelDefault) {
@@ -560,6 +583,7 @@ function flagsForTransformOptions(callName, options, isTTY2, logLevelDefault) {
560
583
  let loader = getFlag(options, keys, "loader", mustBeString);
561
584
  let banner = getFlag(options, keys, "banner", mustBeString);
562
585
  let footer = getFlag(options, keys, "footer", mustBeString);
586
+ let mangleCache = getFlag(options, keys, "mangleCache", mustBeObject);
563
587
  checkForInvalidFlags(options, keys, `in ${callName}() call`);
564
588
  if (sourcemap)
565
589
  flags.push(`--sourcemap=${sourcemap === true ? "external" : sourcemap}`);
@@ -573,7 +597,10 @@ function flagsForTransformOptions(callName, options, isTTY2, logLevelDefault) {
573
597
  flags.push(`--banner=${banner}`);
574
598
  if (footer)
575
599
  flags.push(`--footer=${footer}`);
576
- return flags;
600
+ return {
601
+ flags,
602
+ mangleCache: validateMangleCache(mangleCache)
603
+ };
577
604
  }
578
605
  function createChannel(streamIn) {
579
606
  let responseCallbacks = /* @__PURE__ */ new Map();
@@ -717,8 +744,8 @@ function createChannel(streamIn) {
717
744
  if (isFirstPacket) {
718
745
  isFirstPacket = false;
719
746
  let binaryVersion = String.fromCharCode(...bytes);
720
- if (binaryVersion !== "0.14.11") {
721
- throw new Error(`Cannot start service: Host version "${"0.14.11"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
747
+ if (binaryVersion !== "0.14.20") {
748
+ throw new Error(`Cannot start service: Host version "${"0.14.20"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
722
749
  }
723
750
  return;
724
751
  }
@@ -1177,7 +1204,8 @@ function createChannel(streamIn) {
1177
1204
  absWorkingDir,
1178
1205
  incremental,
1179
1206
  nodePaths,
1180
- watch
1207
+ watch,
1208
+ mangleCache
1181
1209
  } = flagsForBuildOptions(callName, options, isTTY2, buildLogLevelDefault, writeDefault);
1182
1210
  let request = {
1183
1211
  command: "build",
@@ -1193,6 +1221,8 @@ function createChannel(streamIn) {
1193
1221
  };
1194
1222
  if (requestPlugins)
1195
1223
  request.plugins = requestPlugins;
1224
+ if (mangleCache)
1225
+ request.mangleCache = mangleCache;
1196
1226
  let serve2 = serveOptions && buildServeData(refs, serveOptions, request, key);
1197
1227
  let rebuild;
1198
1228
  let stop;
@@ -1201,6 +1231,8 @@ function createChannel(streamIn) {
1201
1231
  result.outputFiles = response.outputFiles.map(convertOutputFiles);
1202
1232
  if (response.metafile)
1203
1233
  result.metafile = JSON.parse(response.metafile);
1234
+ if (response.mangleCache)
1235
+ result.mangleCache = response.mangleCache;
1204
1236
  if (response.writeToStdout !== void 0)
1205
1237
  console.log(decodeUTF8(response.writeToStdout).replace(/\n$/, ""));
1206
1238
  };
@@ -1328,20 +1360,32 @@ function createChannel(streamIn) {
1328
1360
  try {
1329
1361
  if (typeof input !== "string")
1330
1362
  throw new Error('The input to "transform" must be a string');
1331
- let flags = flagsForTransformOptions(callName, options, isTTY2, transformLogLevelDefault);
1363
+ let {
1364
+ flags,
1365
+ mangleCache
1366
+ } = flagsForTransformOptions(callName, options, isTTY2, transformLogLevelDefault);
1332
1367
  let request = {
1333
1368
  command: "transform",
1334
1369
  flags,
1335
1370
  inputFS: inputPath !== null,
1336
1371
  input: inputPath !== null ? inputPath : input
1337
1372
  };
1373
+ if (mangleCache)
1374
+ request.mangleCache = mangleCache;
1338
1375
  sendRequest(refs, request, (error, response) => {
1339
1376
  if (error)
1340
1377
  return callback(new Error(error), null);
1341
1378
  let errors = replaceDetailsInMessages(response.errors, details);
1342
1379
  let warnings = replaceDetailsInMessages(response.warnings, details);
1343
1380
  let outstanding = 1;
1344
- let next = () => --outstanding === 0 && callback(null, { warnings, code: response.code, map: response.map });
1381
+ let next = () => {
1382
+ if (--outstanding === 0) {
1383
+ let result = { warnings, code: response.code, map: response.map };
1384
+ if (response.mangleCache)
1385
+ result.mangleCache = response == null ? void 0 : response.mangleCache;
1386
+ callback(null, result);
1387
+ }
1388
+ };
1345
1389
  if (errors.length > 0)
1346
1390
  return callback(failureErrorWithLog("Transform failed", errors, warnings), null);
1347
1391
  if (response.codeFS) {
@@ -1687,6 +1731,29 @@ function pkgAndSubpathForCurrentPlatform() {
1687
1731
  }
1688
1732
  return { pkg, subpath };
1689
1733
  }
1734
+ function pkgForSomeOtherPlatform() {
1735
+ const libMainJS = require.resolve("esbuild");
1736
+ const nodeModulesDirectory = path.dirname(path.dirname(path.dirname(libMainJS)));
1737
+ if (path.basename(nodeModulesDirectory) === "node_modules") {
1738
+ for (const unixKey in knownUnixlikePackages) {
1739
+ try {
1740
+ const pkg = knownUnixlikePackages[unixKey];
1741
+ if (fs.existsSync(path.join(nodeModulesDirectory, pkg)))
1742
+ return pkg;
1743
+ } catch {
1744
+ }
1745
+ }
1746
+ for (const windowsKey in knownWindowsPackages) {
1747
+ try {
1748
+ const pkg = knownWindowsPackages[windowsKey];
1749
+ if (fs.existsSync(path.join(nodeModulesDirectory, pkg)))
1750
+ return pkg;
1751
+ } catch {
1752
+ }
1753
+ }
1754
+ }
1755
+ return null;
1756
+ }
1690
1757
  function downloadedBinPath(pkg, subpath) {
1691
1758
  const esbuildLibDir = path.dirname(require.resolve("esbuild"));
1692
1759
  return path.join(esbuildLibDir, `downloaded-${pkg}-${path.basename(subpath)}`);
@@ -1705,6 +1772,36 @@ function generateBinPath() {
1705
1772
  try {
1706
1773
  require.resolve(pkg);
1707
1774
  } catch {
1775
+ const otherPkg = pkgForSomeOtherPlatform();
1776
+ if (otherPkg) {
1777
+ throw new Error(`
1778
+ You installed esbuild on another platform than the one you're currently using.
1779
+ This won't work because esbuild is written with native code and needs to
1780
+ install a platform-specific binary executable.
1781
+
1782
+ Specifically the "${otherPkg}" package is present but this platform
1783
+ needs the "${pkg}" package instead. People often get into this
1784
+ situation by installing esbuild on Windows or macOS and copying "node_modules"
1785
+ into a Docker image that runs Linux, or by copying "node_modules" between
1786
+ Windows and WSL environments.
1787
+
1788
+ If you are installing with npm, you can try not copying the "node_modules"
1789
+ directory when you copy the files over, and running "npm ci" or "npm install"
1790
+ on the destination platform after the copy. Or you could consider using yarn
1791
+ instead which has built-in support for installing a package on multiple
1792
+ platforms simultaneously.
1793
+
1794
+ If you are installing with yarn, you can try listing both this platform and the
1795
+ other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
1796
+ feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
1797
+ Keep in mind that this means multiple copies of esbuild will be present.
1798
+
1799
+ Another alternative is to use the "esbuild-wasm" package instead, which works
1800
+ the same way on all platforms. But it comes with a heavy performance cost and
1801
+ can sometimes be 10x slower than the "esbuild" package, so you may also not
1802
+ want to do that.
1803
+ `);
1804
+ }
1708
1805
  throw new Error(`The package "${pkg}" could not be found, and is needed by esbuild.
1709
1806
 
1710
1807
  If you are installing esbuild with npm, make sure that you don't specify the
@@ -1751,7 +1848,7 @@ if (process.env.ESBUILD_WORKER_THREADS !== "0") {
1751
1848
  }
1752
1849
  }
1753
1850
  var _a;
1754
- var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.14.11";
1851
+ var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.14.20";
1755
1852
  var esbuildCommandAndArgs = () => {
1756
1853
  if ((!ESBUILD_BINARY_PATH || true) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
1757
1854
  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.
@@ -1810,7 +1907,7 @@ var fsAsync = {
1810
1907
  }
1811
1908
  }
1812
1909
  };
1813
- var version = "0.14.11";
1910
+ var version = "0.14.20";
1814
1911
  var build = (options) => ensureServiceIsRunning().build(options);
1815
1912
  var serve = (serveOptions, buildOptions) => ensureServiceIsRunning().serve(serveOptions, buildOptions);
1816
1913
  var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
@@ -1919,7 +2016,7 @@ var ensureServiceIsRunning = () => {
1919
2016
  if (longLivedService)
1920
2017
  return longLivedService;
1921
2018
  let [command, args] = esbuildCommandAndArgs();
1922
- let child = child_process.spawn(command, args.concat(`--service=${"0.14.11"}`, "--ping"), {
2019
+ let child = child_process.spawn(command, args.concat(`--service=${"0.14.20"}`, "--ping"), {
1923
2020
  windowsHide: true,
1924
2021
  stdio: ["pipe", "pipe", "inherit"],
1925
2022
  cwd: defaultWD
@@ -2028,7 +2125,7 @@ var runServiceSync = (callback) => {
2028
2125
  esbuild: node_exports
2029
2126
  });
2030
2127
  callback(service);
2031
- let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.14.11"}`), {
2128
+ let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.14.20"}`), {
2032
2129
  cwd: defaultWD,
2033
2130
  windowsHide: true,
2034
2131
  input: stdin,
@@ -2044,7 +2141,7 @@ var workerThreadService = null;
2044
2141
  var startWorkerThreadService = (worker_threads2) => {
2045
2142
  let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
2046
2143
  let worker = new worker_threads2.Worker(__filename, {
2047
- workerData: { workerPort, defaultWD, esbuildVersion: "0.14.11" },
2144
+ workerData: { workerPort, defaultWD, esbuildVersion: "0.14.20" },
2048
2145
  transferList: [workerPort],
2049
2146
  execArgv: []
2050
2147
  });
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "esbuild-wasm",
3
- "version": "0.14.11",
3
+ "version": "0.14.20",
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",
7
7
  "engines": {
8
- "node": ">=8"
8
+ "node": ">=12"
9
9
  },
10
10
  "main": "lib/main.js",
11
11
  "browser": "lib/browser.js",
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.11"
7
+ "esbuild-wasm": "0.14.20"
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.5
4
+ version: 0.14.9
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-01-16 00:00:00.000000000 Z
11
+ date: 2022-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: isomorfeus-iodine
@@ -163,11 +163,12 @@ files:
163
163
  - node_modules/esbuild-wasm/package.json
164
164
  - node_modules/esbuild-wasm/wasm_exec.js
165
165
  - package.json
166
- homepage: http://isomorfeus.com
166
+ homepage: https://isomorfeus.com
167
167
  licenses:
168
168
  - MIT
169
169
  metadata:
170
170
  github_repo: ssh://github.com/isomorfeus/gems
171
+ source_code_uri: https://github.com/isomorfeus/isomorfeus-asset-manager
171
172
  post_install_message:
172
173
  rdoc_options: []
173
174
  require_paths: