@atlaspack/core 2.18.6-alshintegrationtestslib.0 → 2.18.6-dev.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,13 +14,7 @@ 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(
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) {}
17
+ function validatePackageName() {}
24
18
  const validatePluginName = (pluginType, key) => {
25
19
  return val => {
26
20
  // allow plugin spread...
@@ -867,7 +867,6 @@ class BundleGraph {
867
867
  if (bundleHasReference(descendant)) {
868
868
  isReferenced = true;
869
869
  actions.stop();
870
- return;
871
870
  }
872
871
  }, referencer);
873
872
  return isReferenced;
@@ -926,7 +925,6 @@ class BundleGraph {
926
925
  let childBundles = this.getBundlesInBundleGroup(node.value);
927
926
  if (childBundles.some(b => b.id !== bundle.id && b.bundleBehavior !== _types.BundleBehavior.isolated && b.bundleBehavior !== _types.BundleBehavior.inline && this.bundleHasAsset(b, asset))) {
928
927
  actions.skipChildren();
929
- return;
930
928
  }
931
929
  }
932
930
  }, [bundleGraphEdgeTypes.references, bundleGraphEdgeTypes.bundle]);
@@ -413,10 +413,9 @@ class PackagerRunner {
413
413
  inlineSources = this.options.mode === 'production';
414
414
  }
415
415
  }
416
- let mapFilename = fullPath + '.map';
417
416
  let isInlineMap = bundleEnv.sourceMap && bundleEnv.sourceMap.inline;
418
417
  let stringified = await map.stringify({
419
- file: _path().default.basename(mapFilename),
418
+ file: _path().default.basename(fullPath + '.map'),
420
419
  // $FlowFixMe
421
420
  fs: this.options.inputFS,
422
421
  rootDir: this.options.projectRoot,
@@ -722,8 +722,7 @@ class RequestGraph extends _graph().ContentGraph {
722
722
  }
723
723
  }
724
724
  const invalidationsAfter = this.getInvalidNodeCount();
725
- const invalidationsForEvent = invalidationsAfter - invalidationsBefore;
726
- invalidationsByPath.set(_path, (invalidationsByPath.get(_path) ?? 0) + invalidationsForEvent);
725
+ invalidationsByPath.set(_path, (invalidationsByPath.get(_path) ?? 0) + (invalidationsAfter - invalidationsBefore));
727
726
  }
728
727
  if ((0, _featureFlags().getFeatureFlag)('fixQuadraticCacheInvalidation')) {
729
728
  cleanUpOrphans(this);
@@ -963,41 +962,40 @@ class RequestTracker {
963
962
  }
964
963
  createAPI(requestId, previousInvalidations) {
965
964
  let subRequestContentKeys = new Set();
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;
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);
991
997
  }
992
- return false;
993
998
  },
994
- runRequest: (subRequest, opts) => {
995
- subRequestContentKeys.add(subRequest.id);
996
- return this.runRequest(subRequest, opts);
997
- }
998
- };
999
- return {
1000
- api,
1001
999
  subRequestContentKeys
1002
1000
  };
1003
1001
  }
