@atlaspack/core 2.16.2-dev.72 → 2.16.2-dev.93

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/lib/AssetGraph.js +9 -0
  3. package/lib/Atlaspack.js +5 -2
  4. package/lib/AtlaspackConfig.schema.js +7 -1
  5. package/lib/BundleGraph.js +3 -4
  6. package/lib/PackagerRunner.js +2 -5
  7. package/lib/RequestTracker.js +48 -39
  8. package/lib/Transformation.js +2 -2
  9. package/lib/atlaspack-v3/AtlaspackV3.js +1 -44
  10. package/lib/atlaspack-v3/NapiWorkerPool.js +1 -1
  11. package/lib/atlaspack-v3/worker/compat/environment.js +2 -2
  12. package/lib/atlaspack-v3/worker/compat/mutable-asset.js +6 -6
  13. package/lib/atlaspack-v3/worker/compat/plugin-config.js +5 -5
  14. package/lib/atlaspack-v3/worker/index.js +6 -0
  15. package/lib/atlaspack-v3/worker/worker.js +4 -11
  16. package/lib/dumpGraphToGraphViz.js +1 -1
  17. package/lib/index.js +24 -4
  18. package/lib/loadAtlaspackPlugin.js +0 -15
  19. package/lib/public/Config.js +1 -8
  20. package/lib/public/PluginOptions.js +0 -3
  21. package/lib/requests/AtlaspackConfigRequest.js +29 -44
  22. package/lib/requests/DevDepRequest.js +22 -1
  23. package/lib/requests/PathRequest.js +10 -0
  24. package/lib/resolveOptions.js +4 -5
  25. package/lib/worker.js +26 -9
  26. package/package.json +17 -31
  27. package/src/AssetGraph.js +13 -0
  28. package/src/Atlaspack.js +7 -8
  29. package/src/BundleGraph.js +1 -8
  30. package/src/PackagerRunner.js +0 -5
  31. package/src/RequestTracker.js +8 -6
  32. package/src/atlaspack-v3/AtlaspackV3.js +2 -53
  33. package/src/atlaspack-v3/NapiWorkerPool.js +1 -5
  34. package/src/atlaspack-v3/worker/worker.js +4 -11
  35. package/src/index.js +5 -3
  36. package/src/loadAtlaspackPlugin.js +1 -23
  37. package/src/public/Config.js +1 -2
  38. package/src/public/PluginOptions.js +0 -4
  39. package/src/requests/AtlaspackConfigRequest.js +31 -77
  40. package/src/requests/DevDepRequest.js +44 -12
  41. package/src/requests/PathRequest.js +4 -0
  42. package/src/resolveOptions.js +0 -2
  43. package/src/types.js +1 -1
  44. package/src/worker.js +7 -8
  45. package/_empty.js +0 -0
  46. package/lib/atlaspack-v3/worker/napi-worker.js +0 -3
  47. package/lib/internal-plugins.js +0 -9
  48. package/lib/isSuperPackage.js +0 -23
  49. package/src/internal-plugins.js +0 -4
  50. package/src/isSuperPackage.js +0 -28
  51. /package/src/atlaspack-v3/worker/{napi-worker.js → index.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,66 @@
1
1
  # @atlaspack/core
2
2
 
3
+ ## 2.18.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#652](https://github.com/atlassian-labs/atlaspack/pull/652) [`644b157`](https://github.com/atlassian-labs/atlaspack/commit/644b157dee72a871acc2d0facf0b87b8eea51956) Thanks [@yamadapc](https://github.com/yamadapc)! - Fix bugs related to build aborts. Builds and cache writes will no longer be aborted.
8
+
9
+ - Updated dependencies [[`644b157`](https://github.com/atlassian-labs/atlaspack/commit/644b157dee72a871acc2d0facf0b87b8eea51956)]:
10
+ - @atlaspack/feature-flags@2.18.2
11
+ - @atlaspack/cache@3.2.9
12
+ - @atlaspack/fs@2.15.9
13
+ - @atlaspack/graph@3.5.4
14
+ - @atlaspack/utils@2.15.2
15
+ - @atlaspack/package-manager@2.14.14
16
+ - @atlaspack/profiler@2.14.12
17
+ - @atlaspack/types@2.15.4
18
+ - @atlaspack/workers@2.14.14
19
+ - @atlaspack/plugin@2.14.14
20
+
21
+ ## 2.18.4
22
+
23
+ ### Patch Changes
24
+
25
+ - [#650](https://github.com/atlassian-labs/atlaspack/pull/650) [`ef3d622`](https://github.com/atlassian-labs/atlaspack/commit/ef3d6228f4e006702198a19c61e051d194d325cb) Thanks [@alshdavid](https://github.com/alshdavid)! - Remove package.json#exports
26
+
27
+ - [#646](https://github.com/atlassian-labs/atlaspack/pull/646) [`6b1f5ff`](https://github.com/atlassian-labs/atlaspack/commit/6b1f5fff68d7131fae075e14f4d2c02606dc6058) Thanks [@alshdavid](https://github.com/alshdavid)! - Export WORKER_PATH from @atlaspack/core
28
+
29
+ - [#633](https://github.com/atlassian-labs/atlaspack/pull/633) [`26aa9c5`](https://github.com/atlassian-labs/atlaspack/commit/26aa9c599d2be45ce1438a74c5fa22f39b9b554b) Thanks [@sbhuiyan-atlassian](https://github.com/sbhuiyan-atlassian)! - Ported various HMR changes from Parcel
30
+
31
+ - [#648](https://github.com/atlassian-labs/atlaspack/pull/648) [`c8f7df4`](https://github.com/atlassian-labs/atlaspack/commit/c8f7df4eadfc4718040fceb065dae6e96a4051e7) Thanks [@alshdavid](https://github.com/alshdavid)! - Export ATLASPACK_VERSION and other internals
32
+
33
+ - [#626](https://github.com/atlassian-labs/atlaspack/pull/626) [`0501255`](https://github.com/atlassian-labs/atlaspack/commit/05012550da35b05ce7d356a8cc29311e7f9afdca) Thanks [@yamadapc](https://github.com/yamadapc)! - Clean-up tsconfig invalidation improvements feature-flag
34
+
35
+ - Updated dependencies [[`ef3d622`](https://github.com/atlassian-labs/atlaspack/commit/ef3d6228f4e006702198a19c61e051d194d325cb), [`26aa9c5`](https://github.com/atlassian-labs/atlaspack/commit/26aa9c599d2be45ce1438a74c5fa22f39b9b554b), [`0501255`](https://github.com/atlassian-labs/atlaspack/commit/05012550da35b05ce7d356a8cc29311e7f9afdca)]:
36
+ - @atlaspack/workers@2.14.13
37
+ - @atlaspack/logger@2.14.11
38
+ - @atlaspack/feature-flags@2.18.1
39
+ - @atlaspack/fs@2.15.8
40
+ - @atlaspack/package-manager@2.14.13
41
+ - @atlaspack/types@2.15.3
42
+ - @atlaspack/cache@3.2.8
43
+ - @atlaspack/utils@2.15.1
44
+ - @atlaspack/graph@3.5.3
45
+ - @atlaspack/plugin@2.14.13
46
+ - @atlaspack/profiler@2.14.11
47
+
48
+ ## 2.18.3
49
+
50
+ ### Patch Changes
51
+
52
+ - Updated dependencies [[`10fbcfb`](https://github.com/atlassian-labs/atlaspack/commit/10fbcfbfa49c7a83da5d7c40983e36e87f524a75), [`85c52d3`](https://github.com/atlassian-labs/atlaspack/commit/85c52d3f7717b3c84a118d18ab98cfbfd71dcbd2), [`e39c6cf`](https://github.com/atlassian-labs/atlaspack/commit/e39c6cf05f7e95ce5420dbcea66f401b1cbd397c)]:
53
+ - @atlaspack/feature-flags@2.18.0
54
+ - @atlaspack/utils@2.15.0
55
+ - @atlaspack/cache@3.2.7
56
+ - @atlaspack/fs@2.15.7
57
+ - @atlaspack/graph@3.5.2
58
+ - @atlaspack/package-manager@2.14.12
59
+ - @atlaspack/workers@2.14.12
60
+ - @atlaspack/profiler@2.14.10
61
+ - @atlaspack/types@2.15.2
62
+ - @atlaspack/plugin@2.14.12
63
+
3
64
  ## 2.18.2
4
65
 
5
66
  ### Patch Changes
package/lib/AssetGraph.js CHANGED
@@ -443,6 +443,15 @@ class AssetGraph extends _graph().ContentGraph {
443
443
  ...depNode.value.meta,
444
444
  ...existing.value.resolverMeta
445
445
  };
446
+ if ((0, _featureFlags().getFeatureFlag)('hmrImprovements')) {
447
+ depNode.value.resolverMeta = existing.value.resolverMeta;
448
+ }
449
+ }
450
+ if ((0, _featureFlags().getFeatureFlag)('hmrImprovements')) {
451
+ if ((existing === null || existing === void 0 ? void 0 : existing.type) === 'dependency' && existing.value.resolverPriority != null) {
452
+ depNode.value.priority = existing.value.resolverPriority;
453
+ depNode.value.resolverPriority = existing.value.resolverPriority;
454
+ }
446
455
  }
447
456
  let dependentAsset = dependentAssets.find(a => a.uniqueKey === dep.specifier);
448
457
  if (dependentAsset) {
package/lib/Atlaspack.js CHANGED
@@ -126,7 +126,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
126
126
  (0, _registerCoreWithSerializer.registerCoreWithSerializer)();
127
127
  const INTERNAL_TRANSFORM = exports.INTERNAL_TRANSFORM = Symbol('internal_transform');
128
128
  const INTERNAL_RESOLVE = exports.INTERNAL_RESOLVE = Symbol('internal_resolve');
129
- const WORKER_PATH = exports.WORKER_PATH = _path().default.join( /*#__ATLASPACK_IGNORE__*/__dirname, 'worker.js');
129
+ const WORKER_PATH = exports.WORKER_PATH = _path().default.join(__dirname, 'worker.js');
130
130
  class Atlaspack {
131
131
  #requestTracker /*: RequestTracker*/;
132
132
  #config /*: AtlaspackConfig*/;
@@ -215,6 +215,7 @@ class Atlaspack {
215
215
  }
216
216
  rustAtlaspack = await _atlaspackV.AtlaspackV3.create({
217
217
  ...options,
218
+ corePath: _path().default.join(__dirname, '..'),
218
219
  threads,
219
220
  entries: Array.isArray(entries) ? entries : entries == null ? undefined : [entries],
220
221
  env: resolvedOptions.env,
@@ -509,7 +510,9 @@ class Atlaspack {
509
510
  if (this.rustAtlaspack) {
510
511
  nativeInvalid = await this.rustAtlaspack.respondToFsEvents(events);
511
512
  }
512
- let isInvalid = await this.#requestTracker.respondToFSEvents(events, Number.POSITIVE_INFINITY);
513
+ let {
514
+ didInvalidate: isInvalid
515
+ } = await this.#requestTracker.respondToFSEvents(events, Number.POSITIVE_INFINITY);
513
516
  if ((nativeInvalid || isInvalid) && this.#watchQueue.getNumWaiting() === 0) {
514
517
  if (this.#watchAbortController) {
515
518
  this.#watchAbortController.abort();
@@ -14,7 +14,13 @@ exports.validatePackageName = validatePackageName;
14
14
  // * We do not care about package names
15
15
  // * Validation makes interop between parcel/atlaspack confusing.
16
16
  //
17
- function validatePackageName() {}
17
+ function validatePackageName(
18
+ // eslint-disable-next-line no-unused-vars
19
+ pkg,
20
+ // eslint-disable-next-line no-unused-vars
21
+ pluginType,
22
+ // eslint-disable-next-line no-unused-vars
23
+ key) {}
18
24
  const validatePluginName = (pluginType, key) => {
19
25
  return val => {
20
26
  // allow plugin spread...
@@ -833,10 +833,7 @@ class BundleGraph {
833
833
  // If this asset is referenced by any async dependency, it's referenced.
834
834
  return true;
835
835
  }
836
- let dependencies = this._graph.getNodeIdsConnectedTo(assetNodeId,
837
- // TODO: This seems like bug with library builds when assets are present
838
- // in other files. Guarding the fix for now exclusively for super builds
839
- process.env.ATLASPACK_SUPER_BUILD === 'true' ? _graph().ALL_EDGE_TYPES : undefined).map(id => (0, _nullthrows().default)(this._graph.getNode(id))).filter(node => node.type === 'dependency').map(node => {
836
+ let dependencies = this._graph.getNodeIdsConnectedTo(assetNodeId).map(id => (0, _nullthrows().default)(this._graph.getNode(id))).filter(node => node.type === 'dependency').map(node => {
840
837
  (0, _assert().default)(node.type === 'dependency');
841
838
  return node.value;
842
839
  });
@@ -870,6 +867,7 @@ class BundleGraph {
870
867
  if (bundleHasReference(descendant)) {
871
868
  isReferenced = true;
872
869
  actions.stop();
870
+ return;
873
871
  }
874
872
  }, referencer);
875
873
  return isReferenced;
@@ -928,6 +926,7 @@ class BundleGraph {
928
926
  let childBundles = this.getBundlesInBundleGroup(node.value);
929
927
  if (childBundles.some(b => b.id !== bundle.id && b.bundleBehavior !== _types.BundleBehavior.isolated && b.bundleBehavior !== _types.BundleBehavior.inline && this.bundleHasAsset(b, asset))) {
930
928
  actions.skipChildren();
929
+ return;
931
930
  }
932
931
  }
933
932
  }, [bundleGraphEdgeTypes.references, bundleGraphEdgeTypes.bundle]);
@@ -413,13 +413,10 @@ class PackagerRunner {
413
413
  inlineSources = this.options.mode === 'production';
414
414
  }
415
415
  }
416
- if (process.env.ATLASPACK_SUPER_BUILD === 'true') {
417
- // Set source root to 'atlaspack' so stack traces are clean in Sentry
418
- sourceRoot = 'atlaspack';
419
- }
416
+ let mapFilename = fullPath + '.map';
420
417
  let isInlineMap = bundleEnv.sourceMap && bundleEnv.sourceMap.inline;
421
418
  let stringified = await map.stringify({
422
- file: _path().default.basename(fullPath + '.map'),
419
+ file: _path().default.basename(mapFilename),
423
420
  // $FlowFixMe
424
421
  fs: this.options.inputFS,
425
422
  rootDir: this.options.projectRoot,
@@ -703,8 +703,7 @@ class RequestGraph extends _graph().ContentGraph {
703
703
  //
704
704
  // Currently create events can invalidate a large number of nodes due to
705
705
  // "create above" invalidations.
706
- const isConfigKeyChange = (0, _featureFlags().getFeatureFlag)('granularTsConfigInvalidation') || type === 'delete' || type === 'update';
707
- if (configKeyNodes && isConfigKeyChange) {
706
+ if (configKeyNodes) {
708
707
  for (let nodeId of configKeyNodes) {
709
708
  let isInvalid = type === 'delete';
710
709
  if (type !== 'delete') {
@@ -723,7 +722,8 @@ class RequestGraph extends _graph().ContentGraph {
723
722
  }
724
723
  }
725
724
  const invalidationsAfter = this.getInvalidNodeCount();
726
- invalidationsByPath.set(_path, (invalidationsByPath.get(_path) ?? 0) + (invalidationsAfter - invalidationsBefore));
725
+ const invalidationsForEvent = invalidationsAfter - invalidationsBefore;
726
+ invalidationsByPath.set(_path, (invalidationsByPath.get(_path) ?? 0) + invalidationsForEvent);
727
727
  }
728
728
  if ((0, _featureFlags().getFeatureFlag)('fixQuadraticCacheInvalidation')) {
729
729
  cleanUpOrphans(this);
@@ -780,6 +780,9 @@ class RequestTracker {
780
780
 
781
781
  // TODO: refactor (abortcontroller should be created by RequestTracker)
782
782
  setSignal(signal) {
783
+ if ((0, _featureFlags().getFeatureFlag)('fixBuildAbortCorruption')) {
784
+ return;
785
+ }
783
786
  this.signal = signal;
784
787
  }
785
788
  startRequest(request) {
@@ -920,7 +923,9 @@ class RequestTracker {
920
923
  options: this.options,
921
924
  rustAtlaspack: this.rustAtlaspack
922
925
  });
923
- (0, _utils2.assertSignalNotAborted)(this.signal);
926
+ if (!(0, _featureFlags().getFeatureFlag)('fixBuildAbortCorruption')) {
927
+ (0, _utils2.assertSignalNotAborted)(this.signal);
928
+ }
924
929
  this.completeRequest(requestNodeId);
925
930
  deferred.resolve(true);
926
931
  return result;
@@ -958,40 +963,41 @@ class RequestTracker {
958
963
  }
959
964
  createAPI(requestId, previousInvalidations) {
960
965
  let subRequestContentKeys = new Set();
961
- return {
962
- api: {
963
- invalidateOnFileCreate: input => this.graph.invalidateOnFileCreate(requestId, input),
964
- invalidateOnConfigKeyChange: (filePath, configKey, contentHash) => this.graph.invalidateOnConfigKeyChange(requestId, filePath, configKey, contentHash),
965
- invalidateOnFileDelete: filePath => this.graph.invalidateOnFileDelete(requestId, filePath),
966
- invalidateOnFileUpdate: filePath => this.graph.invalidateOnFileUpdate(requestId, filePath),
967
- invalidateOnStartup: () => this.graph.invalidateOnStartup(requestId),
968
- invalidateOnBuild: () => this.graph.invalidateOnBuild(requestId),
969
- invalidateOnEnvChange: env => this.graph.invalidateOnEnvChange(requestId, env, this.options.env[env]),
970
- invalidateOnOptionChange: option => this.graph.invalidateOnOptionChange(requestId, option, this.options[option]),
971
- getInvalidations: () => previousInvalidations,
972
- storeResult: (result, cacheKey) => {
973
- this.storeResult(requestId, result, cacheKey);
974
- },
975
- getSubRequests: () => this.graph.getSubRequests(requestId),
976
- getInvalidSubRequests: () => this.graph.getInvalidSubRequests(requestId),
977
- getPreviousResult: ifMatch => {
978
- var _this$graph$getNode;
979
- let contentKey = (0, _nullthrows().default)((_this$graph$getNode = this.graph.getNode(requestId)) === null || _this$graph$getNode === void 0 ? void 0 : _this$graph$getNode.id);
980
- return this.getRequestResult(contentKey, ifMatch);
981
- },
982
- getRequestResult: id => this.getRequestResult(id),
983
- canSkipSubrequest: contentKey => {
984
- if (this.graph.hasContentKey(contentKey) && this.hasValidResult(this.graph.getNodeIdByContentKey(contentKey))) {
985
- subRequestContentKeys.add(contentKey);
986
- return true;
987
- }
988
- return false;
989
- },
990
- runRequest: (subRequest, opts) => {
991
- subRequestContentKeys.add(subRequest.id);
992
- return this.runRequest(subRequest, opts);
966
+ let api = {
967
+ invalidateOnFileCreate: input => this.graph.invalidateOnFileCreate(requestId, input),
968
+ invalidateOnConfigKeyChange: (filePath, configKey, contentHash) => this.graph.invalidateOnConfigKeyChange(requestId, filePath, configKey, contentHash),
969
+ invalidateOnFileDelete: filePath => this.graph.invalidateOnFileDelete(requestId, filePath),
970
+ invalidateOnFileUpdate: filePath => this.graph.invalidateOnFileUpdate(requestId, filePath),
971
+ invalidateOnStartup: () => this.graph.invalidateOnStartup(requestId),
972
+ invalidateOnBuild: () => this.graph.invalidateOnBuild(requestId),
973
+ invalidateOnEnvChange: env => this.graph.invalidateOnEnvChange(requestId, env, this.options.env[env]),
974
+ invalidateOnOptionChange: option => this.graph.invalidateOnOptionChange(requestId, option, this.options[option]),
975
+ getInvalidations: () => previousInvalidations,
976
+ storeResult: (result, cacheKey) => {
977
+ this.storeResult(requestId, result, cacheKey);
978
+ },
979
+ getSubRequests: () => this.graph.getSubRequests(requestId),
980
+ getInvalidSubRequests: () => this.graph.getInvalidSubRequests(requestId),
981
+ getPreviousResult: ifMatch => {
982
+ var _this$graph$getNode;
983
+ let contentKey = (0, _nullthrows().default)((_this$graph$getNode = this.graph.getNode(requestId)) === null || _this$graph$getNode === void 0 ? void 0 : _this$graph$getNode.id);
984
+ return this.getRequestResult(contentKey, ifMatch);
985
+ },
986
+ getRequestResult: id => this.getRequestResult(id),
987
+ canSkipSubrequest: contentKey => {
988
+ if (this.graph.hasContentKey(contentKey) && this.hasValidResult(this.graph.getNodeIdByContentKey(contentKey))) {
989
+ subRequestContentKeys.add(contentKey);
990
+ return true;
993
991
  }
992
+ return false;
994
993
  },
994
+ runRequest: (subRequest, opts) => {
995
+ subRequestContentKeys.add(subRequest.id);
996
+ return this.runRequest(subRequest, opts);
997
+ }
998
+ };
999
+ return {
1000
+ api,
995
1001
  subRequestContentKeys
996
1002
  };
997
1003
  }
@@ -1143,7 +1149,8 @@ function getWatcherOptions({
1143
1149
  watchDir,
1144
1150
  watchBackend
1145
1151
  }) {
1146
- const uniqueDirs = [...new Set([...watchIgnore, ...['.git', '.hg'], cacheDir])];
1152
+ const vcsDirs = ['.git', '.hg'];
1153
+ const uniqueDirs = [...new Set([...watchIgnore, ...vcsDirs, cacheDir])];
1147
1154
  const ignore = uniqueDirs.map(dir => _path2().default.resolve(watchDir, dir));
1148
1155
  return {
1149
1156
  ignore,
@@ -1337,13 +1344,15 @@ async function invalidateRequestGraph(requestGraph, options, events) {
1337
1344
  const invalidatedCount = invalidations.reduce((acc, invalidation) => acc + invalidation.count, 0);
1338
1345
  const requestCount = requestGraph.nodes.reduce((acc, node) => acc + ((node === null || node === void 0 ? void 0 : node.type) === REQUEST ? 1 : 0), 0);
1339
1346
  const nodeCount = requestGraph.nodes.length;
1347
+ const nodeInvalidationRatio = invalidatedCount / nodeCount;
1348
+ const requestInvalidationRatio = invalidatedCount / requestCount;
1340
1349
  return {
1341
1350
  invalidations,
1342
1351
  nodeCount,
1343
1352
  requestCount,
1344
1353
  invalidatedCount,
1345
- nodeInvalidationRatio: invalidatedCount / nodeCount,
1346
- requestInvalidationRatio: invalidatedCount / requestCount
1354
+ nodeInvalidationRatio,
1355
+ requestInvalidationRatio
1347
1356
  };
1348
1357
  }
1349
1358
  /**
@@ -173,12 +173,12 @@ class Transformation {
173
173
  });
174
174
 
175
175
  // Prefer `isSource` originating from the AssetRequest.
176
-
176
+ let isSource = isSourceOverride ?? summarizedIsSource;
177
177
  return new _UncommittedAsset.default({
178
178
  value: (0, _assetUtils.createAsset)(this.options.projectRoot, {
179
179
  code,
180
180
  filePath,
181
- isSource: isSourceOverride ?? summarizedIsSource,
181
+ isSource,
182
182
  type: _path().default.extname((0, _projectPath.fromProjectPathRelative)(filePath)).slice(1),
183
183
  pipeline,
184
184
  env,
@@ -19,46 +19,7 @@ function _diagnostic() {
19
19
  };
20
20
  return data;
21
21
  }
22
- var _isSuperPackage = require("../isSuperPackage");
23
- function _path() {
24
- const data = _interopRequireDefault(require("path"));
25
- _path = function () {
26
- return data;
27
- };
28
- return data;
29
- }
30
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
- function getJsPaths() {
32
- const dirname = /*#__ATLASPACK_IGNORE__*/__dirname;
33
- if ((0, _isSuperPackage.isSuperPackage)()) {
34
- // dirname: atlaspack/lib/core/core/atlaspack-v3
35
- // core: atlaspack/lib/core/core/index.js
36
- const corePath = _path().default.join(dirname, '..');
37
- // esmodule helpers: atlaspack/lib/transformers/js/esmodule-helpers.js
38
- const esmoduleHelpersPath = _path().default.join(dirname, '../../../transformers/js/esmodule-helpers.js');
39
-
40
- // empty file: atlaspack/lib/core/core/_empty.js
41
- const emptyFile = _path().default.join(dirname, '_empty.js');
42
- return {
43
- corePath,
44
- esmoduleHelpersSpecifier: _path().default.relative(corePath, esmoduleHelpersPath),
45
- esmoduleHelpersIncludeNodeModules: 'atlaspack',
46
- emptyFile
47
- };
48
- }
49
-
50
- // dirname: @atlaspack/core/lib/atlaspack-v3
51
- // core: @atlaspack/core
52
- const corePath = _path().default.join(dirname, '../..');
53
- // empty file: atlaspack/lib/core/core/_empty.js
54
- const emptyFile = _path().default.join(dirname, '_empty.js');
55
- return {
56
- corePath,
57
- esmoduleHelpersSpecifier: '@atlaspack/transformer-js/src/esmodule-helpers.js',
58
- esmoduleHelpersIncludeNodeModules: '@atlaspack/transformer-js',
59
- emptyFile
60
- };
61
- }
62
23
  class AtlaspackV3 {
63
24
  constructor(atlaspack_napi) {
64
25
  this._atlaspack_napi = atlaspack_napi;
@@ -79,11 +40,7 @@ class AtlaspackV3 {
79
40
  fs,
80
41
  packageManager,
81
42
  threads,
82
- options: {
83
- ...options,
84
- jsPaths: getJsPaths(),
85
- useBuiltinConfigs: (0, _isSuperPackage.isSuperPackage)()
86
- },
43
+ options,
87
44
  napiWorkerPool
88
45
  }, lmdb);
89
46
  if (error !== null) {
@@ -33,7 +33,7 @@ function _rust() {
33
33
  return data;
34
34
  }
35
35
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
36
- const WORKER_PATH = _path().default.join( /*#__ATLASPACK_IGNORE__*/__dirname, 'worker', 'napi-worker.js');
36
+ const WORKER_PATH = _path().default.join(__dirname, 'worker', 'index.js');
37
37
  const ATLASPACK_NAPI_WORKERS = _process().default.env.ATLASPACK_NAPI_WORKERS && parseInt(_process().default.env.ATLASPACK_NAPI_WORKERS, 10);
38
38
  class NapiWorkerPool {
39
39
  #workers;
@@ -44,13 +44,13 @@ class Environment {
44
44
 
45
45
  // TODO
46
46
  // eslint-disable-next-line no-unused-vars
47
- matchesEngines() {
47
+ matchesEngines(minVersions, defaultValue) {
48
48
  return true;
49
49
  }
50
50
 
51
51
  // TODO
52
52
  // eslint-disable-next-line no-unused-vars
53
- supports() {
53
+ supports(feature, defaultValue) {
54
54
  return true;
55
55
  }
56
56
  }
@@ -126,32 +126,32 @@ class MutableAsset {
126
126
  }
127
127
 
128
128
  // eslint-disable-next-line no-unused-vars
129
- addDependency() {
129
+ addDependency(options) {
130
130
  throw new Error('MutableAsset.addDependency()');
131
131
  }
132
132
 
133
133
  // eslint-disable-next-line no-unused-vars
134
- addURLDependency() {
134
+ addURLDependency(url, opts) {
135
135
  throw new Error('MutableAsset.addURLDependency()');
136
136
  }
137
137
 
138
138
  // eslint-disable-next-line no-unused-vars
139
- setEnvironment() {
139
+ setEnvironment(opts) {
140
140
  throw new Error('MutableAsset.setEnvironment()');
141
141
  }
142
142
 
143
143
  // eslint-disable-next-line no-unused-vars
144
- invalidateOnFileChange() {
144
+ invalidateOnFileChange(invalidation) {
145
145
  // TODO: Forward invalidations to Rust
146
146
  }
147
147
 
148
148
  // eslint-disable-next-line no-unused-vars
149
- invalidateOnFileCreate() {
149
+ invalidateOnFileCreate(invalidation) {
150
150
  // TODO: Forward invalidations to Rust
151
151
  }
152
152
 
153
153
  // eslint-disable-next-line no-unused-vars
154
- invalidateOnEnvChange() {
154
+ invalidateOnEnvChange(invalidation) {
155
155
  // TODO: Forward invalidations to Rust
156
156
  }
157
157
  invalidateOnStartup() {
@@ -40,21 +40,21 @@ class PluginConfig {
40
40
  }
41
41
 
42
42
  // eslint-disable-next-line no-unused-vars
43
- invalidateOnFileChange() {}
43
+ invalidateOnFileChange(filePath) {}
44
44
 
45
45
  // eslint-disable-next-line no-unused-vars
46
- invalidateOnFileCreate() {}
46
+ invalidateOnFileCreate(invalidations) {}
47
47
 
48
48
  // eslint-disable-next-line no-unused-vars
49
- invalidateOnEnvChange() {}
49
+ invalidateOnEnvChange(invalidation) {}
50
50
  invalidateOnStartup() {}
51
51
  invalidateOnBuild() {}
52
52
 
53
53
  // eslint-disable-next-line no-unused-vars
54
- addDevDependency() {}
54
+ addDevDependency(options) {}
55
55
 
56
56
  // eslint-disable-next-line no-unused-vars
57
- setCacheKey() {}
57
+ setCacheKey(key) {}
58
58
  getConfig(
59
59
  // eslint-disable-next-line no-unused-vars
60
60
  filePaths,
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ if (process.env.ATLASPACK_BUILD_ENV !== 'production' || process.env.ATLASPACK_SELF_BUILD) {
4
+ require('@atlaspack/babel-register');
5
+ }
6
+ require('./worker');
@@ -48,7 +48,6 @@ function _module() {
48
48
  }
49
49
  var _jsCallable = require("../jsCallable");
50
50
  var _compat = require("./compat");
51
- var _internalPlugins = _interopRequireDefault(require("../../internal-plugins"));
52
51
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
53
52
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
54
53
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -67,16 +66,10 @@ class AtlaspackWorker {
67
66
  specifier,
68
67
  resolveFrom
69
68
  }) => {
70
- let resolvedModule;
71
- if (_internalPlugins.default && _internalPlugins.default[specifier]) {
72
- // If the plugin is available inside the package then use it
73
- resolvedModule = _internalPlugins.default[specifier]();
74
- } else {
75
- let customRequire = _module().createRequire(resolveFrom);
76
- let resolvedPath = customRequire.resolve(specifier);
77
- // $FlowFixMe
78
- resolvedModule = await import(resolvedPath);
79
- }
69
+ let customRequire = _module().createRequire(resolveFrom);
70
+ let resolvedPath = customRequire.resolve(specifier);
71
+ // $FlowFixMe
72
+ let resolvedModule = await import(resolvedPath);
80
73
  let instance = undefined;
81
74
  if (resolvedModule.default && resolvedModule.default[CONFIG]) {
82
75
  instance = resolvedModule.default[CONFIG];
@@ -47,7 +47,7 @@ const TYPE_COLORS = {
47
47
  };
48
48
  async function dumpGraphToGraphViz(graph, name, edgeTypes) {
49
49
  var _globalThis$ATLASPACK;
50
- if ("production" === 'production' && !process.env.ATLASPACK_BUILD_REPL) {
50
+ if (process.env.ATLASPACK_BUILD_ENV === 'production' && !process.env.ATLASPACK_BUILD_REPL) {
51
51
  return;
52
52
  }
53
53
  let mode = process.env.ATLASPACK_BUILD_REPL ? // $FlowFixMe
package/lib/index.js CHANGED
@@ -4,14 +4,23 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  var _exportNames = {
7
+ EnvironmentManager: true,
7
8
  Atlaspack: true,
8
9
  Parcel: true,
9
10
  BuildError: true,
10
11
  createWorkerFarm: true,
11
12
  INTERNAL_RESOLVE: true,
12
13
  INTERNAL_TRANSFORM: true,
13
- isSuperPackage: true
14
+ WORKER_PATH: true,
15
+ ATLASPACK_VERSION: true,
16
+ resolveOptions: true
14
17
  };
18
+ Object.defineProperty(exports, "ATLASPACK_VERSION", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _constants.ATLASPACK_VERSION;
22
+ }
23
+ });
15
24
  Object.defineProperty(exports, "Atlaspack", {
16
25
  enumerable: true,
17
26
  get: function () {
@@ -24,6 +33,7 @@ Object.defineProperty(exports, "BuildError", {
24
33
  return _Atlaspack.BuildError;
25
34
  }
26
35
  });
36
+ exports.EnvironmentManager = void 0;
27
37
  Object.defineProperty(exports, "INTERNAL_RESOLVE", {
28
38
  enumerable: true,
29
39
  get: function () {
@@ -42,6 +52,12 @@ Object.defineProperty(exports, "Parcel", {
42
52
  return _Atlaspack.default;
43
53
  }
44
54
  });
55
+ Object.defineProperty(exports, "WORKER_PATH", {
56
+ enumerable: true,
57
+ get: function () {
58
+ return _Atlaspack.WORKER_PATH;
59
+ }
60
+ });
45
61
  Object.defineProperty(exports, "createWorkerFarm", {
46
62
  enumerable: true,
47
63
  get: function () {
@@ -54,14 +70,17 @@ Object.defineProperty(exports, "default", {
54
70
  return _Atlaspack.default;
55
71
  }
56
72
  });
57
- Object.defineProperty(exports, "isSuperPackage", {
73
+ Object.defineProperty(exports, "resolveOptions", {
58
74
  enumerable: true,
59
75
  get: function () {
60
- return _isSuperPackage.isSuperPackage;
76
+ return _resolveOptions.default;
61
77
  }
62
78
  });
79
+ var EnvironmentManager = _interopRequireWildcard(require("./EnvironmentManager"));
80
+ exports.EnvironmentManager = EnvironmentManager;
63
81
  var _Atlaspack = _interopRequireWildcard(require("./Atlaspack"));
64
- var _isSuperPackage = require("./isSuperPackage");
82
+ var _constants = require("./constants");
83
+ var _resolveOptions = _interopRequireDefault(require("./resolveOptions"));
65
84
  var _atlaspackV = require("./atlaspack-v3");
66
85
  Object.keys(_atlaspackV).forEach(function (key) {
67
86
  if (key === "default" || key === "__esModule") return;
@@ -74,5 +93,6 @@ Object.keys(_atlaspackV).forEach(function (key) {
74
93
  }
75
94
  });
76
95
  });
96
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
77
97
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
78
98
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -25,8 +25,6 @@ function _diagnostic() {
25
25
  };
26
26
  return data;
27
27
  }
28
- var _package = require("../package.json");
29
- var _internalPlugins = _interopRequireDefault(require("./internal-plugins"));
30
28
  function _utils() {
31
29
  const data = require("@atlaspack/utils");
32
30
  _utils = function () {
@@ -41,19 +39,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
41
39
  const NODE_MODULES = `${_path().default.sep}node_modules${_path().default.sep}`;
42
40
  const CONFIG = Symbol.for('parcel-plugin-config');
43
41
  async function loadPlugin(pluginName, configPath, keyPath, options) {
44
- if (_internalPlugins.default && _internalPlugins.default[pluginName]) {
45
- let plugin = _internalPlugins.default[pluginName]();
46
- plugin = plugin.default || plugin;
47
- plugin = plugin[CONFIG];
48
- if (!plugin) {
49
- throw new Error(`Plugin ${pluginName} is not a valid Atlaspack plugin, should export an instance of a Atlaspack plugin ex. "export default new Reporter({ ... })".`);
50
- }
51
- return {
52
- plugin,
53
- version: _package.version,
54
- resolveFrom: (0, _projectPath.toProjectPathUnsafe)(options.projectRoot)
55
- };
56
- }
57
42
  let resolveFrom = configPath;
58
43
 
59
44
  // Config packages can reference plugins, but cannot contain other plugins within them.