@atlaspack/core 2.12.1-dev.3368 → 2.12.1-dev.3401

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 (52) hide show
  1. package/index.d.ts +8 -0
  2. package/lib/AtlaspackConfig.js +3 -3
  3. package/lib/AtlaspackConfig.schema.js +10 -6
  4. package/lib/BundleGraph.js +3 -3
  5. package/lib/PackagerRunner.js +1 -1
  6. package/lib/dumpGraphToGraphViz.js +1 -1
  7. package/lib/index.js +7 -0
  8. package/lib/loadAtlaspackPlugin.js +6 -6
  9. package/lib/public/PluginOptions.js +5 -5
  10. package/lib/requests/AtlaspackConfigRequest.js +8 -8
  11. package/lib/resolveOptions.js +3 -3
  12. package/package.json +16 -16
  13. package/src/AtlaspackConfig.js +3 -3
  14. package/src/AtlaspackConfig.schema.js +10 -7
  15. package/src/BundleGraph.js +3 -3
  16. package/src/PackagerRunner.js +1 -1
  17. package/src/dumpGraphToGraphViz.js +1 -1
  18. package/src/index.js +1 -0
  19. package/src/loadAtlaspackPlugin.js +14 -14
  20. package/src/public/PluginOptions.js +5 -5
  21. package/src/requests/AtlaspackConfigRequest.js +8 -8
  22. package/src/resolveOptions.js +3 -3
  23. package/src/types.js +5 -3
  24. package/test/Atlaspack.test.js +1 -1
  25. package/test/AtlaspackConfig.test.js +27 -27
  26. package/test/AtlaspackConfigRequest.test.js +158 -162
  27. package/test/fixtures/config/{.atlaspackrc → .parcelrc} +1 -1
  28. package/test/fixtures/config/subfolder/.parcelrc +6 -0
  29. package/test/fixtures/config-extends-not-found/.parcelrc +3 -0
  30. package/test/fixtures/config-extends-not-found/.parcelrc-json5 +3 -0
  31. package/test/fixtures/config-extends-not-found/.parcelrc-multiple +3 -0
  32. package/test/fixtures/local-plugin-config-pkg/.parcelrc +3 -0
  33. package/test/fixtures/local-plugin-config-pkg/node_modules/parcel-config-local/package.json +7 -0
  34. package/test/fixtures/plugins/node_modules/parcel-transformer-bad-engines/package.json +7 -0
  35. package/test/fixtures/plugins/node_modules/parcel-transformer-no-engines/package.json +4 -0
  36. package/test/test-utils.js +1 -1
  37. package/test/fixtures/config/subfolder/.atlaspackrc +0 -6
  38. package/test/fixtures/config-extends-not-found/.atlaspackrc +0 -3
  39. package/test/fixtures/config-extends-not-found/.atlaspackrc-json5 +0 -3
  40. package/test/fixtures/config-extends-not-found/.atlaspackrc-multiple +0 -3
  41. package/test/fixtures/local-plugin-config-pkg/.atlaspackrc +0 -3
  42. package/test/fixtures/local-plugin-config-pkg/node_modules/atlaspack-config-local/package.json +0 -7
  43. package/test/fixtures/plugins/node_modules/atlaspack-transformer-bad-engines/package.json +0 -7
  44. package/test/fixtures/plugins/node_modules/atlaspack-transformer-no-engines/package.json +0 -4
  45. /package/test/fixtures/config-extends-not-found/{.atlaspackrc-node-modules → .parcelrc-node-modules} +0 -0
  46. /package/test/fixtures/config-malformed/{.atlaspackrc → .parcelrc} +0 -0
  47. /package/test/fixtures/config-node-pipeline/{.atlaspackrc → .parcelrc} +0 -0
  48. /package/test/fixtures/config-plugin-not-found/{.atlaspackrc → .parcelrc} +0 -0
  49. /package/test/fixtures/local-plugin-config-pkg/node_modules/{atlaspack-config-local → parcel-config-local}/index.json +0 -0
  50. /package/test/fixtures/local-plugin-config-pkg/node_modules/{atlaspack-config-local → parcel-config-local}/local-plugin.js +0 -0
  51. /package/test/fixtures/plugins/node_modules/{atlaspack-transformer-bad-engines → parcel-transformer-bad-engines}/index.js +0 -0
  52. /package/test/fixtures/plugins/node_modules/{atlaspack-transformer-no-engines → parcel-transformer-no-engines}/index.js +0 -0
package/index.d.ts CHANGED
@@ -15,6 +15,14 @@ export class Atlaspack {
15
15
  ): Promise<AsyncSubscription>;
16
16
  }
17
17
 
18
+ export class Parcel {
19
+ constructor(options: InitialAtlaspackOptions);
20
+ run(): Promise<BuildSuccessEvent>;
21
+ watch(
22
+ cb?: (err: Error | null | undefined, buildEvent?: BuildEvent) => unknown,
23
+ ): Promise<AsyncSubscription>;
24
+ }
25
+
18
26
  export declare function createWorkerFarm(
19
27
  options?: Partial<FarmOptions>,
20
28
  ): WorkerFarm;