@@ -1149,8 +1147,7 @@ function getWatcherOptions({
1149
1147
  watchDir,
1150
1148
  watchBackend
1151
1149
  }) {
1152
- const vcsDirs = ['.git', '.hg'];
1153
- const uniqueDirs = [...new Set([...watchIgnore, ...vcsDirs, cacheDir])];
1150
+ const uniqueDirs = [...new Set([...watchIgnore, ...['.git', '.hg'], cacheDir])];
1154
1151
  const ignore = uniqueDirs.map(dir => _path2().default.resolve(watchDir, dir));
1155
1152
  return {
1156
1153
  ignore,
@@ -1344,15 +1341,13 @@ async function invalidateRequestGraph(requestGraph, options, events) {
1344
1341
  const invalidatedCount = invalidations.reduce((acc, invalidation) => acc + invalidation.count, 0);
1345
1342
  const requestCount = requestGraph.nodes.reduce((acc, node) => acc + ((node === null || node === void 0 ? void 0 : node.type) === REQUEST ? 1 : 0), 0);
1346
1343
  const nodeCount = requestGraph.nodes.length;
1347
- const nodeInvalidationRatio = invalidatedCount / nodeCount;
1348
- const requestInvalidationRatio = invalidatedCount / requestCount;
1349
1344
  return {
1350
1345
  invalidations,
1351
1346
  nodeCount,
1352
1347
  requestCount,
1353
1348
  invalidatedCount,
1354
- nodeInvalidationRatio,
1355
- requestInvalidationRatio
1349
+ nodeInvalidationRatio: invalidatedCount / nodeCount,
1350
+ requestInvalidationRatio: invalidatedCount / requestCount
1356
1351
  };
1357
1352
  }
1358
1353
  /**
@@ -173,12 +173,12 @@ class Transformation {
173
173
  });
174
174
 
175
175
  // Prefer `isSource` originating from the AssetRequest.
176
- let isSource = isSourceOverride ?? summarizedIsSource;
176
+
177
177
  return new _UncommittedAsset.default({
178
178
  value: (0, _assetUtils.createAsset)(this.options.projectRoot, {
179
179
  code,
180
180
  filePath,
181
- isSource,
181
+ isSource: isSourceOverride ?? summarizedIsSource,
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(minVersions, defaultValue) {
47
+ matchesEngines() {
48
48
  return true;
49
49
  }
50
50
 
51
51
  // TODO
52
52
  // eslint-disable-next-line no-unused-vars
53
- supports(feature, defaultValue) {
53
+ supports() {
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(options) {
129
+ addDependency() {
130
130
  throw new Error('MutableAsset.addDependency()');
131
131
  }
132
132
 
133
133
  // eslint-disable-next-line no-unused-vars
134
- addURLDependency(url, opts) {
134
+ addURLDependency() {
135
135
  throw new Error('MutableAsset.addURLDependency()');
136
136
  }
137
137
 
138
138
  // eslint-disable-next-line no-unused-vars
139
- setEnvironment(opts) {
139
+ setEnvironment() {
140
140
  throw new Error('MutableAsset.setEnvironment()');
141
141
  }
142
142
 
143
143
  // eslint-disable-next-line no-unused-vars
144
- invalidateOnFileChange(invalidation) {
144
+ invalidateOnFileChange() {
145
145
  // TODO: Forward invalidations to Rust
146
146
  }
147
147
 
148
148
  // eslint-disable-next-line no-unused-vars
149
- invalidateOnFileCreate(invalidation) {
149
+ invalidateOnFileCreate() {
150
150
  // TODO: Forward invalidations to Rust
151
151
  }
152
152
 
153
153
  // eslint-disable-next-line no-unused-vars
154
- invalidateOnEnvChange(invalidation) {
154
+ invalidateOnEnvChange() {
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(filePath) {}
43
+ invalidateOnFileChange() {}
44
44
 
45
45
  // eslint-disable-next-line no-unused-vars
46
- invalidateOnFileCreate(invalidations) {}
46
+ invalidateOnFileCreate() {}
47
47
 
48
48
  // eslint-disable-next-line no-unused-vars
49
- invalidateOnEnvChange(invalidation) {}
49
+ invalidateOnEnvChange() {}
50
50
  invalidateOnStartup() {}
51
51
  invalidateOnBuild() {}
52
52
 
53
53
  // eslint-disable-next-line no-unused-vars
54
- addDevDependency(options) {}
54
+ addDevDependency() {}
55
55
 
56
56
  // eslint-disable-next-line no-unused-vars
57
- setCacheKey(key) {}
57
+ setCacheKey() {}
58
58
  getConfig(
59
59
  // eslint-disable-next-line no-unused-vars
60
60
  filePaths,
@@ -1,6 +1,3 @@
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
- }
6
3
  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 (process.env.ATLASPACK_BUILD_ENV === 'production' && !process.env.ATLASPACK_BUILD_REPL) {
50
+ if ("production" === '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
- async function getPreviousDevDepRequests() {
99
+ const previousDevDepRequests = await 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,8 +109,7 @@ 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
- }
113
- const previousDevDepRequests = await getPreviousDevDepRequests();
112
+ }();
114
113
  return {
115
114
  devDeps: new Map([...previousDevDepRequests.entries()].filter(([id]) => api.canSkipSubrequest(id)).map(([, req]) => [`${req.specifier}:${(0, _projectPath.fromProjectPathRelative)(req.resolveFrom)}`, req.hash])),
116
115
  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
- function createCache() {
142
+ let cache = function createCache() {
143
143
  if (initialOptions.cache) {
144
144
  return initialOptions.cache;
145
145
  }
@@ -150,8 +150,7 @@ async function resolveOptions(initialOptions) {
150
150
  }
151
151
  }
152
152
  return new (_cache().LMDBLiteCache)(cacheDir);
153
- }
154
- let cache = createCache();
153
+ }();
155
154
  let mode = initialOptions.mode ?? 'development';
156
155
  let shouldOptimize = (initialOptions === null || initialOptions === void 0 || (_initialOptions$defau = initialOptions.defaultTargetOptions) === null || _initialOptions$defau === void 0 ? void 0 : _initialOptions$defau.shouldOptimize) ?? mode === 'production';
157
156
  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,24 +172,7 @@ 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(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
- }
175
+ function invalidateRequireCache() {
193
176
  throw new Error('invalidateRequireCache is only for tests');
194
177
  }
195
178
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/core",
3
- "version": "2.18.6-alshintegrationtestslib.0",
3
+ "version": "2.18.6-dev.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-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",
24
+ "@atlaspack/build-cache": "2.13.4-dev.0",
25
+ "@atlaspack/cache": "3.2.10-dev.0",
26
+ "@atlaspack/diagnostic": "2.14.2-dev.0",
27
+ "@atlaspack/events": "2.14.2-dev.0",
28
+ "@atlaspack/feature-flags": "2.18.3-dev.0",
29
+ "@atlaspack/fs": "2.15.10-dev.0",
30
+ "@atlaspack/graph": "3.5.5-dev.0",
31
+ "@atlaspack/logger": "2.14.12-dev.0",
32
+ "@atlaspack/package-manager": "2.14.15-dev.0",
33
+ "@atlaspack/plugin": "2.14.15-dev.0",
34
+ "@atlaspack/profiler": "2.14.13-dev.0",
35
+ "@atlaspack/rust": "3.3.6-dev.0",
36
+ "@atlaspack/types": "2.15.5-dev.0",
37
+ "@atlaspack/utils": "2.15.3-dev.0",
38
+ "@atlaspack/workers": "2.14.15-dev.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-alshintegrationtestslib.0",
52
+ "@atlaspack/babel-register": "2.14.2-dev.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": "f6a68fdf5e9837f1040a7ea71443212a6f62ee5b"
63
+ "gitHead": "6ce3565fe038caf52c09fad4e48175829b174571"
64
64
  }
@@ -1,6 +1,5 @@
1
1
  if (
2
- process.env.ATLASPACK_DEV === 'true' ||
3
- process.env.ATLASPACK_BUILD_ENV === 'test' ||
2
+ process.env.ATLASPACK_BUILD_ENV !== 'production' ||
4
3
  process.env.ATLASPACK_SELF_BUILD
5
4
  ) {
6
5
  require('@atlaspack/babel-register');