@atlaspack/core 2.18.6-alshdevreleasescript.0 → 2.18.6-alshintegrationtestslib.0

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.
@@ -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...
@@ -867,6 +867,7 @@ class BundleGraph {
867
867
  if (bundleHasReference(descendant)) {
868
868
  isReferenced = true;
869
869
  actions.stop();
870
+ return;
870
871
  }
871
872
  }, referencer);
872
873
  return isReferenced;
@@ -925,6 +926,7 @@ class BundleGraph {
925
926
  let childBundles = this.getBundlesInBundleGroup(node.value);
926
927
  if (childBundles.some(b => b.id !== bundle.id && b.bundleBehavior !== _types.BundleBehavior.isolated && b.bundleBehavior !== _types.BundleBehavior.inline && this.bundleHasAsset(b, asset))) {
927
928
  actions.skipChildren();
929
+ return;
928
930
  }
929
931
  }
930
932
  }, [bundleGraphEdgeTypes.references, bundleGraphEdgeTypes.bundle]);
@@ -413,9 +413,10 @@ class PackagerRunner {
413
413
  inlineSources = this.options.mode === 'production';
414
414
  }
415
415
  }
416
+ let mapFilename = fullPath + '.map';
416
417
  let isInlineMap = bundleEnv.sourceMap && bundleEnv.sourceMap.inline;
417
418
  let stringified = await map.stringify({
418
- file: _path().default.basename(fullPath + '.map'),
419
+ file: _path().default.basename(mapFilename),
419
420
  // $FlowFixMe
420
421
  fs: this.options.inputFS,
421
422
  rootDir: this.options.projectRoot,
@@ -722,7 +722,8 @@ class RequestGraph extends _graph().ContentGraph {
722
722
  }
723
723
  }
724
724
  const invalidationsAfter = this.getInvalidNodeCount();
725
- invalidationsByPath.set(_path, (invalidationsByPath.get(_path) ?? 0) + (invalidationsAfter - invalidationsBefore));
725
+ const invalidationsForEvent = invalidationsAfter - invalidationsBefore;
726
+ invalidationsByPath.set(_path, (invalidationsByPath.get(_path) ?? 0) + invalidationsForEvent);
726
727
  }
727
728
  if ((0, _featureFlags().getFeatureFlag)('fixQuadraticCacheInvalidation')) {
728
729
  cleanUpOrphans(this);
@@ -962,40 +963,41 @@ class RequestTracker {
962
963
  }
963
964
  createAPI(requestId, previousInvalidations) {
964
965
  let subRequestContentKeys = new Set();
965
- return {
966
- 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;
991
- }
992
- return false;
993
- },
994
- runRequest: (subRequest, opts) => {
995
- subRequestContentKeys.add(subRequest.id);
996
- 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;
997
991
  }
992
+ return false;
998
993
  },
994
+ runRequest: (subRequest, opts) => {
995
+ subRequestContentKeys.add(subRequest.id);
996
+ return this.runRequest(subRequest, opts);
997
+ }
998
+ };
999
+ return {
1000
+ api,
999
1001
  subRequestContentKeys
1000
1002
  };
1001
1003
  }
