@atlaspack/core 2.16.2-dev.55 → 2.16.2-dev.69

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 (89) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/_empty.js +0 -0
  3. package/lib/AssetGraph.js +17 -6
  4. package/lib/Atlaspack.js +2 -5
  5. package/lib/AtlaspackConfig.schema.js +1 -7
  6. package/lib/BundleGraph.js +10 -8
  7. package/lib/Dependency.js +6 -2
  8. package/lib/Environment.js +4 -3
  9. package/lib/EnvironmentManager.js +137 -0
  10. package/lib/InternalConfig.js +3 -2
  11. package/lib/PackagerRunner.js +15 -9
  12. package/lib/RequestTracker.js +56 -46
  13. package/lib/Transformation.js +2 -2
  14. package/lib/UncommittedAsset.js +3 -2
  15. package/lib/applyRuntimes.js +2 -1
  16. package/lib/assetUtils.js +2 -1
  17. package/lib/atlaspack-v3/AtlaspackV3.js +44 -1
  18. package/lib/atlaspack-v3/NapiWorkerPool.js +1 -1
  19. package/lib/atlaspack-v3/worker/compat/environment.js +2 -2
  20. package/lib/atlaspack-v3/worker/compat/mutable-asset.js +6 -6
  21. package/lib/atlaspack-v3/worker/compat/plugin-config.js +5 -5
  22. package/lib/atlaspack-v3/worker/napi-worker.js +3 -0
  23. package/lib/atlaspack-v3/worker/worker.js +11 -4
  24. package/lib/dumpGraphToGraphViz.js +1 -1
  25. package/lib/index.js +9 -1
  26. package/lib/internal-plugins.js +9 -0
  27. package/lib/isSuperPackage.js +23 -0
  28. package/lib/loadAtlaspackPlugin.js +15 -0
  29. package/lib/public/Asset.js +3 -2
  30. package/lib/public/Bundle.js +2 -1
  31. package/lib/public/Config.js +86 -19
  32. package/lib/public/Dependency.js +2 -1
  33. package/lib/public/MutableBundleGraph.js +2 -1
  34. package/lib/public/PluginOptions.js +3 -0
  35. package/lib/public/Target.js +2 -1
  36. package/lib/requests/AssetRequest.js +2 -1
  37. package/lib/requests/AtlaspackConfigRequest.js +44 -29
  38. package/lib/requests/ConfigRequest.js +27 -4
  39. package/lib/requests/TargetRequest.js +18 -16
  40. package/lib/requests/WriteBundleRequest.js +5 -2
  41. package/lib/requests/WriteBundlesRequest.js +1 -0
  42. package/lib/resolveOptions.js +5 -4
  43. package/lib/worker.js +9 -26
  44. package/package.json +21 -18
  45. package/src/AssetGraph.js +12 -6
  46. package/src/Atlaspack.js +8 -7
  47. package/src/BundleGraph.js +21 -9
  48. package/src/Dependency.js +13 -5
  49. package/src/Environment.js +8 -5
  50. package/src/EnvironmentManager.js +145 -0
  51. package/src/InternalConfig.js +6 -5
  52. package/src/PackagerRunner.js +17 -11
  53. package/src/RequestTracker.js +39 -13
  54. package/src/UncommittedAsset.js +7 -2
  55. package/src/applyRuntimes.js +6 -1
  56. package/src/assetUtils.js +4 -3
  57. package/src/atlaspack-v3/AtlaspackV3.js +53 -2
  58. package/src/atlaspack-v3/NapiWorkerPool.js +5 -1
  59. package/src/atlaspack-v3/worker/compat/plugin-config.js +1 -1
  60. package/src/atlaspack-v3/worker/worker.js +11 -4
  61. package/src/index.js +2 -0
  62. package/src/internal-plugins.js +4 -0
  63. package/src/isSuperPackage.js +28 -0
  64. package/src/loadAtlaspackPlugin.js +23 -1
  65. package/src/public/Asset.js +9 -2
  66. package/src/public/Bundle.js +2 -1
  67. package/src/public/Config.js +110 -29
  68. package/src/public/Dependency.js +2 -1
  69. package/src/public/MutableBundleGraph.js +2 -1
  70. package/src/public/PluginOptions.js +4 -0
  71. package/src/public/Target.js +2 -1
  72. package/src/requests/AssetRequest.js +2 -1
  73. package/src/requests/AtlaspackConfigRequest.js +77 -31
  74. package/src/requests/ConfigRequest.js +33 -9
  75. package/src/requests/TargetRequest.js +19 -25
  76. package/src/requests/WriteBundleRequest.js +6 -7
  77. package/src/requests/WriteBundlesRequest.js +1 -0
  78. package/src/resolveOptions.js +2 -0
  79. package/src/types.js +10 -7
  80. package/src/worker.js +8 -7
  81. package/test/Environment.test.js +43 -34
  82. package/test/EnvironmentManager.test.js +192 -0
  83. package/test/PublicEnvironment.test.js +10 -7
  84. package/test/RequestTracker.test.js +1 -4
  85. package/test/public/Config.test.js +108 -0
  86. package/test/requests/ConfigRequest.test.js +187 -3
  87. package/test/test-utils.js +3 -2
  88. package/lib/atlaspack-v3/worker/index.js +0 -6
  89. /package/src/atlaspack-v3/worker/{index.js → napi-worker.js} +0 -0
