@atlaspack/core 2.12.1-dev.3450 → 2.12.1-dev.3466

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 (112) hide show
  1. package/lib/AssetGraph.js +5 -1
  2. package/lib/Atlaspack.js +2 -2
  3. package/lib/CommittedAsset.js +11 -5
  4. package/lib/Dependency.js +1 -1
  5. package/lib/PackagerRunner.js +53 -5
  6. package/lib/RequestTracker.js +10 -4
  7. package/lib/SymbolPropagation.js +25 -36
  8. package/lib/UncommittedAsset.js +8 -2
  9. package/lib/assetUtils.js +9 -3
  10. package/lib/atlaspack-v3/fs.js +31 -29
  11. package/lib/atlaspack-v3/index.js +2 -2
  12. package/lib/atlaspack-v3/jsCallable.js +9 -4
  13. package/lib/atlaspack-v3/worker/compat/asset-symbols.js +192 -0
  14. package/lib/atlaspack-v3/worker/compat/bitflags.js +84 -0
  15. package/lib/atlaspack-v3/worker/compat/dependency.js +44 -0
  16. package/lib/atlaspack-v3/worker/compat/environment.js +68 -0
  17. package/lib/atlaspack-v3/worker/compat/index.js +104 -0
  18. package/lib/atlaspack-v3/worker/compat/mutable-asset.js +144 -0
  19. package/lib/atlaspack-v3/worker/compat/plugin-config.js +58 -0
  20. package/lib/atlaspack-v3/worker/compat/plugin-logger.js +29 -0
  21. package/lib/atlaspack-v3/worker/compat/plugin-options.js +113 -0
  22. package/lib/atlaspack-v3/worker/compat/plugin-tracer.js +12 -0
  23. package/lib/atlaspack-v3/worker/compat/target.js +17 -0
  24. package/lib/atlaspack-v3/worker/worker.js +115 -127
  25. package/lib/index.js +0 -43
  26. package/lib/projectPath.js +12 -4
  27. package/lib/registerCoreWithSerializer.js +11 -5
  28. package/lib/requests/AtlaspackConfigRequest.js +8 -2
  29. package/lib/requests/ConfigRequest.js +9 -4
  30. package/lib/requests/DevDepRequest.js +9 -3
  31. package/lib/requests/PathRequest.js +8 -2
  32. package/lib/requests/WriteBundleRequest.js +15 -15
  33. package/lib/worker.js +8 -2
  34. package/package.json +24 -16
  35. package/src/AssetGraph.js +15 -13
  36. package/src/Atlaspack.js +5 -6
  37. package/src/AtlaspackConfig.js +11 -9
  38. package/src/AtlaspackConfig.schema.js +1 -1
  39. package/src/BundleGraph.js +83 -79
  40. package/src/CommittedAsset.js +5 -3
  41. package/src/Dependency.js +1 -1
  42. package/src/PackagerRunner.js +57 -9
  43. package/src/ReporterRunner.js +4 -4
  44. package/src/RequestTracker.js +19 -19
  45. package/src/SymbolPropagation.js +40 -52
  46. package/src/Transformation.js +12 -12
  47. package/src/UncommittedAsset.js +3 -3
  48. package/src/Validation.js +5 -5
  49. package/src/applyRuntimes.js +2 -2
  50. package/src/assetUtils.js +2 -2
  51. package/src/atlaspack-v3/AtlaspackV3.js +1 -1
  52. package/src/atlaspack-v3/fs.js +39 -25
  53. package/src/atlaspack-v3/index.js +1 -1
  54. package/src/atlaspack-v3/jsCallable.js +11 -10
  55. package/src/atlaspack-v3/worker/compat/asset-symbols.js +225 -0
  56. package/src/atlaspack-v3/worker/compat/bitflags.js +100 -0
  57. package/src/atlaspack-v3/worker/compat/dependency.js +83 -0
  58. package/src/atlaspack-v3/worker/compat/environment.js +92 -0
  59. package/src/atlaspack-v3/worker/compat/index.js +10 -0
  60. package/src/atlaspack-v3/worker/compat/mutable-asset.js +184 -0
  61. package/src/atlaspack-v3/worker/compat/plugin-config.js +94 -0
  62. package/src/atlaspack-v3/worker/compat/plugin-logger.js +47 -0
  63. package/src/atlaspack-v3/worker/compat/plugin-options.js +137 -0
  64. package/src/atlaspack-v3/worker/compat/plugin-tracer.js +11 -0
  65. package/src/atlaspack-v3/worker/compat/target.js +27 -0
  66. package/src/atlaspack-v3/worker/worker.js +148 -134
  67. package/src/dumpGraphToGraphViz.js +1 -1
  68. package/src/index.js +0 -10
  69. package/src/loadDotEnv.js +1 -1
  70. package/src/projectPath.js +12 -4
  71. package/src/public/Asset.js +1 -1
  72. package/src/public/Bundle.js +3 -3
  73. package/src/public/BundleGraph.js +20 -20
  74. package/src/public/Config.js +1 -1
  75. package/src/public/MutableBundleGraph.js +8 -8
  76. package/src/registerCoreWithSerializer.js +7 -4
  77. package/src/requests/AssetGraphRequest.js +10 -10
  78. package/src/requests/AssetGraphRequestRust.js +3 -3
  79. package/src/requests/AssetRequest.js +3 -3
  80. package/src/requests/AtlaspackConfigRequest.js +6 -4
  81. package/src/requests/BundleGraphRequest.js +6 -6
  82. package/src/requests/ConfigRequest.js +5 -6
  83. package/src/requests/DevDepRequest.js +8 -8
  84. package/src/requests/EntryRequest.js +2 -2
  85. package/src/requests/PathRequest.js +1 -1
  86. package/src/requests/TargetRequest.js +9 -8
  87. package/src/requests/ValidationRequest.js +2 -2
  88. package/src/requests/WriteBundleRequest.js +26 -20
  89. package/src/requests/WriteBundlesRequest.js +6 -6
  90. package/src/requests/asset-graph-diff.js +4 -4
  91. package/src/resolveOptions.js +3 -3
  92. package/src/serializerCore.browser.js +3 -2
  93. package/src/utils.js +2 -2
  94. package/src/worker.js +1 -1
  95. package/test/AtlaspackConfigRequest.test.js +1 -1
  96. package/test/BundleGraph.test.js +3 -3
  97. package/test/Dependency.test.js +28 -0
  98. package/test/PublicMutableBundleGraph.test.js +2 -2
  99. package/test/RequestTracker.test.js +7 -6
  100. package/test/SymbolPropagation.test.js +9 -9
  101. package/test/requests/ConfigRequest.test.js +3 -6
  102. package/test/utils.test.js +1 -1
  103. package/lib/atlaspack-v3/worker/compat.js +0 -57
  104. package/lib/buildCache.js +0 -18
  105. package/lib/serializer.js +0 -216
  106. package/lib/serializerCore.js +0 -16
  107. package/src/atlaspack-v3/worker/compat.js +0 -82
  108. package/src/buildCache.js +0 -15
  109. package/src/serializer.js +0 -255
  110. package/src/serializerCore.js +0 -5
  111. package/test/requests/WriteBundleRequest.test.js +0 -132
  112. package/test/serializer.test.js +0 -302