@@ -1147,7 +1149,8 @@ function getWatcherOptions({
1147
1149
  watchDir,
1148
1150
  watchBackend
1149
1151
  }) {
1150
- const uniqueDirs = [...new Set([...watchIgnore, ...['.git', '.hg'], cacheDir])];
1152
+ const vcsDirs = ['.git', '.hg'];
1153
+ const uniqueDirs = [...new Set([...watchIgnore, ...vcsDirs, cacheDir])];
1151
1154
  const ignore = uniqueDirs.map(dir => _path2().default.resolve(watchDir, dir));
1152
1155
  return {
1153
1156
  ignore,
@@ -1341,13 +1344,15 @@ async function invalidateRequestGraph(requestGraph, options, events) {
1341
1344
  const invalidatedCount = invalidations.reduce((acc, invalidation) => acc + invalidation.count, 0);
1342
1345
  const requestCount = requestGraph.nodes.reduce((acc, node) => acc + ((node === null || node === void 0 ? void 0 : node.type) === REQUEST ? 1 : 0), 0);
1343
1346
  const nodeCount = requestGraph.nodes.length;
1347
+ const nodeInvalidationRatio = invalidatedCount / nodeCount;
1348
+ const requestInvalidationRatio = invalidatedCount / requestCount;
1344
1349
  return {
1345
1350
  invalidations,
1346
1351
  nodeCount,
1347
1352
  requestCount,
1348
1353
  invalidatedCount,
1349
- nodeInvalidationRatio: invalidatedCount / nodeCount,
1350
- requestInvalidationRatio: invalidatedCount / requestCount
1354
+ nodeInvalidationRatio,
1355
+ requestInvalidationRatio
1351
1356
  };
1352
1357
  }
1353
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,
@@ -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,
@@ -1,3 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ if (process.env.ATLASPACK_DEV === 'true' || process.env.ATLASPACK_BUILD_ENV === 'test' || process.env.ATLASPACK_SELF_BUILD) {
4
+ require('@atlaspack/babel-register');
5
+ }
3
6
  require('./worker');
@@ -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
@@ -96,7 +96,7 @@ async function createDevDependency(opts, requestDevDeps, options) {
96
96
  return devDepRequest;
97
97
  }
98
98
  async function getDevDepRequests(api) {
99
- const previousDevDepRequests = await async function getPreviousDevDepRequests() {
99
+ async function getPreviousDevDepRequests() {
100
100
  if ((0, _featureFlags().getFeatureFlag)('fixBuildAbortCorruption')) {
101
101
  const allDevDepRequests = await Promise.all(api.getSubRequests().filter(req => req.requestType === _RequestTracker.requestTypes.dev_dep_request).map(async req => [req.id, await api.getRequestResult(req.id)]));
102
102
  const nonNullDevDepRequests = [];
@@ -109,7 +109,8 @@ async function getDevDepRequests(api) {
109
109
  } else {
110
110
  return new Map(await Promise.all(api.getSubRequests().filter(req => req.requestType === _RequestTracker.requestTypes.dev_dep_request).map(async req => [req.id, (0, _nullthrows().default)(await api.getRequestResult(req.id))])));
111
111
  }
112
- }();
112
+ }
113
+ const previousDevDepRequests = await getPreviousDevDepRequests();
113
114
  return {
114
115
  devDeps: new Map([...previousDevDepRequests.entries()].filter(([id]) => api.canSkipSubrequest(id)).map(([, req]) => [`${req.specifier}:${(0, _projectPath.fromProjectPathRelative)(req.resolveFrom)}`, req.hash])),
115
116
  invalidDevDeps: await Promise.all([...previousDevDepRequests.entries()].filter(([id]) => !api.canSkipSubrequest(id)).flatMap(([, req]) => {
@@ -139,7 +139,7 @@ async function resolveOptions(initialOptions) {
139
139
  // where symlinked dependencies outside the project root need to trigger HMR
140
140
  // updates. Default to the project root if not provided.
141
141
  let watchDir = initialOptions.watchDir != null ? _path().default.resolve(initialOptions.watchDir) : projectRoot;
142
- let cache = function createCache() {
142
+ function createCache() {
143
143
  if (initialOptions.cache) {
144
144
  return initialOptions.cache;
145
145
  }
@@ -150,7 +150,8 @@ async function resolveOptions(initialOptions) {
150
150
  }
151
151
  }
152
152
  return new (_cache().LMDBLiteCache)(cacheDir);
153
- }();
153
+ }
154
+ let cache = createCache();
154
155
  let mode = initialOptions.mode ?? 'development';
155
156
  let shouldOptimize = (initialOptions === null || initialOptions === void 0 || (_initialOptions$defau = initialOptions.defaultTargetOptions) === null || _initialOptions$defau === void 0 ? void 0 : _initialOptions$defau.shouldOptimize) ?? mode === 'production';
156
157
  let publicUrl = (initialOptions === null || initialOptions === void 0 || (_initialOptions$defau2 = initialOptions.defaultTargetOptions) === null || _initialOptions$defau2 === void 0 ? void 0 : _initialOptions$defau2.publicUrl) ?? '/';
package/lib/worker.js CHANGED
@@ -172,7 +172,24 @@ async function childInit() {
172
172
  await (_rust().init === null || _rust().init === void 0 ? void 0 : (0, _rust().init)());
173
173
  }
174
174
  const PKG_RE = /node_modules[/\\]((?:@[^/\\]+[/\\][^/\\]+)|[^/\\]+)(?!.*[/\\]node_modules[/\\])/;
175
- function invalidateRequireCache() {
175
+ function invalidateRequireCache(workerApi, file) {
176
+ if (process.env.ATLASPACK_BUILD_ENV === 'test') {
177
+ // Delete this module and all children in the same node_modules folder
178
+ let module = require.cache[file];
179
+ if (module) {
180
+ var _file$match;
181
+ delete require.cache[file];
182
+ let pkg = (_file$match = file.match(PKG_RE)) === null || _file$match === void 0 ? void 0 : _file$match[1];
183
+ for (let child of module.children) {
184
+ var _child$id$match;
185
+ if (pkg === ((_child$id$match = child.id.match(PKG_RE)) === null || _child$id$match === void 0 ? void 0 : _child$id$match[1])) {
186
+ invalidateRequireCache(workerApi, child.id);
187
+ }
188
+ }
189
+ }
190
+ atlaspackConfigCache.clear();
191
+ return;
192
+ }
176
193
  throw new Error('invalidateRequireCache is only for tests');
177
194
  }
178
195
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/core",
3
- "version": "2.18.6-alshdevreleasescript.0",
3
+ "version": "2.18.6-alshintegrationtestslib.0",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -21,21 +21,21 @@
21
21
  "check-ts": "tsc --noEmit index.d.ts"
22
22
  },
23
23
  "dependencies": {
24
- "@atlaspack/build-cache": "2.13.4-alshdevreleasescript.0",
25
- "@atlaspack/cache": "3.2.10-alshdevreleasescript.0",
26
- "@atlaspack/diagnostic": "2.14.2-alshdevreleasescript.0",
27
- "@atlaspack/events": "2.14.2-alshdevreleasescript.0",
28
- "@atlaspack/feature-flags": "2.18.3-alshdevreleasescript.0",
29
- "@atlaspack/fs": "2.15.10-alshdevreleasescript.0",
30
- "@atlaspack/graph": "3.5.5-alshdevreleasescript.0",
31
- "@atlaspack/logger": "2.14.12-alshdevreleasescript.0",
32
- "@atlaspack/package-manager": "2.14.15-alshdevreleasescript.0",
33
- "@atlaspack/plugin": "2.14.15-alshdevreleasescript.0",
34
- "@atlaspack/profiler": "2.14.13-alshdevreleasescript.0",
35
- "@atlaspack/rust": "3.3.6-alshdevreleasescript.0",
36
- "@atlaspack/types": "2.15.5-alshdevreleasescript.0",
37
- "@atlaspack/utils": "2.15.3-alshdevreleasescript.0",
38
- "@atlaspack/workers": "2.14.15-alshdevreleasescript.0",
24
+ "@atlaspack/build-cache": "2.13.4-alshintegrationtestslib.0",
25
+ "@atlaspack/cache": "3.2.10-alshintegrationtestslib.0",
26
+ "@atlaspack/diagnostic": "2.14.2-alshintegrationtestslib.0",
27
+ "@atlaspack/events": "2.14.2-alshintegrationtestslib.0",
28
+ "@atlaspack/feature-flags": "2.18.3-alshintegrationtestslib.0",
29
+ "@atlaspack/fs": "2.15.10-alshintegrationtestslib.0",
30
+ "@atlaspack/graph": "3.5.5-alshintegrationtestslib.0",
31
+ "@atlaspack/logger": "2.14.12-alshintegrationtestslib.0",
32
+ "@atlaspack/package-manager": "2.14.15-alshintegrationtestslib.0",
33
+ "@atlaspack/plugin": "2.14.15-alshintegrationtestslib.0",
34
+ "@atlaspack/profiler": "2.14.13-alshintegrationtestslib.0",
35
+ "@atlaspack/rust": "3.3.6-alshintegrationtestslib.0",
36
+ "@atlaspack/types": "2.15.5-alshintegrationtestslib.0",
37
+ "@atlaspack/utils": "2.15.3-alshintegrationtestslib.0",
38
+ "@atlaspack/workers": "2.14.15-alshintegrationtestslib.0",
39
39
  "@mischnic/json-sourcemap": "^0.1.0",
40
40
  "@parcel/source-map": "^2.1.1",
41
41
  "base-x": "^3.0.8",
@@ -49,7 +49,7 @@
49
49
  "semver": "^7.5.2"
50
50
  },
51
51
  "devDependencies": {
52
- "@atlaspack/babel-register": "2.14.2-alshdevreleasescript.0",
52
+ "@atlaspack/babel-register": "2.14.2-alshintegrationtestslib.0",
53
53
  "@types/node": ">= 18",
54
54
  "graphviz": "^0.0.9",
55
55
  "jest-diff": "*",
@@ -60,5 +60,5 @@
60
60
  "./src/serializerCore.js": "./src/serializerCore.browser.js"
61
61
  },
62
62
  "type": "commonjs",
63
- "gitHead": "4f7731590274737c52fda5fb9ad51310bb89154f"
63
+ "gitHead": "f6a68fdf5e9837f1040a7ea71443212a6f62ee5b"
64
64
  }
@@ -1,5 +1,6 @@
1
1
  if (
2
- process.env.ATLASPACK_BUILD_ENV !== 'production' ||
2
+ process.env.ATLASPACK_DEV === 'true' ||
3
+ process.env.ATLASPACK_BUILD_ENV === 'test' ||
3
4
  process.env.ATLASPACK_SELF_BUILD
4
5
  ) {
5
6
  require('@atlaspack/babel-register');