@@ -104,7 +104,7 @@ class AtlaspackConfig {
104
104
  }
105
105
  async getResolvers() {
106
106
  if (this.resolvers.length === 0) {
107
- throw await this.missingPluginError(this.resolvers, 'No resolver plugins specified in .atlaspackrc config', '/resolvers');
107
+ throw await this.missingPluginError(this.resolvers, 'No resolver plugins specified in .parcelrc config', '/resolvers');
108
108
  }
109
109
  return this.loadPlugins(this.resolvers);
110
110
  }
@@ -135,13 +135,13 @@ class AtlaspackConfig {
135
135
  }
136
136
  async getBundler() {
137
137
  if (!this.bundler) {
138
- throw await this.missingPluginError([], 'No bundler specified in .atlaspackrc config', '/bundler');
138
+ throw await this.missingPluginError([], 'No bundler specified in .parcelrc config', '/bundler');
139
139
  }
140
140
  return this.loadPlugin(this.bundler);
141
141
  }
142
142
  async getNamers() {
143
143
  if (this.namers.length === 0) {
144
- throw await this.missingPluginError(this.namers, 'No namer plugins specified in .atlaspackrc config', '/namers');
144
+ throw await this.missingPluginError(this.namers, 'No namer plugins specified in .parcelrc config', '/namers');
145
145
  }
146
146
  return this.loadPlugins(this.namers);
147
147
  }
@@ -21,20 +21,24 @@ function validatePackageName(pkg, pluginType, key) {
21
21
  return;
22
22
  }
23
23
  (0, _assert().default)(typeof pkg === 'string', `"${key}" must be a string`);
