@atlaspack/core 2.23.2-dev-inline-requires-reuse-bdc9ca9c3.0 → 2.23.3-inline-requires-take-2-2a0c642df.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -237,7 +237,6 @@ export class TargetResolver {
237
237
  if (!packageTargets.has(target)) {
238
238
  throw new ThrowableDiagnostic({
239
239
  diagnostic: {
240
- // @ts-expect-error TS2345
241
240
  message: md`Could not find target with name "${target}"`,
242
241
  origin: '@atlaspack/core',
243
242
  },
@@ -265,7 +264,6 @@ export class TargetResolver {
265
264
  );
266
265
  throw new ThrowableDiagnostic({
267
266
  diagnostic: {
268
- // @ts-expect-error TS2345
269
267
  message: md`Missing distDir for target "${name}"`,
270
268
  origin: '@atlaspack/core',
271
269
  codeFrames: [
@@ -437,7 +435,6 @@ export class TargetResolver {
437
435
  if (pkgFile == null) {
438
436
  throw new ThrowableDiagnostic({
439
437
  diagnostic: {
440
- // @ts-expect-error TS2345
441
438
  message: md`Expected package.json file in ${rootDir}`,
442
439
  origin: '@atlaspack/core',
443
440
  },
@@ -718,7 +715,6 @@ export class TargetResolver {
718
715
  let ext = path.extname(distEntry);
719
716
  throw new ThrowableDiagnostic({
720
717
  diagnostic: {
721
- // @ts-expect-error TS2345
722
718
  message: md`Unexpected output file type ${ext} in target "${targetName}"`,
723
719
  origin: '@atlaspack/core',
724
720
  codeFrames: [
@@ -751,7 +747,6 @@ export class TargetResolver {
751
747
  : JSON.stringify(pkgContents, null, '\t');
752
748
  throw new ThrowableDiagnostic({
753
749
  diagnostic: {
754
- // @ts-expect-error TS2345
755
750
  message: md`The "global" output format is not supported in the "${targetName}" target.`,
756
751
  origin: '@atlaspack/core',
757
752
  codeFrames: [
@@ -806,7 +801,6 @@ export class TargetResolver {
806
801
  throw new ThrowableDiagnostic({
807
802
  diagnostic: {
808
803
  // prettier-ignore
809
- // @ts-expect-error TS2345
810
804
  message: md`Output format "esmodule" cannot be used in the "main" target without a .mjs extension or "type": "module" field.`,
811
805
  origin: '@atlaspack/core',
812
806
  codeFrames: [
@@ -976,7 +970,6 @@ export class TargetResolver {
976
970
  : JSON.stringify(pkgContents, null, '\t');
977
971
  throw new ThrowableDiagnostic({
978
972
  diagnostic: {
979
- // @ts-expect-error TS2345
980
973
  message: md`Invalid distPath for target "${targetName}"`,
981
974
  origin: '@atlaspack/core',
982
975
  codeFrames: [
@@ -1235,7 +1228,6 @@ export class TargetResolver {
1235
1228
  let listFormat = new Intl.ListFormat('en-US', {type: 'disjunction'});
1236
1229
  throw new ThrowableDiagnostic({
1237
1230
  diagnostic: {
1238
- // @ts-expect-error TS2345
1239
1231
  message: md`Declared output format "${descriptor.outputFormat}" does not match expected output format "${inferredOutputFormat}".`,
1240
1232
  origin: '@atlaspack/core',
1241
1233
  codeFrames: [
@@ -1392,7 +1384,6 @@ function assertNoDuplicateTargets(
1392
1384
  for (let [targetPath, targetNames] of targetsByPath) {
1393
1385
  if (targetNames.length > 1 && pkgContents != null && pkgFilePath != null) {
1394
1386
  diagnostics.push({
1395
- // @ts-expect-error TS2345
1396
1387
  message: md`Multiple targets have the same destination path "${path.relative(
1397
1388
  path.dirname(pkgFilePath),
1398
1389
  targetPath,
@@ -1581,7 +1572,6 @@ async function debugResolvedTargets(
1581
1572
  }
1582
1573
 
1583
1574
  if (keyInfo.path) {
1584
- // @ts-expect-error TS2345
1585
1575
  highlight.defined = md`${key} defined here`;
1586
1576
  }
1587
1577
 
@@ -1642,7 +1632,6 @@ async function debugResolvedTargets(
1642
1632
  v.message != null ? md.italic(v.message) : '';
1643
1633
  logger.verbose({
1644
1634
  origin: '@atlaspack/core',
1645
- // @ts-expect-error TS2345
1646
1635
  message: md`**Target** "${target.name}"
1647
1636
 
1648
1637
  **Entry**: ${path.relative(
package/src/types.ts CHANGED
@@ -16,7 +16,6 @@ import type {
16
16
  ServerOptions,
17
17
  SourceType,
18
18
  Stats,
19
- Symbol,
20
19
  TargetSourceMapOptions,
21
20
  ConfigResult,
22
21
  OutputFormat,
@@ -429,6 +428,7 @@ export type AssetRequestInput = {
429
428
  isSource?: boolean;
430
429
  canDefer?: boolean;
431
430
  sideEffects?: boolean;
431
+ runtimeAssetRequiringExecutionOnLoad?: boolean;
432
432
  code?: string;
433
433
  pipeline?: string | null | undefined;
434
434
  optionsRef: SharedReference;
@@ -17,8 +17,8 @@ describe('Environment', () => {
17
17
  isLibrary: false,
18
18
  shouldOptimize: false,
19
19
  shouldScopeHoist: false,
20
- sourceMap: undefined,
21
- loc: undefined,
20
+ sourceMap: null,
21
+ loc: null,
22
22
  sourceType: 'module',
23
23
  unstableSingleFileOutput: false,
24
24
  });
@@ -62,8 +62,8 @@ describe('Environment', () => {
62
62
  isLibrary: false,
63
63
  shouldOptimize: false,
64
64
  shouldScopeHoist: false,
65
- sourceMap: undefined,
66
- loc: undefined,
65
+ sourceMap: null,
66
+ loc: null,
67
67
  sourceType: 'module',
68
68
  unstableSingleFileOutput: false,
69
69
  },
@@ -103,8 +103,8 @@ describe('Environment', () => {
103
103
  isLibrary: false,
104
104
  shouldOptimize: false,
105
105
  shouldScopeHoist: false,
106
- sourceMap: undefined,
107
- loc: undefined,
106
+ sourceMap: null,
107
+ loc: null,
108
108
  sourceType: 'module',
109
109
  unstableSingleFileOutput: false,
110
110
  },
@@ -125,8 +125,8 @@ describe('Environment', () => {
125
125
  isLibrary: false,
126
126
  shouldOptimize: false,
127
127
  shouldScopeHoist: false,
128
- sourceMap: undefined,
129
- loc: undefined,
128
+ sourceMap: null,
129
+ loc: null,
130
130
  sourceType: 'module',
131
131
  unstableSingleFileOutput: false,
132
132
  },
@@ -10,6 +10,7 @@ import {
10
10
  } from '../src/EnvironmentManager';
11
11
  import {DEFAULT_OPTIONS} from './test-utils';
12
12
  import {LMDBLiteCache} from '@atlaspack/cache';
13
+ import {getEnvironmentHash} from '../src/Environment';
13
14
 
14
15
  const options = {
15
16
  ...DEFAULT_OPTIONS,
@@ -17,8 +18,14 @@ const options = {
17
18
  } as const;
18
19
 
19
20
  describe('EnvironmentManager', () => {
20
- const env1 = {
21
- id: 'd821e85f6b50315e',
21
+ const envWithId = (env: any) => {
22
+ return {
23
+ ...env,
24
+ id: getEnvironmentHash(env),
25
+ };
26
+ };
27
+
28
+ const env1 = envWithId({
22
29
  context: 'browser',
23
30
  engines: {browsers: ['> 0.25%']},
24
31
  includeNodeModules: true,
@@ -30,9 +37,8 @@ describe('EnvironmentManager', () => {
30
37
  sourceMap: undefined,
31
38
  sourceType: 'module',
32
39
  unstableSingleFileOutput: false,
33
- } as const;
34
- const env2 = {
35
- id: 'de92f48baa8448d2',
40
+ } as const);
41
+ const env2 = envWithId({
36
42
  context: 'node',
37
43
  engines: {
38
44
  browsers: [],
@@ -47,7 +53,7 @@ describe('EnvironmentManager', () => {
47
53
  sourceMap: null,
48
54
  sourceType: 'module',
49
55
  unstableSingleFileOutput: false,
50
- } as const;
56
+ } as const);
51
57
 
52
58
  beforeEach(async () => {
53
59
  await options.cache.ensure();
@@ -78,7 +84,7 @@ describe('EnvironmentManager', () => {
78
84
  setAllEnvironments([env1, env2]);
79
85
  await writeEnvironmentsToCache(options.cache);
80
86
 
81
- const cachedEnvIds = await options.cache.get(
87
+ const cachedEnvIds: string[] | null | undefined = await options.cache.get(
82
88
  `EnvironmentManager/${ATLASPACK_VERSION}`,
83
89
  );
84
90
  const cachedIdsArray = nullthrows(cachedEnvIds);
@@ -104,11 +110,11 @@ describe('EnvironmentManager', () => {
104
110
  const cachedEnv2 = await options.cache.get(
105
111
  `Environment/${ATLASPACK_VERSION}/${env2.id}`,
106
112
  );
107
- assert.deepEqual(cachedEnv1, env1, 'Environment 1 should be cached');
108
- assert.deepEqual(cachedEnv2, env2, 'Environment 2 should be cached');
113
+ assert.deepEqual(cachedEnv1, env1);
114
+ assert.deepEqual(cachedEnv2, env2);
109
115
 
110
116
  // Verify environment IDs were stored in manager
111
- const cachedEnvIds = await options.cache.get(
117
+ const cachedEnvIds: string[] | null | undefined = await options.cache.get(
112
118
  `EnvironmentManager/${ATLASPACK_VERSION}`,
113
119
  );
114
120
  const cachedIdsArray = nullthrows(cachedEnvIds);
@@ -136,16 +142,8 @@ describe('EnvironmentManager', () => {
136
142
  const env1Loaded = loadedEnvironments.find((e: any) => e.id === env1.id);
137
143
  const env2Loaded = loadedEnvironments.find((e: any) => e.id === env2.id);
138
144
 
139
- assert.deepEqual(
140
- env1Loaded,
141
- env1,
142
- 'First environment should match cached environment',
143
- );
144
- assert.deepEqual(
145
- env2Loaded,
146
- env2,
147
- 'Second environment should match cached environment',
148
- );
145
+ assert.deepEqual(env1Loaded, env1);
146
+ assert.deepEqual(env2Loaded, env2);
149
147
  });
150
148
 
151
149
  it('should handle empty cache gracefully without calling setAllEnvironments', async () => {