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

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.
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();
@@ -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
  });
@@ -413,10 +413,6 @@ 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
- }
420
416
  let isInlineMap = bundleEnv.sourceMap && bundleEnv.sourceMap.inline;
421
417
  let stringified = await map.stringify({
422
418
  file: _path().default.basename(fullPath + '.map'),
@@ -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;
@@ -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];
package/lib/index.js CHANGED
@@ -9,8 +9,7 @@ var _exportNames = {
9
9
  BuildError: true,
10
10
  createWorkerFarm: true,
11
11
  INTERNAL_RESOLVE: true,
12
- INTERNAL_TRANSFORM: true,
13
- isSuperPackage: true
12
+ INTERNAL_TRANSFORM: true
14
13
  };
15
14
  Object.defineProperty(exports, "Atlaspack", {
16
15
  enumerable: true,
@@ -54,14 +53,7 @@ Object.defineProperty(exports, "default", {
54
53
  return _Atlaspack.default;
55
54
  }
56
55
  });
57
- Object.defineProperty(exports, "isSuperPackage", {
58
- enumerable: true,
59
- get: function () {
60
- return _isSuperPackage.isSuperPackage;
61
- }
62
- });
63
56
  var _Atlaspack = _interopRequireWildcard(require("./Atlaspack"));
64
- var _isSuperPackage = require("./isSuperPackage");
65
57
  var _atlaspackV = require("./atlaspack-v3");
66
58
  Object.keys(_atlaspackV).forEach(function (key) {
67
59
  if (key === "default" || key === "__esModule") return;
@@ -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.
@@ -29,9 +29,6 @@ class PluginOptions {
29
29
  get parcelVersion() {
30
30
  return this.#options.parcelVersion;
31
31
  }
32
- get isAtlaspackSuper() {
33
- return Boolean(this.#options.isAtlaspackSuper);
34
- }
35
32
  get hmrOptions() {
36
33
  return this.#options.hmrOptions;
37
34
  }
@@ -40,7 +40,7 @@ function _diagnostic() {
40
40
  return data;
41
41
  }
42
42
  function _json() {
43
- const data = _interopRequireDefault(require("json5"));
43
+ const data = require("json5");
44
44
  _json = function () {
45
45
  return data;
46
46
  };
@@ -60,13 +60,11 @@ function _assert() {
60
60
  };
61
61
  return data;
62
62
  }
63
- var _internalPlugins = _interopRequireDefault(require("../internal-plugins"));
64
63
  var _AtlaspackConfig = require("../AtlaspackConfig");
65
64
  var _AtlaspackConfig2 = _interopRequireDefault(require("../AtlaspackConfig.schema"));
66
65
  var _projectPath = require("../projectPath");
67
66
  var _RequestTracker = require("../RequestTracker");
68
67
  var _utils2 = require("../utils");
69
- var _isSuperPackage = require("../isSuperPackage");
70
68
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
71
69
  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); }
72
70
  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; }
@@ -136,38 +134,28 @@ async function resolveAtlaspackConfig(options) {
136
134
  let resolveFrom = getResolveFrom(options.inputFS, options.projectRoot);
137
135
  let configPath = options.config != null ? (await options.packageManager.resolve(options.config, resolveFrom)).resolved : await (0, _utils().resolveConfig)(options.inputFS, resolveFrom, ['.parcelrc'], options.projectRoot);
138
136
  let usedDefault = false;
139
- let config, extendedFiles;
140
- if (configPath == null && options.defaultConfig != null && (0, _isSuperPackage.isSuperPackage)() && options.defaultConfig.endsWith('.js')) {
137
+ if (configPath == null && options.defaultConfig != null) {
141
138
  usedDefault = true;
142
- // Load the super package default config
143
- let result = await processConfigChain(_internalPlugins.default['@atlaspack/config-default'](),
144
- // $FlowFixMe
145
- options.defaultConfig, options);
146
- config = result.config;
147
- extendedFiles = result.extendedFiles;
148
- } else {
149
- if (configPath == null && options.defaultConfig != null) {
150
- usedDefault = true;
151
- configPath = (await options.packageManager.resolve(options.defaultConfig, resolveFrom)).resolved;
152
- }
153
- if (configPath == null) {
154
- return null;
155
- }
156
- let contents;
157
- try {
158
- contents = await options.inputFS.readFile(configPath, 'utf8');
159
- } catch (e) {
160
- throw new (_diagnostic().default)({
161
- diagnostic: {
162
- message: (0, _diagnostic().md)`Could not find parcel config at ${_path().default.relative(options.projectRoot, configPath)}`,
163
- origin: '@atlaspack/core'
164
- }
165
- });
166
- }
167
- let result = await parseAndProcessConfig(configPath, contents, options);
168
- config = result.config;
169
- extendedFiles = result.extendedFiles;
139
+ configPath = (await options.packageManager.resolve(options.defaultConfig, resolveFrom)).resolved;
140
+ }
141
+ if (configPath == null) {
142
+ return null;
170
143
  }
144
+ let contents;
145
+ try {
146
+ contents = await options.inputFS.readFile(configPath, 'utf8');
147
+ } catch (e) {
148
+ throw new (_diagnostic().default)({
149
+ diagnostic: {
150
+ message: (0, _diagnostic().md)`Could not find parcel config at ${_path().default.relative(options.projectRoot, configPath)}`,
151
+ origin: '@atlaspack/core'
152
+ }
153
+ });
154
+ }
155
+ let {
156
+ config,
157
+ extendedFiles
158
+ } = await parseAndProcessConfig(configPath, contents, options);
171
159
  if (options.additionalReporters.length > 0) {
172
160
  config.reporters = [...options.additionalReporters.map(({
173
161
  packageName,
@@ -191,7 +179,7 @@ function create(config, options) {
191
179
  async function parseAndProcessConfig(configPath, contents, options) {
192
180
  let config;
193
181
  try {
194
- config = _json().default.parse(contents);
182
+ config = (0, _json().parse)(contents);
195
183
  } catch (e) {
196
184
  let pos = {
197
185
  line: e.lineNumber,
@@ -316,16 +304,13 @@ async function processConfigChain(configFile, filePath, options) {
316
304
  for (let ext of exts) {
317
305
  try {
318
306
  let key = Array.isArray(configFile.extends) ? `/extends/${i}` : '/extends';
319
- let nextConfig;
320
- if (_internalPlugins.default[ext]) {
321
- nextConfig = (await processConfigChain(_internalPlugins.default[ext](), /*#__ATLASPACK_IGNORE__*/__dirname, options)).config;
322
- } else {
323
- let resolved = await resolveExtends(ext, filePath, key, options);
324
- extendedFiles.push(resolved);
325
- let result = await processExtendedConfig(filePath, key, ext, resolved, options);
326
- extendedFiles = extendedFiles.concat(result.extendedFiles);
327
- nextConfig = result.config;
328
- }
307
+ let resolved = await resolveExtends(ext, filePath, key, options);
308
+ extendedFiles.push(resolved);
309
+ let {
310
+ extendedFiles: moreExtendedFiles,
311
+ config: nextConfig
312
+ } = await processExtendedConfig(filePath, key, ext, resolved, options);
313
+ extendedFiles = extendedFiles.concat(moreExtendedFiles);
329
314
  extStartConfig = extStartConfig ? mergeConfigs(extStartConfig, nextConfig) : nextConfig;
330
315
  } catch (err) {
331
316
  errors.push(err);
@@ -56,7 +56,6 @@ function _utils() {
56
56
  var _loadDotEnv = _interopRequireDefault(require("./loadDotEnv"));
57
57
  var _projectPath = require("./projectPath");
58
58
  var _AtlaspackConfigRequest = require("./requests/AtlaspackConfigRequest");
59
- var _isSuperPackage = require("./isSuperPackage");
60
59
  var _constants = require("./constants");
61
60
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
62
61
  // Default cache directory name
@@ -238,8 +237,7 @@ async function resolveOptions(initialOptions) {
238
237
  ..._featureFlags().DEFAULT_FEATURE_FLAGS,
239
238
  ...(initialOptions === null || initialOptions === void 0 ? void 0 : initialOptions.featureFlags)
240
239
  },
241
- parcelVersion: _constants.ATLASPACK_VERSION,
242
- isAtlaspackSuper: (0, _isSuperPackage.isSuperPackage)()
240
+ parcelVersion: _constants.ATLASPACK_VERSION
243
241
  };
244
242
  }
245
243
  function getRelativeConfigSpecifier(fs, projectRoot, specifier) {
package/lib/worker.js CHANGED
@@ -78,15 +78,15 @@ require("@atlaspack/package-manager");
78
78
  require("@atlaspack/fs");
79
79
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
80
80
  // register with serializer
81
- // Repl builds are currently not enabled
82
81
  // $FlowFixMe
83
- // if (process.env.ATLASPACK_BUILD_REPL && process.browser) {
84
- // /* eslint-disable import/no-extraneous-dependencies, monorepo/no-internal-import */
85
- // require('@atlaspack/repl/src/atlaspack/BrowserPackageManager.js');
86
- // // $FlowFixMe
87
- // require('@atlaspack/repl/src/atlaspack/ExtendedMemoryFS.js');
88
- // /* eslint-enable import/no-extraneous-dependencies, monorepo/no-internal-import */
89
- // }
82
+ if (process.env.ATLASPACK_BUILD_REPL && process.browser) {
83
+ /* eslint-disable import/no-extraneous-dependencies, monorepo/no-internal-import */
84
+ require('@atlaspack/repl/src/atlaspack/BrowserPackageManager.js');
85
+ // $FlowFixMe
86
+ require('@atlaspack/repl/src/atlaspack/ExtendedMemoryFS.js');
87
+ /* eslint-enable import/no-extraneous-dependencies, monorepo/no-internal-import */
88
+ }
89
+
90
90
  (0, _registerCoreWithSerializer.registerCoreWithSerializer)();
91
91
 
92
92
  // Remove the workerApi type from the TransformationOpts and ValidationOpts types:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/core",
3
- "version": "2.16.2-dev.72+9840480de",
3
+ "version": "2.16.2-dev.73+84eec3484",
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.3-dev.140+9840480de",
25
- "@atlaspack/cache": "3.1.1-dev.72+9840480de",
26
- "@atlaspack/diagnostic": "2.14.1-dev.140+9840480de",
27
- "@atlaspack/events": "2.14.1-dev.140+9840480de",
28
- "@atlaspack/feature-flags": "2.14.1-dev.140+9840480de",
29
- "@atlaspack/fs": "2.14.5-dev.72+9840480de",
30
- "@atlaspack/graph": "3.4.1-dev.140+9840480de",
31
- "@atlaspack/logger": "2.14.5-dev.72+9840480de",
32
- "@atlaspack/package-manager": "2.14.5-dev.72+9840480de",
33
- "@atlaspack/plugin": "2.14.5-dev.72+9840480de",
34
- "@atlaspack/profiler": "2.14.1-dev.140+9840480de",
35
- "@atlaspack/rust": "3.2.1-dev.72+9840480de",
36
- "@atlaspack/types": "2.14.5-dev.72+9840480de",
37
- "@atlaspack/utils": "2.14.5-dev.72+9840480de",
38
- "@atlaspack/workers": "2.14.5-dev.72+9840480de",
24
+ "@atlaspack/build-cache": "2.13.3-dev.141+84eec3484",
25
+ "@atlaspack/cache": "3.1.1-dev.73+84eec3484",
26
+ "@atlaspack/diagnostic": "2.14.1-dev.141+84eec3484",
27
+ "@atlaspack/events": "2.14.1-dev.141+84eec3484",
28
+ "@atlaspack/feature-flags": "2.14.1-dev.141+84eec3484",
29
+ "@atlaspack/fs": "2.14.5-dev.73+84eec3484",
30
+ "@atlaspack/graph": "3.4.1-dev.141+84eec3484",
31
+ "@atlaspack/logger": "2.14.5-dev.73+84eec3484",
32
+ "@atlaspack/package-manager": "2.14.5-dev.73+84eec3484",
33
+ "@atlaspack/plugin": "2.14.5-dev.73+84eec3484",
34
+ "@atlaspack/profiler": "2.14.1-dev.141+84eec3484",
35
+ "@atlaspack/rust": "3.2.1-dev.73+84eec3484",
36
+ "@atlaspack/types": "2.14.5-dev.73+84eec3484",
37
+ "@atlaspack/utils": "2.14.5-dev.73+84eec3484",
38
+ "@atlaspack/workers": "2.14.5-dev.73+84eec3484",
39
39
  "@mischnic/json-sourcemap": "^0.1.0",
40
40
  "@parcel/source-map": "^2.1.1",
41
41
  "base-x": "^3.0.8",
@@ -67,12 +67,9 @@
67
67
  "default": "./lib/worker.js"
68
68
  }
69
69
  },
70
- "atlaspackReferences": [
71
- "_empty.js"
72
- ],
73
70
  "browser": {
74
71
  "./src/serializerCore.js": "./src/serializerCore.browser.js"
75
72
  },
76
73
  "type": "commonjs",
77
- "gitHead": "9840480de27511f558d8f5b8cf82220de977b4fb"
74
+ "gitHead": "84eec348413c647de4872f902c4bc8ff54c347f3"
78
75
  }
package/src/Atlaspack.js CHANGED
@@ -69,10 +69,7 @@ registerCoreWithSerializer();
69
69
 
70
70
  export const INTERNAL_TRANSFORM: symbol = Symbol('internal_transform');
71
71
  export const INTERNAL_RESOLVE: symbol = Symbol('internal_resolve');
72
- export const WORKER_PATH: string = path.join(
73
- /*#__ATLASPACK_IGNORE__*/ __dirname,
74
- 'worker.js',
75
- );
72
+ export const WORKER_PATH: string = path.join(__dirname, 'worker.js');
76
73
 
77
74
  export default class Atlaspack {
78
75
  #requestTracker /*: RequestTracker*/;
@@ -177,6 +174,7 @@ export default class Atlaspack {
177
174
 
178
175
  rustAtlaspack = await AtlaspackV3.create({
179
176
  ...options,
177
+ corePath: path.join(__dirname, '..'),
180
178
  threads,
181
179
  entries: Array.isArray(entries)
182
180
  ? entries
@@ -535,10 +533,11 @@ export default class Atlaspack {
535
533
  nativeInvalid = await this.rustAtlaspack.respondToFsEvents(events);
536
534
  }
537
535
 
538
- let isInvalid = await this.#requestTracker.respondToFSEvents(
539
- events,
540
- Number.POSITIVE_INFINITY,
541
- );
536
+ let {didInvalidate: isInvalid} =
537
+ await this.#requestTracker.respondToFSEvents(
538
+ events,
539
+ Number.POSITIVE_INFINITY,
540
+ );
542
541
 
543
542
  if (
544
543
  (nativeInvalid || isInvalid) &&
@@ -1316,14 +1316,7 @@ export default class BundleGraph {
1316
1316
  }
1317
1317
 
1318
1318
  let dependencies = this._graph
1319
- .getNodeIdsConnectedTo(
1320
- assetNodeId,
1321
- // TODO: This seems like bug with library builds when assets are present
1322
- // in other files. Guarding the fix for now exclusively for super builds
1323
- process.env.ATLASPACK_SUPER_BUILD === 'true'
1324
- ? ALL_EDGE_TYPES
1325
- : undefined,
1326
- )
1319
+ .getNodeIdsConnectedTo(assetNodeId)
1327
1320
  .map((id) => nullthrows(this._graph.getNode(id)))
1328
1321
  .filter((node) => node.type === 'dependency')
1329
1322
  .map((node) => {
@@ -603,11 +603,6 @@ export default class PackagerRunner {
603
603
  }
604
604
  }
605
605
 
606
- if (process.env.ATLASPACK_SUPER_BUILD === 'true') {
607
- // Set source root to 'atlaspack' so stack traces are clean in Sentry
608
- sourceRoot = 'atlaspack';
609
- }
610
-
611
606
  let mapFilename = fullPath + '.map';
612
607
  let isInlineMap = bundleEnv.sourceMap && bundleEnv.sourceMap.inline;
613
608
 
@@ -12,8 +12,6 @@ import {NapiWorkerPool} from './NapiWorkerPool';
12
12
  import ThrowableDiagnostic from '@atlaspack/diagnostic';
13
13
  import type {Event} from '@parcel/watcher';
14
14
  import type {NapiWorkerPool as INapiWorkerPool} from '@atlaspack/types';
15
- import {isSuperPackage} from '../isSuperPackage';
16
- import path from 'path';
17
15
 
18
16
  export type AtlaspackV3Options = {|
19
17
  fs?: AtlaspackNapiOptions['fs'],
@@ -25,54 +23,9 @@ export type AtlaspackV3Options = {|
25
23
  lmdb: Lmdb,
26
24
  featureFlags?: {[string]: string | boolean},
27
25
  napiWorkerPool?: INapiWorkerPool,
28
- ...$Diff<
29
- AtlaspackNapiOptions['options'],
30
- {|
31
- jsPaths: AtlaspackNapiOptions['options']['jsPaths'],
32
- useBuiltinConfigs: AtlaspackNapiOptions['options']['useBuiltinConfigs'],
33
- |},
34
- >,
26
+ ...AtlaspackNapiOptions['options'],
35
27
  |};
36
28
 
37
- function getJsPaths(): AtlaspackNapiOptions['options']['jsPaths'] {
38
- const dirname = /*#__ATLASPACK_IGNORE__*/ __dirname;
39
-
40
- if (isSuperPackage()) {
41
- // dirname: atlaspack/lib/core/core/atlaspack-v3
42
- // core: atlaspack/lib/core/core/index.js
43
- const corePath = path.join(dirname, '..');
44
- // esmodule helpers: atlaspack/lib/transformers/js/esmodule-helpers.js
45
- const esmoduleHelpersPath = path.join(
46
- dirname,
47
- '../../../transformers/js/esmodule-helpers.js',
48
- );
49
-
50
- // empty file: atlaspack/lib/core/core/_empty.js
51
- const emptyFile = path.join(dirname, '_empty.js');
52
-
53
- return {
54
- corePath,
55
- esmoduleHelpersSpecifier: path.relative(corePath, esmoduleHelpersPath),
56
- esmoduleHelpersIncludeNodeModules: 'atlaspack',
57
- emptyFile,
58
- };
59
- }
60
-
61
- // dirname: @atlaspack/core/lib/atlaspack-v3
62
- // core: @atlaspack/core
63
- const corePath = path.join(dirname, '../..');
64
- // empty file: atlaspack/lib/core/core/_empty.js
65
- const emptyFile = path.join(dirname, '_empty.js');
66
-
67
- return {
68
- corePath,
69
- esmoduleHelpersSpecifier:
70
- '@atlaspack/transformer-js/src/esmodule-helpers.js',
71
- esmoduleHelpersIncludeNodeModules: '@atlaspack/transformer-js',
72
- emptyFile,
73
- };
74
- }
75
-
76
29
  export class AtlaspackV3 {
77
30
  _atlaspack_napi: AtlaspackNapi;
78
31
 
@@ -99,11 +52,7 @@ export class AtlaspackV3 {
99
52
  fs,
100
53
  packageManager,
101
54
  threads,
102
- options: {
103
- ...options,
104
- jsPaths: getJsPaths(),
105
- useBuiltinConfigs: isSuperPackage(),
106
- },
55
+ options,
107
56
  napiWorkerPool,
108
57
  },
109
58
  lmdb,
@@ -6,11 +6,7 @@ import process from 'process';
6
6
  import type {Transferable} from '@atlaspack/rust';
7
7
  import {getAvailableThreads} from '@atlaspack/rust';
8
8
 
9
- const WORKER_PATH = path.join(
10
- /*#__ATLASPACK_IGNORE__*/ __dirname,
11
- 'worker',
12
- 'napi-worker.js',
13
- );
9
+ const WORKER_PATH = path.join(__dirname, 'worker', 'index.js');
14
10
  const ATLASPACK_NAPI_WORKERS =
15
11
  process.env.ATLASPACK_NAPI_WORKERS &&
16
12
  parseInt(process.env.ATLASPACK_NAPI_WORKERS, 10);
@@ -25,7 +25,6 @@ import {
25
25
  bundleBehaviorMap,
26
26
  dependencyPriorityMap,
27
27
  } from './compat';
28
- import atlaspackInternalPlugins from '../../internal-plugins';
29
28
 
30
29
  const CONFIG = Symbol.for('parcel-plugin-config');
31
30
 
@@ -42,16 +41,10 @@ export class AtlaspackWorker {
42
41
 
43
42
  loadPlugin: JsCallable<[LoadPluginOptions], Promise<void>> = jsCallable(
44
43
  async ({kind, specifier, resolveFrom}) => {
45
- let resolvedModule;
46
- if (atlaspackInternalPlugins && atlaspackInternalPlugins[specifier]) {
47
- // If the plugin is available inside the package then use it
48
- resolvedModule = atlaspackInternalPlugins[specifier]();
49
- } else {
50
- let customRequire = module.createRequire(resolveFrom);
51
- let resolvedPath = customRequire.resolve(specifier);
52
- // $FlowFixMe
53
- resolvedModule = await import(resolvedPath);
54
- }
44
+ let customRequire = module.createRequire(resolveFrom);
45
+ let resolvedPath = customRequire.resolve(specifier);
46
+ // $FlowFixMe
47
+ let resolvedModule = await import(resolvedPath);
55
48
 
56
49
  let instance = undefined;
57
50
  if (resolvedModule.default && resolvedModule.default[CONFIG]) {
package/src/index.js CHANGED
@@ -10,6 +10,4 @@ export {
10
10
  INTERNAL_TRANSFORM,
11
11
  } from './Atlaspack';
12
12
 
13
- export {isSuperPackage} from './isSuperPackage';
14
-
15
13
  export * from './atlaspack-v3';
@@ -8,14 +8,8 @@ import ThrowableDiagnostic, {
8
8
  generateJSONCodeHighlights,
9
9
  md,
10
10
  } from '@atlaspack/diagnostic';
11
- import {version as ATLASPACK_VERSION} from '../package.json';
12
- import atlaspackInternalPlugins from './internal-plugins';
13
11
  import {findAlternativeNodeModules} from '@atlaspack/utils';
14
- import {
15
- type ProjectPath,
16
- toProjectPath,
17
- toProjectPathUnsafe,
18
- } from './projectPath';
12
+ import {type ProjectPath, toProjectPath} from './projectPath';
19
13
 
20
14
  const NODE_MODULES = `${path.sep}node_modules${path.sep}`;
21
15
  const CONFIG = Symbol.for('parcel-plugin-config');
@@ -30,22 +24,6 @@ export default async function loadPlugin<T>(
30
24
  version: Semver,
31
25
  resolveFrom: ProjectPath,
32
26
  |}> {
33
- if (atlaspackInternalPlugins && atlaspackInternalPlugins[pluginName]) {
34
- let plugin = atlaspackInternalPlugins[pluginName]();
35
- plugin = plugin.default || plugin;
36
- plugin = plugin[CONFIG];
37
- if (!plugin) {
38
- throw new Error(
39
- `Plugin ${pluginName} is not a valid Atlaspack plugin, should export an instance of a Atlaspack plugin ex. "export default new Reporter({ ... })".`,
40
- );
41
- }
42
- return {
43
- plugin,
44
- version: ATLASPACK_VERSION,
45
- resolveFrom: toProjectPathUnsafe(options.projectRoot),
46
- };
47
- }
48
-
49
27
  let resolveFrom = configPath;
50
28
 
51
29
  // Config packages can reference plugins, but cannot contain other plugins within them.
@@ -47,10 +47,6 @@ export default class PluginOptions implements IPluginOptions {
47
47
  return this.#options.parcelVersion;
48
48
  }
49
49
 
50
- get isAtlaspackSuper(): boolean {
51
- return Boolean(this.#options.isAtlaspackSuper);
52
- }
53
-
54
50
  get hmrOptions(): ?HMROptions {
55
51
  return this.#options.hmrOptions;
56
52
  }
@@ -30,17 +30,15 @@ import ThrowableDiagnostic, {
30
30
  md,
31
31
  errorToDiagnostic,
32
32
  } from '@atlaspack/diagnostic';
33
- import json5 from 'json5';
33
+ import {parse} from 'json5';
34
34
  import path from 'path';
35
35
  import invariant from 'assert';
36
36
 
37
- import atlaspackInternalPlugins from '../internal-plugins';
38
37
  import {AtlaspackConfig} from '../AtlaspackConfig';
39
38
  import AtlaspackConfigSchema from '../AtlaspackConfig.schema';
40
39
  import {toProjectPath} from '../projectPath';
41
40
  import {requestTypes} from '../RequestTracker';
42
41
  import {optionsProxy} from '../utils';
43
- import {isSuperPackage} from '../isSuperPackage';
44
42
 
45
43
  type ConfigMap<K, V> = {[K]: V, ...};
46
44
 
@@ -161,61 +159,35 @@ export async function resolveAtlaspackConfig(
161
159
  );
162
160
 
163
161
  let usedDefault = false;
164
- let config, extendedFiles;
165
-
166
- if (
167
- configPath == null &&
168
- options.defaultConfig != null &&
169
- isSuperPackage() &&
170
- options.defaultConfig.endsWith('.js')
171
- ) {
162
+ if (configPath == null && options.defaultConfig != null) {
172
163
  usedDefault = true;
173
- // Load the super package default config
174
- let result: AtlaspackConfigChain = await processConfigChain(
175
- atlaspackInternalPlugins['@atlaspack/config-default'](),
176
- // $FlowFixMe
177
- options.defaultConfig,
178
- options,
179
- );
180
- config = result.config;
181
- extendedFiles = result.extendedFiles;
182
- } else {
183
- if (configPath == null && options.defaultConfig != null) {
184
- usedDefault = true;
185
-
186
- configPath = (
187
- await options.packageManager.resolve(options.defaultConfig, resolveFrom)
188
- ).resolved;
189
- }
190
-
191
- if (configPath == null) {
192
- return null;
193
- }
164
+ configPath = (
165
+ await options.packageManager.resolve(options.defaultConfig, resolveFrom)
166
+ ).resolved;
167
+ }
194
168
 
195
- let contents;
196
- try {
197
- contents = await options.inputFS.readFile(configPath, 'utf8');
198
- } catch (e) {
199
- throw new ThrowableDiagnostic({
200
- diagnostic: {
201
- message: md`Could not find parcel config at ${path.relative(
202
- options.projectRoot,
203
- configPath,
204
- )}`,
205
- origin: '@atlaspack/core',
206
- },
207
- });
208
- }
169
+ if (configPath == null) {
170
+ return null;
171
+ }
209
172
 
210
- let result: AtlaspackConfigChain = await parseAndProcessConfig(
211
- configPath,
212
- contents,
213
- options,
214
- );
215
- config = result.config;
216
- extendedFiles = result.extendedFiles;
173
+ let contents;
174
+ try {
175
+ contents = await options.inputFS.readFile(configPath, 'utf8');
176
+ } catch (e) {
177
+ throw new ThrowableDiagnostic({
178
+ diagnostic: {
179
+ message: md`Could not find parcel config at ${path.relative(
180
+ options.projectRoot,
181
+ configPath,
182
+ )}`,
183
+ origin: '@atlaspack/core',
184
+ },
185
+ });
217
186
  }
218
187
 
188
+ let {config, extendedFiles}: AtlaspackConfigChain =
189
+ await parseAndProcessConfig(configPath, contents, options);
190
+
219
191
  if (options.additionalReporters.length > 0) {
220
192
  config.reporters = [
221
193
  ...options.additionalReporters.map(({packageName, resolveFrom}) => ({
@@ -244,7 +216,7 @@ export async function parseAndProcessConfig(
244
216
  ): Promise<AtlaspackConfigChain> {
245
217
  let config: RawAtlaspackConfig;
246
218
  try {
247
- config = json5.parse(contents);
219
+ config = parse(contents);
248
220
  } catch (e) {
249
221
  let pos = {
250
222
  line: e.lineNumber,
@@ -474,29 +446,11 @@ export async function processConfigChain(
474
446
  let key = Array.isArray(configFile.extends)
475
447
  ? `/extends/${i}`
476
448
  : '/extends';
477
-
478
- let nextConfig;
479
- if (atlaspackInternalPlugins[ext]) {
480
- nextConfig = (
481
- await processConfigChain(
482
- atlaspackInternalPlugins[ext](),
483
- /*#__ATLASPACK_IGNORE__*/ __dirname,
484
- options,
485
- )
486
- ).config;
487
- } else {
488
- let resolved = await resolveExtends(ext, filePath, key, options);
489
- extendedFiles.push(resolved);
490
- let result = await processExtendedConfig(
491
- filePath,
492
- key,
493
- ext,
494
- resolved,
495
- options,
496
- );
497
- extendedFiles = extendedFiles.concat(result.extendedFiles);
498
- nextConfig = result.config;
499
- }
449
+ let resolved = await resolveExtends(ext, filePath, key, options);
450
+ extendedFiles.push(resolved);
451
+ let {extendedFiles: moreExtendedFiles, config: nextConfig} =
452
+ await processExtendedConfig(filePath, key, ext, resolved, options);
453
+ extendedFiles = extendedFiles.concat(moreExtendedFiles);
500
454
  extStartConfig = extStartConfig
501
455
  ? mergeConfigs(extStartConfig, nextConfig)
502
456
  : nextConfig;
@@ -25,7 +25,6 @@ import {
25
25
  import loadDotEnv from './loadDotEnv';
26
26
  import {toProjectPath} from './projectPath';
27
27
  import {getResolveFrom} from './requests/AtlaspackConfigRequest';
28
- import {isSuperPackage} from './isSuperPackage';
29
28
 
30
29
  import {DEFAULT_FEATURE_FLAGS} from '@atlaspack/feature-flags';
31
30
  import {ATLASPACK_VERSION} from './constants';
@@ -278,7 +277,6 @@ export default async function resolveOptions(
278
277
  // feature-flags
279
278
  featureFlags: {...DEFAULT_FEATURE_FLAGS, ...initialOptions?.featureFlags},
280
279
  parcelVersion: ATLASPACK_VERSION,
281
- isAtlaspackSuper: isSuperPackage(),
282
280
  };
283
281
  }
284
282
 
package/src/types.js CHANGED
@@ -285,7 +285,6 @@ export type AtlaspackOptions = {|
285
285
  defaultConfig?: DependencySpecifier,
286
286
  env: EnvMap,
287
287
  parcelVersion: string,
288
- isAtlaspackSuper?: boolean,
289
288
  targets: ?(Array<string> | {+[string]: TargetDescriptor, ...}),
290
289
  shouldDisableCache: boolean,
291
290
  cacheDir: FilePath,
package/src/worker.js CHANGED
@@ -32,15 +32,14 @@ import '@atlaspack/cache'; // register with serializer
32
32
  import '@atlaspack/package-manager';
33
33
  import '@atlaspack/fs';
34
34
 
35
- // Repl builds are currently not enabled
36
35
  // $FlowFixMe
37
- // if (process.env.ATLASPACK_BUILD_REPL && process.browser) {
38
- // /* eslint-disable import/no-extraneous-dependencies, monorepo/no-internal-import */
39
- // require('@atlaspack/repl/src/atlaspack/BrowserPackageManager.js');
40
- // // $FlowFixMe
41
- // require('@atlaspack/repl/src/atlaspack/ExtendedMemoryFS.js');
42
- // /* eslint-enable import/no-extraneous-dependencies, monorepo/no-internal-import */
43
- // }
36
+ if (process.env.ATLASPACK_BUILD_REPL && process.browser) {
37
+ /* eslint-disable import/no-extraneous-dependencies, monorepo/no-internal-import */
38
+ require('@atlaspack/repl/src/atlaspack/BrowserPackageManager.js');
39
+ // $FlowFixMe
40
+ require('@atlaspack/repl/src/atlaspack/ExtendedMemoryFS.js');
41
+ /* eslint-enable import/no-extraneous-dependencies, monorepo/no-internal-import */
42
+ }
44
43
 
45
44
  registerCoreWithSerializer();
46
45
 
package/_empty.js DELETED
File without changes
@@ -1,9 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- // This file is overridden in super package builds
8
- // $FlowFixMe
9
- var _default = exports.default = {};
@@ -1,23 +0,0 @@
1
- "use strict";
2
-
3
- let fs = require('fs');
4
- let {
5
- findAncestorFile
6
- } = require('@atlaspack/rust');
7
- let dirname = /*#__ATLASPACK_IGNORE__*/__dirname;
8
- function isSuperPackage() {
9
- if (!dirname) {
10
- return false;
11
- }
12
- let packageJson = JSON.parse(
13
- // $FlowFixMe
14
- fs.readFileSync(findAncestorFile(['package.json'], dirname, '/'), 'utf8'));
15
- return packageJson.name === 'atlaspack';
16
- }
17
- let result;
18
- module.exports.isSuperPackage = () => {
19
- if (result == null) {
20
- result = isSuperPackage();
21
- }
22
- return result;
23
- };
@@ -1,4 +0,0 @@
1
- // @flow
2
- // This file is overridden in super package builds
3
- // $FlowFixMe
4
- export default {};
@@ -1,28 +0,0 @@
1
- // @flow strict-local
2
- let fs = require('fs');
3
- let {findAncestorFile} = require('@atlaspack/rust');
4
-
5
- let dirname = /*#__ATLASPACK_IGNORE__*/ __dirname;
6
-
7
- function isSuperPackage(): boolean {
8
- if (!dirname) {
9
- return false;
10
- }
11
-
12
- let packageJson = JSON.parse(
13
- // $FlowFixMe
14
- fs.readFileSync(findAncestorFile(['package.json'], dirname, '/'), 'utf8'),
15
- );
16
-
17
- return packageJson.name === 'atlaspack';
18
- }
19
-
20
- let result;
21
-
22
- module.exports.isSuperPackage = (): boolean => {
23
- if (result == null) {
24
- result = isSuperPackage();
25
- }
26
-
27
- return result;
28
- };