24
- if (pkg.startsWith('@atlaspack')) {
24
+
25
+ // Probably all of these need to be removed
26
+ if (pkg.startsWith('@atlaspack') || pkg.startsWith('@parcel')) {
25
27
  (0, _assert().default)(pkg.replace(/^@atlaspack\//, '').startsWith(`${pluginType}-`), `Official atlaspack ${pluginType} packages must be named according to "@atlaspack/${pluginType}-{name}"`);
26
28
  } else if (pkg.startsWith('@')) {
27
- // Disabling this validation to allow for migration to atlaspack
29
+ // Disabling this validation to allow for migration to parcel
28
30
  // let [scope, name] = pkg.split('/');
29
31
  // assert(
30
- // name.startsWith(`atlaspack-${pluginType}-`) ||
31
- // name === `atlaspack-${pluginType}` ||
32
+ // name.startsWith(`parcel-${pluginType}-`) ||
33
+ // name === `parcel-${pluginType}` ||
32
34
  // name.startsWith(`parcel-${pluginType}-`) ||
33
35
  // name === `parcel-${pluginType}`,
34
- // `Scoped atlaspack ${pluginType} packages must be named according to "${scope}/atlaspack-${pluginType}[-{name}]"`,
36
+ // `Scoped parcel ${pluginType} packages must be named according to "${scope}/parcel-${pluginType}[-{name}]"`,
35
37
  // );
36
38
  } else if (!pkg.startsWith('.')) {
37
- (0, _assert().default)(pkg.startsWith(`atlaspack-${pluginType}-`), `Atlaspack ${pluginType} packages must be named according to "atlaspack-${pluginType}-{name}"`);
39
+ (0, _assert().default)(pkg.startsWith(`parcel-${pluginType}-`) || pkg.startsWith(`atlaspack-${pluginType}`),
40
+ // let the error message be wrong for now
41
+ `Atlaspack ${pluginType} packages must be named according to "parcel-${pluginType}-{name}"`);
38
42
  }
39
43
  }
40
44
  const validatePluginName = (pluginType, key) => {
@@ -185,11 +185,11 @@ class BundleGraph {
185
185
  // code being generated).
186
186
  !node.usedSymbolsUp.has('*') &&
187
187
  // TODO We currently can't rename imports in async imports, e.g. from
188
- // (atlaspackRequire("...")).then(({ a }) => a);
188
+ // (parcelRequire("...")).then(({ a }) => a);
189
189
  // to
190
- // (atlaspackRequire("...")).then(({ a: b }) => a);
190
+ // (parcelRequire("...")).then(({ a: b }) => a);
191
191
  // or
192
- // (atlaspackRequire("...")).then((a)=>a);
192
+ // (parcelRequire("...")).then((a)=>a);
193
193
  // if the reexporting asset did `export {a as b}` or `export * as a`
194
194
  node.value.priority === _types.Priority.sync &&
195
195
  // For every asset, no symbol is imported multiple times (with a different local name).
@@ -388,7 +388,7 @@ class PackagerRunner {
388
388
  if (bundle.env.sourceMap && bundle.env.sourceMap.sourceRoot !== undefined) {
389
389
  sourceRoot = bundle.env.sourceMap.sourceRoot;
390
390
  } else if (this.options.serveOptions && bundle.target.env.context === 'browser') {
391
- sourceRoot = '/__atlaspack_source_root';
391
+ sourceRoot = '/__parcel_source_root';
392
392
  }
393
393
  if (bundle.env.sourceMap && bundle.env.sourceMap.inlineSources !== undefined) {
394
394
  inlineSources = bundle.env.sourceMap.inlineSources;
@@ -180,7 +180,7 @@ async function dumpGraphToGraphViz(graph, name, edgeTypes) {
180
180
  } else {
181
181
  const tempy = require('tempy');
182
182
  let tmp = tempy.file({
183
- name: `atlaspack-${name}.png`
183
+ name: `parcel-${name}.png`
184
184
  });
185
185
  await g.output('png', tmp);
186
186
  // eslint-disable-next-line no-console
package/lib/index.js CHANGED
@@ -11,6 +11,7 @@ var _exportNames = {
11
11
  serialize: true,
12
12
  deserialize: true,
13
13
  Atlaspack: true,
14
+ Parcel: true,
14
15
  BuildError: true,
15
16
  createWorkerFarm: true,
16
17
  INTERNAL_RESOLVE: true,
@@ -40,6 +41,12 @@ Object.defineProperty(exports, "INTERNAL_TRANSFORM", {
40
41
  return _Atlaspack.INTERNAL_TRANSFORM;
41
42
  }
42
43
  });
44
+ Object.defineProperty(exports, "Parcel", {
45
+ enumerable: true,
46
+ get: function () {
47
+ return _Atlaspack.default;
48
+ }
49
+ });
43
50
  Object.defineProperty(exports, "createWorkerFarm", {
44
51
  enumerable: true,
45
52
  get: function () {
@@ -66,22 +66,22 @@ async function loadPlugin(pluginName, configPath, keyPath, options) {
66
66
  }
67
67
  let configPkg = await (0, _utils().loadConfig)(options.inputFS, resolveFrom, ['package.json'], options.projectRoot);
68
68
  if (configPkg != null && ((_configPkg$config$dep = configPkg.config.dependencies) === null || _configPkg$config$dep === void 0 ? void 0 : _configPkg$config$dep[pluginName]) == null) {
69
- var _configPkg$config$atl;
69
+ var _configPkg$config$par;
70
70
  // If not in the config's dependencies, the plugin will be auto installed with
71
- // the version declared in "atlaspackDependencies".
72
- range = (_configPkg$config$atl = configPkg.config.atlaspackDependencies) === null || _configPkg$config$atl === void 0 ? void 0 : _configPkg$config$atl[pluginName];
71
+ // the version declared in "parcelDependencies".
72
+ range = (_configPkg$config$par = configPkg.config.parcelDependencies) === null || _configPkg$config$par === void 0 ? void 0 : _configPkg$config$par[pluginName];
73
73
  if (range == null) {
74
74
  let contents = await options.inputFS.readFile(configPkg.files[0].filePath, 'utf8');
75
75
  throw new (_diagnostic().default)({
76
76
  diagnostic: {
77
- message: (0, _diagnostic().md)`Could not determine version of ${pluginName} in ${_path().default.relative(process.cwd(), resolveFrom)}. Either include it in "dependencies" or "atlaspackDependencies".`,
77
+ message: (0, _diagnostic().md)`Could not determine version of ${pluginName} in ${_path().default.relative(process.cwd(), resolveFrom)}. Either include it in "dependencies" or "parcelDependencies".`,
78
78
  origin: '@atlaspack/core',
79
- codeFrames: configPkg.config.dependencies || configPkg.config.atlaspackDependencies ? [{
79
+ codeFrames: configPkg.config.dependencies || configPkg.config.parcelDependencies ? [{
80
80
  filePath: configPkg.files[0].filePath,
81
81
  language: 'json5',
82
82
  code: contents,
83
83
  codeHighlights: (0, _diagnostic().generateJSONCodeHighlights)(contents, [{
84
- key: configPkg.config.atlaspackDependencies ? '/atlaspackDependencies' : '/dependencies',
84
+ key: configPkg.config.parcelDependencies ? '/parcelDependencies' : '/dependencies',
85
85
  type: 'key'
86
86
  }])
87
87
  }] : undefined
@@ -4,17 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- let atlaspackOptionsToPluginOptions = new WeakMap();
7
+ let parcelOptionsToPluginOptions = new WeakMap();
8
8
  class PluginOptions {
9
9
  #options /*: AtlaspackOptions */;
10
10
 
11
11
  constructor(options) {
12
- let existing = atlaspackOptionsToPluginOptions.get(options);
12
+ let existing = parcelOptionsToPluginOptions.get(options);
13
13
  if (existing != null) {
14
14
  return existing;
15
15
  }
16
16
  this.#options = options;
17
- atlaspackOptionsToPluginOptions.set(options, this);
17
+ parcelOptionsToPluginOptions.set(options, this);
18
18
  return this;
19
19
  }
20
20
  get instanceId() {
@@ -26,8 +26,8 @@ class PluginOptions {
26
26
  get env() {
27
27
  return this.#options.env;
28
28
  }
29
- get atlaspackVersion() {
30
- return this.#options.atlaspackVersion;
29
+ get parcelVersion() {
30
+ return this.#options.parcelVersion;
31
31
  }
32
32
  get hmrOptions() {
33
33
  return this.#options.hmrOptions;
@@ -86,7 +86,7 @@ function createAtlaspackConfigRequest() {
86
86
  if (usedDefault) {
87
87
  let resolveFrom = getResolveFrom(options.inputFS, options.projectRoot);
88
88
  api.invalidateOnFileCreate({
89
- fileName: '.atlaspackrc',
89
+ fileName: '.parcelrc',
90
90
  aboveFilePath: (0, _projectPath.toProjectPath)(options.projectRoot, resolveFrom)
91
91
  });
92
92
  }
@@ -120,13 +120,13 @@ function getCachedAtlaspackConfig(result, options) {
120
120
  async function loadAtlaspackConfig(options) {
121
121
  let atlaspackConfig = await resolveAtlaspackConfig(options);
122
122
  if (!atlaspackConfig) {
123
- throw new Error('Could not find a .atlaspackrc');
123
+ throw new Error('Could not find a .parcelrc');
124
124
  }
125
125
  return atlaspackConfig;
126
126
  }
127
127
  async function resolveAtlaspackConfig(options) {
128
128
  let resolveFrom = getResolveFrom(options.inputFS, options.projectRoot);
129
- let configPath = options.config != null ? (await options.packageManager.resolve(options.config, resolveFrom)).resolved : await (0, _utils().resolveConfig)(options.inputFS, resolveFrom, ['.atlaspackrc'], options.projectRoot);
129
+ let configPath = options.config != null ? (await options.packageManager.resolve(options.config, resolveFrom)).resolved : await (0, _utils().resolveConfig)(options.inputFS, resolveFrom, ['.parcelrc'], options.projectRoot);
130
130
  let usedDefault = false;
131
131
  if (configPath == null && options.defaultConfig != null) {
132
132
  usedDefault = true;
@@ -141,7 +141,7 @@ async function resolveAtlaspackConfig(options) {
141
141
  } catch (e) {
142
142
  throw new (_diagnostic().default)({
143
143
  diagnostic: {
144
- message: (0, _diagnostic().md)`Could not find atlaspack config at ${_path().default.relative(options.projectRoot, configPath)}`,
144
+ message: (0, _diagnostic().md)`Could not find parcel config at ${_path().default.relative(options.projectRoot, configPath)}`,
145
145
  origin: '@atlaspack/core'
146
146
  }
147
147
  });
@@ -181,7 +181,7 @@ async function parseAndProcessConfig(configPath, contents, options) {
181
181
  };
182
182
  throw new (_diagnostic().default)({
183
183
  diagnostic: {
184
- message: `Failed to parse .atlaspackrc`,
184
+ message: `Failed to parse .parcelrc`,
185
185
  origin: '@atlaspack/core',
186
186
  codeFrames: [{
187
187
  filePath: configPath,
@@ -342,7 +342,7 @@ async function resolveExtends(ext, configPath, extendsKey, options) {
342
342
  let alternatives = await (0, _utils().findAlternativeNodeModules)(options.inputFS, ext, _path().default.dirname(configPath));
343
343
  throw new (_diagnostic().default)({
344
344
  diagnostic: {
345
- message: `Cannot find extended atlaspack config`,
345
+ message: `Cannot find extended parcel config`,
346
346
  origin: '@atlaspack/core',
347
347
  codeFrames: [{
348
348
  filePath: configPath,
@@ -368,7 +368,7 @@ async function processExtendedConfig(configPath, extendsKey, extendsSpecifier, r
368
368
  let alternatives = await (0, _utils().findAlternativeFiles)(options.inputFS, extendsSpecifier, _path().default.dirname(resolvedExtendedConfigPath), options.projectRoot);
369
369
  throw new (_diagnostic().default)({
370
370
  diagnostic: {
371
- message: 'Cannot find extended atlaspack config',
371
+ message: 'Cannot find extended parcel config',
372
372
  origin: '@atlaspack/core',
373
373
  codeFrames: [{
374
374
  filePath: configPath,
@@ -399,7 +399,7 @@ function validateConfigFile(config, relativePath) {
399
399
  _utils().validateSchema.diagnostic(_AtlaspackConfig.default, {
400
400
  data: config,
401
401
  filePath: relativePath
402
- }, '@atlaspack/core', 'Invalid Atlaspack Config');
402
+ }, '@atlaspack/core', 'Invalid Parcel Config');
403
403
  }
404
404
  function validateNotEmpty(config, relativePath) {
405
405
  _assert().default.notDeepStrictEqual(config, {}, `${relativePath} can't be empty`);
@@ -59,10 +59,10 @@ function _featureFlags() {
59
59
  var _constants = require("./constants");
60
60
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
61
61
  // Default cache directory name
62
- const DEFAULT_CACHE_DIRNAME = '.atlaspack-cache';
62
+ const DEFAULT_CACHE_DIRNAME = '.parcel-cache';
63
63
  const LOCK_FILE_NAMES = ['yarn.lock', 'package-lock.json', 'pnpm-lock.yaml'];
64
64
 
65
- // Generate a unique instanceId, will change on every run of atlaspack
65
+ // Generate a unique instanceId, will change on every run of parcel
66
66
  function generateInstanceId(entries) {
67
67
  return (0, _rust().hashString)(`${entries.join(',')}-${Date.now()}-${Math.round(Math.random() * 100)}`);
68
68
  }
@@ -196,7 +196,7 @@ async function resolveOptions(initialOptions) {
196
196
  ..._featureFlags().DEFAULT_FEATURE_FLAGS,
197
197
  ...(initialOptions === null || initialOptions === void 0 ? void 0 : initialOptions.featureFlags)
198
198
  },
199
- atlaspackVersion: _constants.ATLASPACK_VERSION
199
+ parcelVersion: _constants.ATLASPACK_VERSION
200
200
  };
201
201
  }
202
202
  function getRelativeConfigSpecifier(fs, projectRoot, specifier) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/core",
3
- "version": "2.12.1-dev.3368+af1db7f65",
3
+ "version": "2.12.1-dev.3401+b483af77f",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -20,20 +20,20 @@
20
20
  "check-ts": "tsc --noEmit index.d.ts"
21
21
  },
22
22
  "dependencies": {
23
- "@atlaspack/cache": "2.12.1-dev.3368+af1db7f65",
24
- "@atlaspack/diagnostic": "2.12.1-dev.3368+af1db7f65",
25
- "@atlaspack/events": "2.12.1-dev.3368+af1db7f65",
26
- "@atlaspack/feature-flags": "2.12.1-dev.3368+af1db7f65",
27
- "@atlaspack/fs": "2.12.1-dev.3368+af1db7f65",
28
- "@atlaspack/graph": "3.2.1-dev.3368+af1db7f65",
29
- "@atlaspack/logger": "2.12.1-dev.3368+af1db7f65",
30
- "@atlaspack/package-manager": "2.12.1-dev.3368+af1db7f65",
31
- "@atlaspack/plugin": "2.12.1-dev.3368+af1db7f65",
32
- "@atlaspack/profiler": "2.12.1-dev.3368+af1db7f65",
33
- "@atlaspack/rust": "2.12.1-dev.3368+af1db7f65",
34
- "@atlaspack/types": "2.12.1-dev.3368+af1db7f65",
35
- "@atlaspack/utils": "2.12.1-dev.3368+af1db7f65",
36
- "@atlaspack/workers": "2.12.1-dev.3368+af1db7f65",
23
+ "@atlaspack/cache": "2.12.1-dev.3401+b483af77f",
24
+ "@atlaspack/diagnostic": "2.12.1-dev.3401+b483af77f",
25
+ "@atlaspack/events": "2.12.1-dev.3401+b483af77f",
26
+ "@atlaspack/feature-flags": "2.12.1-dev.3401+b483af77f",
27
+ "@atlaspack/fs": "2.12.1-dev.3401+b483af77f",
28
+ "@atlaspack/graph": "3.2.1-dev.3401+b483af77f",
29
+ "@atlaspack/logger": "2.12.1-dev.3401+b483af77f",
30
+ "@atlaspack/package-manager": "2.12.1-dev.3401+b483af77f",
31
+ "@atlaspack/plugin": "2.12.1-dev.3401+b483af77f",
32
+ "@atlaspack/profiler": "2.12.1-dev.3401+b483af77f",
33
+ "@atlaspack/rust": "2.12.1-dev.3401+b483af77f",
34
+ "@atlaspack/types": "2.12.1-dev.3401+b483af77f",
35
+ "@atlaspack/utils": "2.12.1-dev.3401+b483af77f",
36
+ "@atlaspack/workers": "2.12.1-dev.3401+b483af77f",
37
37
  "@mischnic/json-sourcemap": "^0.1.0",
38
38
  "@parcel/source-map": "^2.1.1",
39
39
  "base-x": "^3.0.8",
@@ -55,5 +55,5 @@
55
55
  "browser": {
56
56
  "./src/serializerCore.js": "./src/serializerCore.browser.js"
57
57
  },
58
- "gitHead": "af1db7f65c4816917ddf83716deedc536a1b8b27"
58
+ "gitHead": "b483af77f02d1258c8dad156e097b94f83671d8e"
59
59
  }
@@ -161,7 +161,7 @@ export default class AtlaspackConfig {
161
161
  if (this.resolvers.length === 0) {
162
162
  throw await this.missingPluginError(
163
163
  this.resolvers,
164
- 'No resolver plugins specified in .atlaspackrc config',
164
+ 'No resolver plugins specified in .parcelrc config',
165
165
  '/resolvers',
166
166
  );
167
167
  }
@@ -225,7 +225,7 @@ export default class AtlaspackConfig {
225
225
  if (!this.bundler) {
226
226
  throw await this.missingPluginError(
227
227
  [],
228
- 'No bundler specified in .atlaspackrc config',
228
+ 'No bundler specified in .parcelrc config',
229
229
  '/bundler',
230
230
  );
231
231
  }
@@ -237,7 +237,7 @@ export default class AtlaspackConfig {
237
237
  if (this.namers.length === 0) {
238
238
  throw await this.missingPluginError(
239
239
  this.namers,
240
- 'No namer plugins specified in .atlaspackrc config',
240
+ 'No namer plugins specified in .parcelrc config',
241
241
  '/namers',
242
242
  );
243
243
  }
@@ -17,25 +17,28 @@ export function validatePackageName(
17
17
 
18
18
  assert(typeof pkg === 'string', `"${key}" must be a string`);
19
19
 
20
- if (pkg.startsWith('@atlaspack')) {
20
+ // Probably all of these need to be removed
21
+ if (pkg.startsWith('@atlaspack') || pkg.startsWith('@parcel')) {
21
22
  assert(
22
23
  pkg.replace(/^@atlaspack\//, '').startsWith(`${pluginType}-`),
23
24
  `Official atlaspack ${pluginType} packages must be named according to "@atlaspack/${pluginType}-{name}"`,
24
25
  );
25
26
  } else if (pkg.startsWith('@')) {
26
- // Disabling this validation to allow for migration to atlaspack
27
+ // Disabling this validation to allow for migration to parcel
27
28
  // let [scope, name] = pkg.split('/');
28
29
  // assert(
29
- // name.startsWith(`atlaspack-${pluginType}-`) ||
30
- // name === `atlaspack-${pluginType}` ||
30
+ // name.startsWith(`parcel-${pluginType}-`) ||
31
+ // name === `parcel-${pluginType}` ||
31
32
  // name.startsWith(`parcel-${pluginType}-`) ||
32
33
  // name === `parcel-${pluginType}`,
33
- // `Scoped atlaspack ${pluginType} packages must be named according to "${scope}/atlaspack-${pluginType}[-{name}]"`,
34
+ // `Scoped parcel ${pluginType} packages must be named according to "${scope}/parcel-${pluginType}[-{name}]"`,
34
35
  // );
35
36
  } else if (!pkg.startsWith('.')) {
36
37
  assert(
37
- pkg.startsWith(`atlaspack-${pluginType}-`),
38
- `Atlaspack ${pluginType} packages must be named according to "atlaspack-${pluginType}-{name}"`,
38
+ pkg.startsWith(`parcel-${pluginType}-`) ||
39
+ pkg.startsWith(`atlaspack-${pluginType}`),
40
+ // let the error message be wrong for now
41
+ `Atlaspack ${pluginType} packages must be named according to "parcel-${pluginType}-{name}"`,
39
42
  );
40
43
  }
41
44
  }
@@ -246,11 +246,11 @@ export default class BundleGraph {
246
246
  // code being generated).
247
247
  !node.usedSymbolsUp.has('*') &&
248
248
  // TODO We currently can't rename imports in async imports, e.g. from
249
- // (atlaspackRequire("...")).then(({ a }) => a);
249
+ // (parcelRequire("...")).then(({ a }) => a);
250
250
  // to
251
- // (atlaspackRequire("...")).then(({ a: b }) => a);
251
+ // (parcelRequire("...")).then(({ a: b }) => a);
252
252
  // or
253
- // (atlaspackRequire("...")).then((a)=>a);
253
+ // (parcelRequire("...")).then((a)=>a);
254
254
  // if the reexporting asset did `export {a as b}` or `export * as a`
255
255
  node.value.priority === Priority.sync &&
256
256
  // For every asset, no symbol is imported multiple times (with a different local name).
@@ -586,7 +586,7 @@ export default class PackagerRunner {
586
586
  this.options.serveOptions &&
587
587
  bundle.target.env.context === 'browser'
588
588
  ) {
589
- sourceRoot = '/__atlaspack_source_root';
589
+ sourceRoot = '/__parcel_source_root';
590
590
  }
591
591
 
592
592
  if (
@@ -216,7 +216,7 @@ export default async function dumpGraphToGraphViz(
216
216
  globalThis.ATLASPACK_DUMP_GRAPHVIZ?.(name, g.to_dot());
217
217
  } else {
218
218
  const tempy = require('tempy');
219
- let tmp = tempy.file({name: `atlaspack-${name}.png`});
219
+ let tmp = tempy.file({name: `parcel-${name}.png`});
220
220
  await g.output('png', tmp);
221
221
  // eslint-disable-next-line no-console
222
222
  console.log('Dumped', tmp);
package/src/index.js CHANGED
@@ -13,6 +13,7 @@ export {
13
13
  export {
14
14
  default,
15
15
  default as Atlaspack,
16
+ default as Parcel,
16
17
  BuildError,
17
18
  createWorkerFarm,
18
19
  INTERNAL_RESOLVE,
@@ -78,8 +78,8 @@ export default async function loadPlugin<T>(
78
78
  configPkg.config.dependencies?.[pluginName] == null
79
79
  ) {
80
80
  // If not in the config's dependencies, the plugin will be auto installed with
81
- // the version declared in "atlaspackDependencies".
82
- range = configPkg.config.atlaspackDependencies?.[pluginName];
81
+ // the version declared in "parcelDependencies".
82
+ range = configPkg.config.parcelDependencies?.[pluginName];
83
83
 
84
84
  if (range == null) {
85
85
  let contents = await options.inputFS.readFile(
@@ -91,11 +91,11 @@ export default async function loadPlugin<T>(
91
91
  message: md`Could not determine version of ${pluginName} in ${path.relative(
92
92
  process.cwd(),
93
93
  resolveFrom,
94
- )}. Either include it in "dependencies" or "atlaspackDependencies".`,
94
+ )}. Either include it in "dependencies" or "parcelDependencies".`,
95
95
  origin: '@atlaspack/core',
96
96
  codeFrames:
97
97
  configPkg.config.dependencies ||
98
- configPkg.config.atlaspackDependencies
98
+ configPkg.config.parcelDependencies
99
99
  ? [
100
100
  {
101
101
  filePath: configPkg.files[0].filePath,
@@ -103,8 +103,8 @@ export default async function loadPlugin<T>(
103
103
  code: contents,
104
104
  codeHighlights: generateJSONCodeHighlights(contents, [
105
105
  {
106
- key: configPkg.config.atlaspackDependencies
107
- ? '/atlaspackDependencies'
106
+ key: configPkg.config.parcelDependencies
107
+ ? '/parcelDependencies'
108
108
  : '/dependencies',
109
109
  type: 'key',
110
110
  },
@@ -173,18 +173,18 @@ export default async function loadPlugin<T>(
173
173
  // Remove plugin version compatiblility validation in canary builds as they don't use semver
174
174
  if (!process.env.SKIP_PLUGIN_COMPATIBILITY_CHECK) {
175
175
  if (!pluginName.startsWith('.')) {
176
- // Validate the engines.atlaspack field in the plugin's package.json
177
- let atlaspackVersionRange = pkg && pkg.engines && pkg.engines.atlaspack;
178
- if (!atlaspackVersionRange) {
176
+ // Validate the engines.parcel field in the plugin's package.json
177
+ let parcelVersionRange = pkg && pkg.engines && pkg.engines.parcel;
178
+ if (!parcelVersionRange) {
179
179
  logger.warn({
180
180
  origin: '@atlaspack/core',
181
- message: `The plugin "${pluginName}" needs to specify a \`package.json#engines.atlaspack\` field with the supported Atlaspack version range.`,
181
+ message: `The plugin "${pluginName}" needs to specify a \`package.json#engines.parcel\` field with the supported Atlaspack version range.`,
182
182
  });
183
183
  }
184
184
 
185
185
  if (
186
- atlaspackVersionRange &&
187
- !semver.satisfies(ATLASPACK_VERSION, atlaspackVersionRange)
186
+ parcelVersionRange &&
187
+ !semver.satisfies(ATLASPACK_VERSION, parcelVersionRange)
188
188
  ) {
189
189
  let pkgFile = nullthrows(
190
190
  await resolveConfig(
@@ -197,7 +197,7 @@ export default async function loadPlugin<T>(
197
197
  let pkgContents = await options.inputFS.readFile(pkgFile, 'utf8');
198
198
  throw new ThrowableDiagnostic({
199
199
  diagnostic: {
200
- message: md`The plugin "${pluginName}" is not compatible with the current version of Atlaspack. Requires "${atlaspackVersionRange}" but the current version is "${ATLASPACK_VERSION}".`,
200
+ message: md`The plugin "${pluginName}" is not compatible with the current version of Atlaspack. Requires "${parcelVersionRange}" but the current version is "${ATLASPACK_VERSION}".`,
201
201
  origin: '@atlaspack/core',
202
202
  codeFrames: [
203
203
  {
@@ -206,7 +206,7 @@ export default async function loadPlugin<T>(
206
206
  code: pkgContents,
207
207
  codeHighlights: generateJSONCodeHighlights(pkgContents, [
208
208
  {
209
- key: '/engines/atlaspack',
209
+ key: '/engines/parcel',
210
210
  },
211
211
  ]),
212
212
  },
@@ -14,20 +14,20 @@ import type {PackageManager} from '@atlaspack/package-manager';
14
14
  import type {AtlaspackOptions} from '../types';
15
15
  import {type FeatureFlags} from '@atlaspack/feature-flags';
16
16
 
17
- let atlaspackOptionsToPluginOptions: WeakMap<AtlaspackOptions, PluginOptions> =
17
+ let parcelOptionsToPluginOptions: WeakMap<AtlaspackOptions, PluginOptions> =
18
18
  new WeakMap();
19
19
 
20
20
  export default class PluginOptions implements IPluginOptions {
21
21
  #options /*: AtlaspackOptions */;
22
22
 
23
23
  constructor(options: AtlaspackOptions): PluginOptions {
24
- let existing = atlaspackOptionsToPluginOptions.get(options);
24
+ let existing = parcelOptionsToPluginOptions.get(options);
25
25
  if (existing != null) {
26
26
  return existing;
27
27
  }
28
28
 
29
29
  this.#options = options;
30
- atlaspackOptionsToPluginOptions.set(options, this);
30
+ parcelOptionsToPluginOptions.set(options, this);
31
31
  return this;
32
32
  }
33
33
 
@@ -43,8 +43,8 @@ export default class PluginOptions implements IPluginOptions {
43
43
  return this.#options.env;
44
44
  }
45
45
 
46
- get atlaspackVersion(): string {
47
- return this.#options.atlaspackVersion;
46
+ get parcelVersion(): string {
47
+ return this.#options.parcelVersion;
48
48
  }
49
49
 
50
50
  get hmrOptions(): ?HMROptions {
@@ -98,7 +98,7 @@ export default function createAtlaspackConfigRequest(): AtlaspackConfigRequest {
98
98
  if (usedDefault) {
99
99
  let resolveFrom = getResolveFrom(options.inputFS, options.projectRoot);
100
100
  api.invalidateOnFileCreate({
101
- fileName: '.atlaspackrc',
101
+ fileName: '.parcelrc',
102
102
  aboveFilePath: toProjectPath(options.projectRoot, resolveFrom),
103
103
  });
104
104
  }
@@ -137,7 +137,7 @@ export async function loadAtlaspackConfig(
137
137
  let atlaspackConfig = await resolveAtlaspackConfig(options);
138
138
 
139
139
  if (!atlaspackConfig) {
140
- throw new Error('Could not find a .atlaspackrc');
140
+ throw new Error('Could not find a .parcelrc');
141
141
  }
142
142
 
143
143
  return atlaspackConfig;
@@ -154,7 +154,7 @@ export async function resolveAtlaspackConfig(
154
154
  : await resolveConfig(
155
155
  options.inputFS,
156
156
  resolveFrom,
157
- ['.atlaspackrc'],
157
+ ['.parcelrc'],
158
158
  options.projectRoot,
159
159
  );
160
160
 
@@ -176,7 +176,7 @@ export async function resolveAtlaspackConfig(
176
176
  } catch (e) {
177
177
  throw new ThrowableDiagnostic({
178
178
  diagnostic: {
179
- message: md`Could not find atlaspack config at ${path.relative(
179
+ message: md`Could not find parcel config at ${path.relative(
180
180
  options.projectRoot,
181
181
  configPath,
182
182
  )}`,
@@ -224,7 +224,7 @@ export async function parseAndProcessConfig(
224
224
  };
225
225
  throw new ThrowableDiagnostic({
226
226
  diagnostic: {
227
- message: `Failed to parse .atlaspackrc`,
227
+ message: `Failed to parse .parcelrc`,
228
228
  origin: '@atlaspack/core',
229
229
 
230
230
  codeFrames: [
@@ -498,7 +498,7 @@ export async function resolveExtends(
498
498
  );
499
499
  throw new ThrowableDiagnostic({
500
500
  diagnostic: {
501
- message: `Cannot find extended atlaspack config`,
501
+ message: `Cannot find extended parcel config`,
502
502
  origin: '@atlaspack/core',
503
503
  codeFrames: [
504
504
  {
@@ -547,7 +547,7 @@ async function processExtendedConfig(
547
547
  );
548
548
  throw new ThrowableDiagnostic({
549
549
  diagnostic: {
550
- message: 'Cannot find extended atlaspack config',
550
+ message: 'Cannot find extended parcel config',
551
551
  origin: '@atlaspack/core',
552
552
  codeFrames: [
553
553
  {
@@ -591,7 +591,7 @@ export function validateConfigFile(
591
591
  AtlaspackConfigSchema,
592
592
  {data: config, filePath: relativePath},
593
593
  '@atlaspack/core',
594
- 'Invalid Atlaspack Config',
594
+ 'Invalid Parcel Config',
595
595
  );
596
596
  }
597
597