@@ -63,7 +63,7 @@ async function run({input, api, farm, options}) {
63
63
  |} = {};
64
64
  let writeEarlyPromises = {};
65
65
  let hashRefToNameHash = new Map();
66
- let bundles = bundleGraph.getBundles().filter(bundle => {
66
+ let bundles = bundleGraph.getBundles().filter((bundle) => {
67
67
  // Do not package and write placeholder bundles to disk. We just
68
68
  // need to update the name so other bundles can reference it.
69
69
  if (bundle.isPlaceholder) {
@@ -91,12 +91,12 @@ async function run({input, api, farm, options}) {
91
91
  // This avoids the cost of serializing the bundle graph for single file change builds.
92
92
  let useMainThread =
93
93
  bundles.length === 1 ||
94
- bundles.filter(b => !api.canSkipSubrequest(bundleGraph.getHash(b)))
94
+ bundles.filter((b) => !api.canSkipSubrequest(bundleGraph.getHash(b)))
95
95
  .length === 1;
96
96
 
97
97
  try {
98
98
  await Promise.all(
99
- bundles.map(async bundle => {
99
+ bundles.map(async (bundle) => {
100
100
  let request = createPackageRequest({
101
101
  bundle,
102
102
  bundleGraph,
@@ -142,7 +142,7 @@ async function run({input, api, farm, options}) {
142
142
  );
143
143
  assignComplexNameHashes(hashRefToNameHash, bundles, bundleInfoMap, options);
144
144
  await Promise.all(
145
- bundles.map(bundle => {
145
+ bundles.map((bundle) => {
146
146
  let promise =
147
147
  writeEarlyPromises[bundle.id] ??
148
148
  api.runRequest(
@@ -154,7 +154,7 @@ async function run({input, api, farm, options}) {
154
154
  }),
155
155
  );
156
156
 
157
- return promise.then(r => res.set(bundle.id, r));
157
+ return promise.then((r) => res.set(bundle.id, r));
158
158
  }),
159
159
  );
160
160
 
@@ -180,7 +180,7 @@ function assignComplexNameHashes(
180
180
  options.shouldContentHash
181
181
  ? hashString(
182
182
  [...getBundlesIncludedInHash(bundle.id, bundleInfoMap)]
183
- .map(bundleId => bundleInfoMap[bundleId].hash)
183
+ .map((bundleId) => bundleInfoMap[bundleId].hash)
184
184
  .join(':'),
185
185
  ).slice(-8)
186
186
  : bundle.id.slice(-8),
@@ -49,12 +49,12 @@ function compactDeep(
49
49
  });
50
50
  return copy;
51
51
  } else if (Array.isArray(obj)) {
52
- return obj.map(v => compactDeep(v, ignoredPatterns, `${currentPath}[]`));
52
+ return obj.map((v) => compactDeep(v, ignoredPatterns, `${currentPath}[]`));
53
53
  } else if (typeof obj === 'object') {
54
54
  const copy = {};
55
55
  Object.entries(obj ?? {}).forEach(([key, value]) => {
56
56
  const path = `${currentPath}.${key}`;
57
- if (ignoredPatterns.some(pattern => path.includes(pattern))) {
57
+ if (ignoredPatterns.some((pattern) => path.includes(pattern))) {
58
58
  return;
59
59
  }
60
60
  // Equivalent false == null
@@ -73,10 +73,10 @@ function compactDeep(
73
73
  }
74
74
 
75
75
  function assetGraphDiff(jsAssetGraph: AssetGraph, rustAssetGraph: AssetGraph) {
76
- const getNodes = graph => {
76
+ const getNodes = (graph) => {
77
77
  let nodes = {};
78
78
 
79
- graph.traverse(nodeId => {
79
+ graph.traverse((nodeId) => {
80
80
  let node: AssetGraphNode | null = graph.getNode(nodeId) ?? null;
81
81
  if (!node) return;
82
82
 
@@ -42,7 +42,7 @@ function generateInstanceId(entries: Array<FilePath>): string {
42
42
 
43
43
  // Compiles an array of globs to regex - used for lazy include/excludes
44
44
  function compileGlobs(globs: string[]): RegExp[] {
45
- return globs.map(glob => globToRegex(glob));
45
+ return globs.map((glob) => globToRegex(glob));
46
46
  }
47
47
 
48
48
  export default async function resolveOptions(
@@ -58,7 +58,7 @@ export default async function resolveOptions(
58
58
  if (initialOptions.entries == null || initialOptions.entries === '') {
59
59
  entries = [];
60
60
  } else if (Array.isArray(initialOptions.entries)) {
61
- entries = initialOptions.entries.map(entry =>
61
+ entries = initialOptions.entries.map((entry) =>
62
62
  path.resolve(inputCwd, entry),
63
63
  );
64
64
  } else {
@@ -202,7 +202,7 @@ export default async function resolveOptions(
202
202
  watchDir,
203
203
  watchBackend: initialOptions.watchBackend,
204
204
  watchIgnore: initialOptions.watchIgnore,
205
- entries: entries.map(e => toProjectPath(projectRoot, e)),
205
+ entries: entries.map((e) => toProjectPath(projectRoot, e)),
206
206
  targets: initialOptions.targets,
207
207
  logLevel: initialOptions.logLevel ?? 'info',
208
208
  projectRoot,
@@ -4,5 +4,6 @@ import * as msgpackr from 'msgpackr';
4
4
 
5
5
  let encoder = new msgpackr.Encoder({structuredClone: true});
6
6
 
7
- export let serializeRaw: any => Buffer = v => Buffer.from(encoder.encode(v));
8
- export let deserializeRaw: Buffer => any = v => encoder.decode(v);
7
+ export let serializeRaw: (any) => Buffer = (v) =>
8
+ Buffer.from(encoder.encode(v));
9
+ export let deserializeRaw: (Buffer) => any = (v) => encoder.decode(v);
package/src/utils.js CHANGED
@@ -40,7 +40,7 @@ export class BuildAbortError extends Error {
40
40
 
41
41
  export function getPublicId(
42
42
  id: string,
43
- alreadyExists: string => boolean,
43
+ alreadyExists: (string) => boolean,
44
44
  ): string {
45
45
  let encoded = base62.encode(Buffer.from(id, 'hex'));
46
46
  for (let end = 5; end <= encoded.length; end++) {
@@ -74,7 +74,7 @@ const ignoreOptions = new Set([
74
74
 
75
75
  export function optionsProxy(
76
76
  options: AtlaspackOptions,
77
- invalidateOnOptionChange: string => void,
77
+ invalidateOnOptionChange: (string) => void,
78
78
  addDevDependency?: (devDep: InternalDevDepOptions) => void,
79
79
  ): AtlaspackOptions {
80
80
  let packageManager = addDevDependency
package/src/worker.js CHANGED
@@ -22,7 +22,7 @@ import PackagerRunner, {type RunPackagerRunnerResult} from './PackagerRunner';
22
22
  import Validation, {type ValidationOpts} from './Validation';
23
23
  import AtlaspackConfig from './AtlaspackConfig';
24
24
  import {registerCoreWithSerializer} from './registerCoreWithSerializer';
25
- import {clearBuildCaches} from './buildCache';
25
+ import {clearBuildCaches} from '@atlaspack/build-cache';
26
26
  import {init as initSourcemaps} from '@parcel/source-map';
27
27
  import {init as initRust} from '@atlaspack/rust';
28
28
  import WorkerFarm from '@atlaspack/workers';
@@ -133,7 +133,7 @@ describe('AtlaspackConfigRequest', () => {
133
133
  '.parcelrc',
134
134
  );
135
135
  },
136
- e => {
136
+ (e) => {
137
137
  assert.strictEqual(
138
138
  e.diagnostics[0].codeFrames[0].codeHighlights[0].message,
139
139
  `Possible values: "$schema", "bundler", "resolvers", "transformers", "validators", "namers", "packagers", "optimizers", "compressors", "reporters", "runtimes", "filePath", "resolveFrom"`,
@@ -29,7 +29,7 @@ describe('BundleGraph', () => {
29
29
  false,
30
30
  );
31
31
  assert.deepEqual(
32
- getAssets(bundleGraph).map(a => bundleGraph.getAssetPublicId(a)),
32
+ getAssets(bundleGraph).map((a) => bundleGraph.getAssetPublicId(a)),
33
33
  ['296TI', '4DGUq'],
34
34
  );
35
35
  });
@@ -40,7 +40,7 @@ describe('BundleGraph', () => {
40
40
  false,
41
41
  );
42
42
  assert.deepEqual(
43
- getAssets(bundleGraph).map(a => bundleGraph.getAssetPublicId(a)),
43
+ getAssets(bundleGraph).map((a) => bundleGraph.getAssetPublicId(a)),
44
44
  ['296TI', '296TII'],
45
45
  );
46
46
  });
@@ -48,7 +48,7 @@ describe('BundleGraph', () => {
48
48
 
49
49
  function getAssets(bundleGraph) {
50
50
  let assets = [];
51
- bundleGraph.traverse(node => {
51
+ bundleGraph.traverse((node) => {
52
52
  if (node.type === 'asset') {
53
53
  assets.push(node.value);
54
54
  }
@@ -17,5 +17,33 @@ describe('Dependency', () => {
17
17
  });
18
18
  expect(id1).toEqual(id2);
19
19
  });
20
+
21
+ it('dependencies with different targets should have different IDs', () => {
22
+ let id1 = createDependencyId({
23
+ specifier: 'foo',
24
+ env: createEnvironment(),
25
+ specifierType: 'esm',
26
+ target: {
27
+ name: 'test-1234',
28
+ distDir: 'dist-dir',
29
+ env: createEnvironment(),
30
+ publicUrl: 'public-url',
31
+ source: '1234',
32
+ },
33
+ });
34
+ let id2 = createDependencyId({
35
+ specifier: 'foo',
36
+ env: createEnvironment(),
37
+ specifierType: 'esm',
38
+ target: {
39
+ name: 'test-1234',
40
+ distDir: 'dist-dir',
41
+ env: createEnvironment(),
42
+ publicUrl: 'public-url',
43
+ source: '5678', // <- this is different
44
+ },
45
+ });
46
+ expect(id1).not.toEqual(id2);
47
+ });
20
48
  });
21
49
  });
@@ -38,7 +38,7 @@ describe('PublicMutableBundleGraph', () => {
38
38
  DEFAULT_OPTIONS,
39
39
  );
40
40
 
41
- mutableBundleGraph.traverse(node => {
41
+ mutableBundleGraph.traverse((node) => {
42
42
  if (
43
43
  node.type === 'dependency' &&
44
44
  mutableBundleGraph.getResolvedAsset(node.value)
@@ -59,7 +59,7 @@ describe('PublicMutableBundleGraph', () => {
59
59
  });
60
60
 
61
61
  assert.deepEqual(
62
- internalBundleGraph.getBundles().map(b => b.publicId),
62
+ internalBundleGraph.getBundles().map((b) => b.publicId),
63
63
  ['8LVYC', 'd7Pd5'],
64
64
  );
65
65
  });
@@ -15,7 +15,7 @@ import {toProjectPath} from '../src/projectPath';
15
15
  import {DEFAULT_FEATURE_FLAGS, setFeatureFlags} from '../../feature-flags/src';
16
16
 
17
17
  const options = DEFAULT_OPTIONS;
18
- const farm = new WorkerFarm({workerPath: require.resolve('../src/worker.js')});
18
+ const farm = new WorkerFarm({workerPath: require.resolve('../src/worker')});
19
19
 
20
20
  describe('RequestTracker', () => {
21
21
  it('should not run requests that have not been invalidated', async () => {
@@ -84,7 +84,7 @@ describe('RequestTracker', () => {
84
84
  assert(
85
85
  tracker
86
86
  .getInvalidRequests()
87
- .map(req => req.id)
87
+ .map((req) => req.id)
88
88
  .includes('abc'),
89
89
  );
90
90
  });
@@ -107,7 +107,7 @@ describe('RequestTracker', () => {
107
107
  assert(
108
108
  tracker
109
109
  .getInvalidRequests()
110
- .map(req => req.id)
110
+ .map((req) => req.id)
111
111
  .includes('abc'),
112
112
  );
113
113
  });
@@ -186,7 +186,7 @@ describe('RequestTracker', () => {
186
186
  assert(
187
187
  tracker
188
188
  .getInvalidRequests()
189
- .map(req => req.id)
189
+ .map((req) => req.id)
190
190
  .includes('abc'),
191
191
  );
192
192
  });
@@ -453,7 +453,7 @@ describe('RequestTracker', () => {
453
453
  });
454
454
 
455
455
  describe('respondToFSEvents', () => {
456
- [true, false].forEach(value => {
456
+ [true, false].forEach((value) => {
457
457
  beforeEach(() => {
458
458
  setFeatureFlags({
459
459
  ...DEFAULT_FEATURE_FLAGS,
@@ -562,7 +562,8 @@ root --- node1 --- node2 ----------- orphan1 --- orphan2
562
562
 
563
563
  */
564
564
 
565
- const getNonNullNodes = graph => graph.nodes.filter(node => node != null);
565
+ const getNonNullNodes = (graph) =>
566
+ graph.nodes.filter((node) => node != null);
566
567
 
567
568
  graph.addEdge(root, node1);
568
569
  graph.addEdge(node1, node2);
@@ -191,14 +191,14 @@ function assertUsedSymbols(
191
191
  _expectedDependency.map(([from, to, sym]) => [
192
192
  from + ':' + to,
193
193
  // $FlowFixMe[invalid-tuple-index]
194
- sym ? sym.map(v => [v[0], v[1] ?? [to, v[0]]]) : sym,
194
+ sym ? sym.map((v) => [v[0], v[1] ?? [to, v[0]]]) : sym,
195
195
  ]),
196
196
  );
197
197
 
198
198
  if (isLibrary) {
199
199
  let entryDep = nullthrows(
200
200
  [...graph.nodes.values()].find(
201
- n => n?.type === 'dependency' && n.value.sourceAssetId == null,
201
+ (n) => n?.type === 'dependency' && n.value.sourceAssetId == null,
202
202
  ),
203
203
  );
204
204
  invariant(entryDep.type === 'dependency');
@@ -374,13 +374,13 @@ function changeDependency(
374
374
  ): Iterable<[ContentKey, Asset]> {
375
375
  let sourceAssetNode = nullthrowsAssetNode(
376
376
  [...graph.nodes.values()].find(
377
- n => n?.type === 'asset' && n.value.filePath === from,
377
+ (n) => n?.type === 'asset' && n.value.filePath === from,
378
378
  ),
379
379
  );
380
380
  sourceAssetNode.usedSymbolsDownDirty = true;
381
381
  let depNode = nullthrowsDependencyNode(
382
382
  [...graph.nodes.values()].find(
383
- n =>
383
+ (n) =>
384
384
  n?.type === 'dependency' &&
385
385
  n.value.sourcePath === from &&
386
386
  n.value.specifier === to,
@@ -397,7 +397,7 @@ function changeAsset(
397
397
  ): Iterable<[ContentKey, Asset]> {
398
398
  let node = nullthrowsAssetNode(
399
399
  [...graph.nodes.values()].find(
400
- n => n?.type === 'asset' && n.value.filePath === asset,
400
+ (n) => n?.type === 'asset' && n.value.filePath === asset,
401
401
  ),
402
402
  );
403
403
  node.usedSymbolsUpDirty = true;
@@ -440,7 +440,7 @@ describe('SymbolPropagation', () => {
440
440
  );
441
441
 
442
442
  let changedAssets = [
443
- ...changeDependency(graph, 'index.js', '/lib.js', symbols => {
443
+ ...changeDependency(graph, 'index.js', '/lib.js', (symbols) => {
444
444
  symbols.set('b', {
445
445
  local: 'b',
446
446
  isWeak: false,
@@ -480,7 +480,7 @@ describe('SymbolPropagation', () => {
480
480
  );
481
481
 
482
482
  let changedAssets = [
483
- ...changeDependency(graph, 'index.js', '/lib.js', symbols => {
483
+ ...changeDependency(graph, 'index.js', '/lib.js', (symbols) => {
484
484
  symbols.delete('f');
485
485
  symbols.set('f2', {
486
486
  local: 'f2',
@@ -523,7 +523,7 @@ describe('SymbolPropagation', () => {
523
523
  );
524
524
 
525
525
  let changedAssets = [
526
- ...changeAsset(graph, 'lib.js', symbols => {
526
+ ...changeAsset(graph, 'lib.js', (symbols) => {
527
527
  symbols.delete('f');
528
528
  symbols.set('f2', {
529
529
  local: 'f2',
@@ -570,7 +570,7 @@ describe('SymbolPropagation', () => {
570
570
  );
571
571
 
572
572
  let changedAssets = [
573
- ...changeDependency(graph, 'index.js', '/lib.js', symbols => {
573
+ ...changeDependency(graph, 'index.js', '/lib.js', (symbols) => {
574
574
  symbols.set('b', {
575
575
  local: 'b',
576
576
  isWeak: false,
@@ -21,7 +21,7 @@ const mockCast = (f: any): any => f;
21
21
  describe('ConfigRequest tests', () => {
22
22
  const projectRoot = 'project_root';
23
23
  const farm = new WorkerFarm({
24
- workerPath: require.resolve('../../src/worker.js'),
24
+ workerPath: require.resolve('../../src/worker'),
25
25
  maxConcurrentWorkers: 1,
26
26
  });
27
27
  let fs = new MemoryFS(farm);
@@ -48,7 +48,7 @@ describe('ConfigRequest tests', () => {
48
48
  invalidateOnFileUpdate: sinon.spy(),
49
49
  invalidateOnOptionChange: sinon.spy(),
50
50
  invalidateOnStartup: sinon.spy(),
51
- runRequest: sinon.spy(request => {
51
+ runRequest: sinon.spy((request) => {
52
52
  return request.run({
53
53
  api: mockRunApi,
54
54
  options,
@@ -229,10 +229,7 @@ describe('ConfigRequest tests', () => {
229
229
  invalidateOnConfigKeyChange: [
230
230
  {
231
231
  configKey: 'key1',
232
- filePath: toProjectPath(
233
- projectRoot,
234
- path.join('project_root', 'config.json'),
235
- ),
232
+ filePath: toProjectPath(projectRoot, 'config.json'),
236
233
  },
237
234
  ],
238
235
  });
@@ -28,7 +28,7 @@ describe('getPublicId', () => {
28
28
 
29
29
  it('uses more characters if there is a collision', () => {
30
30
  assert.equal(
31
- getPublicId(id, publicId =>
31
+ getPublicId(id, (publicId) =>
32
32
  [fullPublicId.slice(0, 5), fullPublicId.slice(0, 6)].includes(publicId),
33
33
  ),
34
34
  fullPublicId.slice(0, 7),
@@ -1,57 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.AssetCompat = void 0;
7
- var _Environment = _interopRequireDefault(require("../../public/Environment"));
8
- var _types = require("../../types");
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- class AssetCompat {
11
- // TODO: Type properly
12
-
13
- constructor(_inner, options) {
14
- this._inner = _inner;
15
- // $FlowFixMe This isn't correct to flow but is enough to satisfy the runtime checks
16
- this.env = new _Environment.default(_inner.env, options);
17
- this._dependencies = [];
18
- }
19
- get id() {
20
- return this._inner.id;
21
- }
22
- get filePath() {
23
- return this._inner.filePath;
24
- }
25
- get type() {
26
- return this._inner.type;
27
- }
28
- set type(value) {
29
- this._inner.type = value;
30
- }
31
- get bundleBehavior() {
32
- let bundleBehavior = this._inner.bundleBehavior;
33
- return bundleBehavior == null ? null : _types.BundleBehaviorNames[bundleBehavior];
34
- }
35
- set bundleBehavior(bundleBehavior) {
36
- this._inner.bundleBehavior = bundleBehavior ? _types.BundleBehavior[bundleBehavior] : null;
37
- }
38
- getCode() {
39
- return Buffer.from(this._inner.code).toString();
40
- }
41
- setCode(code) {
42
- this._inner.code = Array.from(new TextEncoder().encode(code));
43
- }
44
- getAST() {
45
- return this._ast;
46
- }
47
- setAST(ast) {
48
- this._ast = ast;
49
- }
50
- addDependency() {
51
- throw new Error('[V3] Unimplemented: Asset.addDependency not yet implemented');
52
- }
53
- addURLDependency() {
54
- throw new Error('[V3] Unimplemented: Asset.addURLDependency not yet implemented');
55
- }
56
- }
57
- exports.AssetCompat = AssetCompat;
package/lib/buildCache.js DELETED
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.clearBuildCaches = clearBuildCaches;
7
- exports.createBuildCache = createBuildCache;
8
- const buildCaches = [];
9
- function createBuildCache() {
10
- let cache = new Map();
11
- buildCaches.push(cache);
12
- return cache;
13
- }
14
- function clearBuildCaches() {
15
- for (let cache of buildCaches) {
16
- cache.clear();
17
- }
18
- }