@@ -27,6 +27,7 @@ import {
27
27
  } from '../types';
28
28
  import {fromProjectPath} from '../projectPath';
29
29
  import {fromInternalSourceLocation} from '../utils';
30
+ import {fromEnvironmentId} from '../EnvironmentManager';
30
31
 
31
32
  const SpecifierTypeNames = Object.keys(SpecifierTypeMap);
32
33
  const PriorityNames = Object.keys(Priority);
@@ -112,7 +113,7 @@ export default class Dependency implements IDependency {
112
113
  }
113
114
 
114
115
  get env(): IEnvironment {
115
- return new Environment(this.#dep.env, this.#options);
116
+ return new Environment(fromEnvironmentId(this.#dep.env), this.#options);
116
117
  }
117
118
 
118
119
  get packageConditions(): ?Array<string> {
@@ -32,6 +32,7 @@ import {BundleBehavior} from '../types';
32
32
  import BundleGroup, {bundleGroupToInternalBundleGroup} from './BundleGroup';
33
33
  import type {ProjectPath} from '../projectPath';
34
34
  import {identifierRegistry} from '../IdentifierRegistry';
35
+ import {toEnvironmentRef} from '../EnvironmentManager';
35
36
 
36
37
  function createBundleId(data: {|
37
38
  entryAssetId: string | null,
@@ -236,7 +237,7 @@ export default class MutableBundleGraph
236
237
  : bundleId.slice(-8),
237
238
  type: opts.entryAsset ? opts.entryAsset.type : opts.type,
238
239
  env: opts.env
239
- ? environmentToInternalEnvironment(opts.env)
240
+ ? toEnvironmentRef(environmentToInternalEnvironment(opts.env))
240
241
  : nullthrows(entryAsset).env,
241
242
  entryAssetIds: entryAsset ? [entryAsset.id] : [],
242
243
  mainEntryId: entryAsset?.id,
@@ -47,6 +47,10 @@ 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
+
50
54
  get hmrOptions(): ?HMROptions {
51
55
  return this.#options.hmrOptions;
52
56
  }
@@ -11,6 +11,7 @@ import nullthrows from 'nullthrows';
11
11
  import Environment from './Environment';
12
12
  import {fromProjectPath} from '../projectPath';
13
13
  import {fromInternalSourceLocation} from '../utils';
14
+ import {fromEnvironmentId} from '../EnvironmentManager';
14
15
 
15
16
  const inspect = Symbol.for('nodejs.util.inspect.custom');
16
17
 
@@ -46,7 +47,7 @@ export default class Target implements ITarget {
46
47
  }
47
48
 
48
49
  get env(): IEnvironment {
49
- return new Environment(this.#target.env, this.#options);
50
+ return new Environment(fromEnvironmentId(this.#target.env), this.#options);
50
51
  }
51
52
 
52
53
  get name(): string {
@@ -21,6 +21,7 @@ import {fromProjectPath, fromProjectPathRelative} from '../projectPath';
21
21
  import {report} from '../ReporterRunner';
22
22
  import {requestTypes} from '../RequestTracker';
23
23
  import type {DevDepRequestResult} from './DevDepRequest';
24
+ import {toEnvironmentId} from '../EnvironmentManager';
24
25
 
25
26
  type RunInput<TResult> = {|
26
27
  input: AssetRequestInput,
@@ -51,7 +52,7 @@ function getId(input: AssetRequestInput) {
51
52
  return hashString(
52
53
  type +
53
54
  fromProjectPathRelative(input.filePath) +
54
- input.env.id +
55
+ toEnvironmentId(input.env) +
55
56
  String(input.isSource) +
56
57
  String(input.sideEffects) +
57
58
  (input.code ?? '') +
@@ -30,15 +30,17 @@ import ThrowableDiagnostic, {
30
30
  md,
31
31
  errorToDiagnostic,
32
32
  } from '@atlaspack/diagnostic';
33
- import {parse} from 'json5';
33
+ import json5 from 'json5';
34
34
  import path from 'path';
35
35
  import invariant from 'assert';
36
36
 
37
+ import atlaspackInternalPlugins from '../internal-plugins';
37
38
  import {AtlaspackConfig} from '../AtlaspackConfig';
38
39
  import AtlaspackConfigSchema from '../AtlaspackConfig.schema';
39
40
  import {toProjectPath} from '../projectPath';
40
41
  import {requestTypes} from '../RequestTracker';
41
42
  import {optionsProxy} from '../utils';
43
+ import {isSuperPackage} from '../isSuperPackage';
42
44
 
43
45
  type ConfigMap<K, V> = {[K]: V, ...};
44
46
 
@@ -159,34 +161,60 @@ export async function resolveAtlaspackConfig(
159
161
  );
160
162
 
161
163
  let usedDefault = false;
162
- if (configPath == null && options.defaultConfig != null) {
164
+ let config, extendedFiles;
165
+
166
+ if (
167
+ configPath == null &&
168
+ options.defaultConfig != null &&
169
+ isSuperPackage() &&
170
+ options.defaultConfig.endsWith('.js')
171
+ ) {
163
172
  usedDefault = true;
164
- configPath = (
165
- await options.packageManager.resolve(options.defaultConfig, resolveFrom)
166
- ).resolved;
167
- }
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;
168
185
 
169
- if (configPath == null) {
170
- return null;
171
- }
186
+ configPath = (
187
+ await options.packageManager.resolve(options.defaultConfig, resolveFrom)
188
+ ).resolved;
189
+ }
172
190
 
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
- });
186
- }
191
+ if (configPath == null) {
192
+ return null;
193
+ }
194
+
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
+ }
187
209
 
188
- let {config, extendedFiles}: AtlaspackConfigChain =
189
- await parseAndProcessConfig(configPath, contents, options);
210
+ let result: AtlaspackConfigChain = await parseAndProcessConfig(
211
+ configPath,
212
+ contents,
213
+ options,
214
+ );
215
+ config = result.config;
216
+ extendedFiles = result.extendedFiles;
217
+ }
190
218
 
191
219
  if (options.additionalReporters.length > 0) {
192
220
  config.reporters = [
@@ -216,7 +244,7 @@ export async function parseAndProcessConfig(
216
244
  ): Promise<AtlaspackConfigChain> {
217
245
  let config: RawAtlaspackConfig;
218
246
  try {
219
- config = parse(contents);
247
+ config = json5.parse(contents);
220
248
  } catch (e) {
221
249
  let pos = {
222
250
  line: e.lineNumber,
@@ -446,11 +474,29 @@ export async function processConfigChain(
446
474
  let key = Array.isArray(configFile.extends)
447
475
  ? `/extends/${i}`
448
476
  : '/extends';
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);
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
+ }
454
500
  extStartConfig = extStartConfig
455
501
  ? mergeConfigs(extStartConfig, nextConfig)
456
502
  : nextConfig;
@@ -63,7 +63,7 @@ export type ConfigRequest = {
63
63
  invalidateOnFileChange: Set<ProjectPath>,
64
64
  invalidateOnConfigKeyChange: Array<{|
65
65
  filePath: ProjectPath,
66
- configKey: string,
66
+ configKey: string[],
67
67
  |}>,
68
68
  invalidateOnFileCreate: Array<InternalFileCreateInvalidation>,
69
69
  invalidateOnEnvChange: Set<string>,
@@ -108,34 +108,58 @@ export async function loadPluginConfig<T: PluginWithLoadConfig>(
108
108
  }
109
109
  }
110
110
 
111
+ /**
112
+ * Return value at a given key path within an object.
113
+ *
114
+ * @example
115
+ * const obj = { a: { b: { c: 'd' } } };
116
+ * getValueAtPath(obj, ['a', 'b', 'c']); // 'd'
117
+ * getValueAtPath(obj, ['a', 'b', 'd']); // undefined
118
+ * getValueAtPath(obj, ['a', 'b']); // { c: 'd' }
119
+ * getValueAtPath(obj, ['a', 'b', 'c', 'd']); // undefined
120
+ */
121
+ export function getValueAtPath(obj: Object, key: string[]): any {
122
+ let current = obj;
123
+ for (let part of key) {
124
+ if (current == null) {
125
+ return undefined;
126
+ }
127
+ current = current[part];
128
+ }
129
+ return current;
130
+ }
131
+
111
132
  const configKeyCache = createBuildCache();
112
133
 
113
134
  export async function getConfigKeyContentHash(
114
135
  filePath: ProjectPath,
115
- configKey: string,
136
+ configKey: string[],
116
137
  options: AtlaspackOptions,
117
138
  ): Async<string> {
118
- let cacheKey = `${fromProjectPathRelative(filePath)}:${configKey}`;
139
+ let cacheKey = `${fromProjectPathRelative(filePath)}:${JSON.stringify(
140
+ configKey,
141
+ )}`;
119
142
  let cachedValue = configKeyCache.get(cacheKey);
120
143
 
121
144
  if (cachedValue) {
122
145
  return cachedValue;
123
146
  }
124
147
 
125
- let conf = await readConfig(
148
+ const conf = await readConfig(
126
149
  options.inputFS,
127
150
  fromProjectPath(options.projectRoot, filePath),
128
151
  );
129
152
 
130
- if (conf == null || conf.config[configKey] == null) {
153
+ const value = getValueAtPath(conf?.config, configKey);
154
+ if (conf == null || value == null) {
131
155
  // This can occur when a config key has been removed entirely during `respondToFSEvents`
132
156
  return '';
133
157
  }
134
158
 
135
- let contentHash =
136
- typeof conf.config[configKey] === 'object'
137
- ? hashObject(conf.config[configKey])
138
- : hashString(JSON.stringify(conf.config[configKey]));
159
+ const contentHash =
160
+ typeof value === 'object'
161
+ ? hashObject(value)
162
+ : hashString(JSON.stringify(value));
139
163
 
140
164
  configKeyCache.set(cacheKey, contentHash);
141
165
 
@@ -49,6 +49,7 @@ import {BROWSER_ENVS} from '../public/Environment';
49
49
  import {optionsProxy, toInternalSourceLocation} from '../utils';
50
50
  import {fromProjectPath, toProjectPath, joinProjectPath} from '../projectPath';
51
51
  import {requestTypes} from '../RequestTracker';
52
+ import {fromEnvironmentId} from '../EnvironmentManager';
52
53
 
53
54
  type RunOpts<TResult> = {|
54
55
  input: Entry,
@@ -345,7 +346,7 @@ export class TargetResolver {
345
346
  },
346
347
  });
347
348
  }
348
- if (!BROWSER_ENVS.has(targets[0].env.context)) {
349
+ if (!BROWSER_ENVS.has(fromEnvironmentId(targets[0].env).context)) {
349
350
  throw new ThrowableDiagnostic({
350
351
  diagnostic: {
351
352
  message: `Only browser targets are supported in serve mode`,
@@ -1491,21 +1492,22 @@ async function debugResolvedTargets(input, targets, targetInfo, options) {
1491
1492
 
1492
1493
  // Resolve relevant engines for context.
1493
1494
  let engines;
1494
- switch (target.env.context) {
1495
+ const env = fromEnvironmentId(target.env);
1496
+ switch (env.context) {
1495
1497
  case 'browser':
1496
1498
  case 'web-worker':
1497
1499
  case 'service-worker':
1498
1500
  case 'worklet': {
1499
- let browsers = target.env.engines.browsers;
1501
+ let browsers = env.engines.browsers;
1500
1502
  engines = Array.isArray(browsers) ? browsers.join(', ') : browsers;
1501
1503
  break;
1502
1504
  }
1503
1505
  case 'node':
1504
- engines = target.env.engines.node;
1506
+ engines = env.engines.node;
1505
1507
  break;
1506
1508
  case 'electron-main':
1507
1509
  case 'electron-renderer':
1508
- engines = target.env.engines.electron;
1510
+ engines = env.engines.electron;
1509
1511
  break;
1510
1512
  }
1511
1513
 
@@ -1547,9 +1549,7 @@ async function debugResolvedTargets(input, targets, targetInfo, options) {
1547
1549
  }
1548
1550
 
1549
1551
  if (keyInfo.inferred) {
1550
- highlight.inferred.push(
1551
- md`${key} to be ${JSON.stringify(target.env[key])}`,
1552
- );
1552
+ highlight.inferred.push(md`${key} to be ${JSON.stringify(env[key])}`);
1553
1553
  }
1554
1554
  }
1555
1555
 
@@ -1578,22 +1578,20 @@ async function debugResolvedTargets(input, targets, targetInfo, options) {
1578
1578
 
1579
1579
  // Format includeNodeModules to be human readable.
1580
1580
  let includeNodeModules;
1581
- if (typeof target.env.includeNodeModules === 'boolean') {
1582
- includeNodeModules = String(target.env.includeNodeModules);
1583
- } else if (Array.isArray(target.env.includeNodeModules)) {
1581
+ if (typeof env.includeNodeModules === 'boolean') {
1582
+ includeNodeModules = String(env.includeNodeModules);
1583
+ } else if (Array.isArray(env.includeNodeModules)) {
1584
1584
  includeNodeModules =
1585
1585
  'only ' +
1586
- listFormat.format(
1587
- target.env.includeNodeModules.map((m) => JSON.stringify(m)),
1588
- );
1586
+ listFormat.format(env.includeNodeModules.map((m) => JSON.stringify(m)));
1589
1587
  } else if (
1590
- target.env.includeNodeModules &&
1591
- typeof target.env.includeNodeModules === 'object'
1588
+ env.includeNodeModules &&
1589
+ typeof env.includeNodeModules === 'object'
1592
1590
  ) {
1593
1591
  includeNodeModules =
1594
1592
  'all except ' +
1595
1593
  listFormat.format(
1596
- Object.entries(target.env.includeNodeModules)
1594
+ Object.entries(env.includeNodeModules)
1597
1595
  .filter(([, v]) => v === false)
1598
1596
  .map(([k]) => JSON.stringify(k)),
1599
1597
  );
@@ -1609,18 +1607,14 @@ async function debugResolvedTargets(input, targets, targetInfo, options) {
1609
1607
  fromProjectPath(options.projectRoot, input.filePath),
1610
1608
  )}
1611
1609
  **Output**: ${path.relative(process.cwd(), output)}
1612
- **Format**: ${target.env.outputFormat} ${format(
1613
- info.outputFormat,
1614
- )}
1615
- **Context**: ${target.env.context} ${format(info.context)}
1610
+ **Format**: ${env.outputFormat} ${format(info.outputFormat)}
1611
+ **Context**: ${env.context} ${format(info.context)}
1616
1612
  **Engines**: ${engines || ''} ${format(info.engines)}
1617
- **Library Mode**: ${String(target.env.isLibrary)} ${format(
1618
- info.isLibrary,
1619
- )}
1613
+ **Library Mode**: ${String(env.isLibrary)} ${format(info.isLibrary)}
1620
1614
  **Include Node Modules**: ${includeNodeModules} ${format(
1621
1615
  info.includeNodeModules,
1622
1616
  )}
1623
- **Optimize**: ${String(target.env.shouldOptimize)} ${format(
1617
+ **Optimize**: ${String(env.shouldOptimize)} ${format(
1624
1618
  info.shouldOptimize,
1625
1619
  )}`,
1626
1620
  codeFrames: target.loc
@@ -41,6 +41,7 @@ import ThrowableDiagnostic, {errorToDiagnostic} from '@atlaspack/diagnostic';
41
41
  import {PluginTracer, tracer} from '@atlaspack/profiler';
42
42
  import {requestTypes} from '../RequestTracker';
43
43
  import {getFeatureFlag} from '@atlaspack/feature-flags';
44
+ import {fromEnvironmentId} from '../EnvironmentManager';
44
45
 
45
46
  const HASH_REF_PREFIX_LEN = HASH_REF_PREFIX.length;
46
47
  const BOUNDARY_LENGTH = HASH_REF_PREFIX.length + 32 - 1;
@@ -111,7 +112,9 @@ async function run({input, options, api}) {
111
112
  let cacheKeys = info.cacheKeys;
112
113
  let mapKey = cacheKeys.map;
113
114
  let fullPath = fromProjectPath(options.projectRoot, filePath);
114
- if (mapKey && bundle.env.sourceMap && !bundle.env.sourceMap.inline) {
115
+ const env = fromEnvironmentId(bundle.env);
116
+
117
+ if (mapKey && env.sourceMap && !env.sourceMap.inline) {
115
118
  api.invalidateOnFileDelete(
116
119
  toProjectPath(options.projectRoot, fullPath + '.map'),
117
120
  );
@@ -171,12 +174,7 @@ async function run({input, options, api}) {
171
174
  const hasSourceMap = getFeatureFlag('cachePerformanceImprovements')
172
175
  ? await options.cache.hasLargeBlob(mapKey)
173
176
  : await options.cache.has(mapKey);
174
- if (
175
- mapKey &&
176
- bundle.env.sourceMap &&
177
- !bundle.env.sourceMap.inline &&
178
- hasSourceMap
179
- ) {
177
+ if (mapKey && env.sourceMap && !env.sourceMap.inline && hasSourceMap) {
180
178
  const mapEntry = getFeatureFlag('cachePerformanceImprovements')
181
179
  ? await options.cache.getLargeBlob(mapKey)
182
180
  : await options.cache.getBlob(mapKey);
@@ -196,6 +194,7 @@ async function run({input, options, api}) {
196
194
 
197
195
  let res = {
198
196
  filePath,
197
+ bundleId: bundle.id,
199
198
  type: info.type,
200
199
  stats: {
201
200
  size,
@@ -84,6 +84,7 @@ async function run({input, api, farm, options}) {
84
84
  ).replace(bundle.hashReference, hash);
85
85
  res.set(bundle.id, {
86
86
  filePath: joinProjectPath(bundle.target.distDir, name),
87
+ bundleId: bundle.id,
87
88
  type: bundle.type, // FIXME: this is wrong if the packager changes the type...
88
89
  stats: {
89
90
  time: 0,
@@ -25,6 +25,7 @@ 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';
28
29
 
29
30
  import {DEFAULT_FEATURE_FLAGS} from '@atlaspack/feature-flags';
30
31
  import {ATLASPACK_VERSION} from './constants';
@@ -277,6 +278,7 @@ export default async function resolveOptions(
277
278
  // feature-flags
278
279
  featureFlags: {...DEFAULT_FEATURE_FLAGS, ...initialOptions?.featureFlags},
279
280
  parcelVersion: ATLASPACK_VERSION,
281
+ isAtlaspackSuper: isSuperPackage(),
280
282
  };
281
283
  }
282
284
 
package/src/types.js CHANGED
@@ -34,6 +34,7 @@ import type {ProjectPath} from './projectPath';
34
34
  import type {Event} from '@parcel/watcher';
35
35
  import type {FeatureFlags} from '@atlaspack/feature-flags';
36
36
  import type {BackendType} from '@parcel/watcher';
37
+ import type {EnvironmentRef} from './EnvironmentManager';
37
38
 
38
39
  export type AtlaspackPluginNode = {|
39
40
  packageName: PackageName,
@@ -97,7 +98,7 @@ export type InternalSourceLocation = {|
97
98
  export type Target = {|
98
99
  distEntry?: ?FilePath,
99
100
  distDir: ProjectPath,
100
- env: Environment,
101
+ env: EnvironmentRef,
101
102
  name: string,
102
103
  publicUrl: string,
103
104
  loc?: ?InternalSourceLocation,
@@ -139,7 +140,7 @@ export type Dependency = {|
139
140
  isEntry: boolean,
140
141
  isOptional: boolean,
141
142
  loc: ?InternalSourceLocation,
142
- env: Environment,
143
+ env: EnvironmentRef,
143
144
  packageConditions?: number,
144
145
  customPackageConditions?: Array<string>,
145
146
  meta: Meta,
@@ -180,7 +181,7 @@ export type Asset = {|
180
181
  bundleBehavior: ?$Values<typeof BundleBehavior>,
181
182
  isBundleSplittable: boolean,
182
183
  isSource: boolean,
183
- env: Environment,
184
+ env: EnvironmentRef,
184
185
  meta: Meta,
185
186
  stats: Stats,
186
187
  contentKey: ?string,
@@ -284,6 +285,7 @@ export type AtlaspackOptions = {|
284
285
  defaultConfig?: DependencySpecifier,
285
286
  env: EnvMap,
286
287
  parcelVersion: string,
288
+ isAtlaspackSuper?: boolean,
287
289
  targets: ?(Array<string> | {+[string]: TargetDescriptor, ...}),
288
290
  shouldDisableCache: boolean,
289
291
  cacheDir: FilePath,
@@ -388,7 +390,7 @@ export type RootNode = {|id: ContentKey, +type: 'root', value: string | null|};
388
390
  export type AssetRequestInput = {|
389
391
  name?: string, // AssetGraph name, needed so that different graphs can isolated requests since the results are not stored
390
392
  filePath: ProjectPath,
391
- env: Environment,
393
+ env: EnvironmentRef,
392
394
  isSource?: boolean,
393
395
  canDefer?: boolean,
394
396
  sideEffects?: boolean,
@@ -492,13 +494,13 @@ export type Config = {|
492
494
  id: string,
493
495
  isSource: boolean,
494
496
  searchPath: ProjectPath,
495
- env: Environment,
497
+ env: EnvironmentRef,
496
498
  cacheKey: ?string,
497
499
  result: ConfigResult,
498
500
  invalidateOnFileChange: Set<ProjectPath>,
499
501
  invalidateOnConfigKeyChange: Array<{|
500
502
  filePath: ProjectPath,
501
- configKey: string,
503
+ configKey: string[],
502
504
  |}>,
503
505
  invalidateOnFileCreate: Array<InternalFileCreateInvalidation>,
504
506
  invalidateOnEnvChange: Set<string>,
@@ -539,7 +541,7 @@ export type Bundle = {|
539
541
  publicId: ?string,
540
542
  hashReference: string,
541
543
  type: string,
542
- env: Environment,
544
+ env: EnvironmentRef,
543
545
  entryAssetIds: Array<ContentKey>,
544
546
  mainEntryId: ?ContentKey,
545
547
  needsStableName: ?boolean,
@@ -573,6 +575,7 @@ export type BundleGroupNode = {|
573
575
 
574
576
  export type PackagedBundleInfo = {|
575
577
  filePath: ProjectPath,
578
+ bundleId: ContentKey,
576
579
  type: string,
577
580
  stats: Stats,
578
581
  |};
package/src/worker.js CHANGED
@@ -32,14 +32,15 @@ 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
35
36
  // $FlowFixMe
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
- }
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
+ // }
43
44
 
44
45
  registerCoreWithSerializer();
45
46