@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.
- package/CHANGELOG.md +25 -0
- package/lib/Atlaspack.js +1 -1
- package/lib/AtlaspackConfig.js +3 -9
- package/lib/SymbolPropagation.js +1 -4
- package/lib/Transformation.js +0 -1
- package/lib/applyRuntimes.js +2 -0
- package/lib/loadAtlaspackPlugin.js +0 -3
- package/lib/requests/AssetGraphRequest.js +8 -0
- package/lib/requests/AtlaspackConfigRequest.js +0 -3
- package/lib/requests/EntryRequest.js +0 -7
- package/lib/requests/PathRequest.js +2 -6
- package/lib/requests/TargetRequest.js +0 -11
- package/lib/types/types.d.ts +1 -0
- package/package.json +18 -18
- package/src/Atlaspack.ts +1 -1
- package/src/AtlaspackConfig.ts +0 -3
- package/src/BundleGraph.ts +0 -1
- package/src/SymbolPropagation.ts +0 -2
- package/src/Transformation.ts +0 -1
- package/src/applyRuntimes.ts +2 -0
- package/src/loadAtlaspackPlugin.ts +0 -3
- package/src/public/BundleGraph.ts +0 -1
- package/src/requests/AssetGraphRequest.ts +10 -0
- package/src/requests/AtlaspackConfigRequest.ts +0 -3
- package/src/requests/EntryRequest.ts +0 -7
- package/src/requests/PathRequest.ts +0 -2
- package/src/requests/TargetRequest.ts +0 -11
- package/src/types.ts +1 -1
- package/test/Environment.test.ts +8 -8
- package/test/EnvironmentManager.test.ts +18 -20
- package/test/TargetRequest.test.ts +51 -75
- package/test/requests/AssetGraphRequestRust.test.ts +163 -133
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @atlaspack/core
|
|
2
2
|
|
|
3
|
+
## 2.23.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#742](https://github.com/atlassian-labs/atlaspack/pull/742) [`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd) Thanks [@yamadapc](https://github.com/yamadapc)! - Internal changes and bug fixes to environmentDeduplication flag
|
|
8
|
+
|
|
9
|
+
- [#755](https://github.com/atlassian-labs/atlaspack/pull/755) [`b6e72b6`](https://github.com/atlassian-labs/atlaspack/commit/b6e72b6dd2b517cbb0e700fa69e63332d3eacb1e) Thanks [@benjervis](https://github.com/benjervis)! - Allow runtime assets to be marked as requiring execution on load
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd), [`889c65c`](https://github.com/atlassian-labs/atlaspack/commit/889c65cd25b811045e26a117e7404f694dde77a2)]:
|
|
12
|
+
- @atlaspack/package-manager@2.14.26
|
|
13
|
+
- @atlaspack/feature-flags@2.23.1
|
|
14
|
+
- @atlaspack/build-cache@2.13.5
|
|
15
|
+
- @atlaspack/diagnostic@2.14.3
|
|
16
|
+
- @atlaspack/profiler@2.14.23
|
|
17
|
+
- @atlaspack/workers@2.14.26
|
|
18
|
+
- @atlaspack/events@2.14.3
|
|
19
|
+
- @atlaspack/logger@2.14.18
|
|
20
|
+
- @atlaspack/plugin@2.14.26
|
|
21
|
+
- @atlaspack/cache@3.2.21
|
|
22
|
+
- @atlaspack/graph@3.5.15
|
|
23
|
+
- @atlaspack/types@2.15.16
|
|
24
|
+
- @atlaspack/utils@2.18.3
|
|
25
|
+
- @atlaspack/rust@3.6.1
|
|
26
|
+
- @atlaspack/fs@2.15.21
|
|
27
|
+
|
|
3
28
|
## 2.23.1
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
package/lib/Atlaspack.js
CHANGED
|
@@ -128,7 +128,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
128
128
|
const INTERNAL_TRANSFORM = exports.INTERNAL_TRANSFORM = Symbol('internal_transform');
|
|
129
129
|
const INTERNAL_RESOLVE = exports.INTERNAL_RESOLVE = Symbol('internal_resolve');
|
|
130
130
|
let WORKER_PATH = exports.WORKER_PATH = _path().default.join(__dirname, 'worker.js');
|
|
131
|
-
if (
|
|
131
|
+
if (__filename.endsWith('.ts')) {
|
|
132
132
|
exports.WORKER_PATH = WORKER_PATH = _path().default.join(__dirname, 'worker.ts');
|
|
133
133
|
}
|
|
134
134
|
class Atlaspack {
|
package/lib/AtlaspackConfig.js
CHANGED
|
@@ -130,9 +130,7 @@ class AtlaspackConfig {
|
|
|
130
130
|
if (allowEmpty) {
|
|
131
131
|
return [];
|
|
132
132
|
}
|
|
133
|
-
throw await this.missingPluginError(this.transformers,
|
|
134
|
-
// @ts-expect-error TS2345
|
|
135
|
-
(0, _diagnostic().md)`No transformers found for __${(0, _projectPath.fromProjectPathRelative)(filePath)}__` + (pipeline != null ? ` with pipeline: '${pipeline}'` : '') + '.', '/transformers');
|
|
133
|
+
throw await this.missingPluginError(this.transformers, (0, _diagnostic().md)`No transformers found for __${(0, _projectPath.fromProjectPathRelative)(filePath)}__` + (pipeline != null ? ` with pipeline: '${pipeline}'` : '') + '.', '/transformers');
|
|
136
134
|
}
|
|
137
135
|
return this.loadPlugins(transformers);
|
|
138
136
|
}
|
|
@@ -157,9 +155,7 @@ class AtlaspackConfig {
|
|
|
157
155
|
async getPackager(filePath) {
|
|
158
156
|
let packager = this.matchGlobMap((0, _projectPath.toProjectPathUnsafe)(filePath), this.packagers);
|
|
159
157
|
if (!packager) {
|
|
160
|
-
throw await this.missingPluginError(this.packagers,
|
|
161
|
-
// @ts-expect-error TS2345
|
|
162
|
-
(0, _diagnostic().md)`No packager found for __${filePath}__.`, '/packagers');
|
|
158
|
+
throw await this.missingPluginError(this.packagers, (0, _diagnostic().md)`No packager found for __${filePath}__.`, '/packagers');
|
|
163
159
|
}
|
|
164
160
|
return this.loadPlugin(packager);
|
|
165
161
|
}
|
|
@@ -188,9 +184,7 @@ class AtlaspackConfig {
|
|
|
188
184
|
async getCompressors(filePath) {
|
|
189
185
|
let compressors = this.matchGlobMapPipelines((0, _projectPath.toProjectPathUnsafe)(filePath), this.compressors) ?? [];
|
|
190
186
|
if (compressors.length === 0) {
|
|
191
|
-
throw await this.missingPluginError(this.compressors,
|
|
192
|
-
// @ts-expect-error TS2345
|
|
193
|
-
(0, _diagnostic().md)`No compressors found for __${filePath}__.`, '/compressors');
|
|
187
|
+
throw await this.missingPluginError(this.compressors, (0, _diagnostic().md)`No compressors found for __${filePath}__.`, '/compressors');
|
|
194
188
|
}
|
|
195
189
|
return this.loadPlugins(compressors);
|
|
196
190
|
}
|
package/lib/SymbolPropagation.js
CHANGED
|
@@ -402,12 +402,9 @@ function propagateSymbols({
|
|
|
402
402
|
let resolution = (0, _nullthrows().default)(assetGraph.getNode(resolutionNodeId));
|
|
403
403
|
(0, _assert().default)(resolution && (resolution.type === 'asset_group' || resolution.type === 'asset'));
|
|
404
404
|
errors.push({
|
|
405
|
-
// @ts-expect-error TS2345
|
|
406
405
|
message: (0, _diagnostic().md)`${(0, _projectPath.fromProjectPathRelative)(
|
|
407
406
|
// @ts-expect-error TS2345
|
|
408
|
-
resolution.value.filePath
|
|
409
|
-
// @ts-expect-error TS2731
|
|
410
|
-
)} does not export '${s}'`,
|
|
407
|
+
resolution.value.filePath)} does not export '${s}'`,
|
|
411
408
|
origin: '@atlaspack/core',
|
|
412
409
|
codeFrames: loc ? [{
|
|
413
410
|
filePath: (0, _projectPath.fromProjectPath)(options.projectRoot, loc === null || loc === void 0 ? void 0 : loc.filePath) ?? undefined,
|
package/lib/Transformation.js
CHANGED
|
@@ -113,7 +113,6 @@ class Transformation {
|
|
|
113
113
|
} catch (err) {
|
|
114
114
|
_logger().default.verbose([{
|
|
115
115
|
origin: '@atlaspack/core',
|
|
116
|
-
// @ts-expect-error TS2345
|
|
117
116
|
message: (0, _diagnostic().md)`Could not load existing source map for ${(0, _projectPath.fromProjectPathRelative)(asset.value.filePath)}`
|
|
118
117
|
}, {
|
|
119
118
|
origin: '@atlaspack/core',
|
package/lib/applyRuntimes.js
CHANGED
|
@@ -161,11 +161,13 @@ async function applyRuntimes({
|
|
|
161
161
|
filePath,
|
|
162
162
|
isEntry,
|
|
163
163
|
env,
|
|
164
|
+
runtimeAssetRequiringExecutionOnLoad,
|
|
164
165
|
priority
|
|
165
166
|
} of runtimeAssets) {
|
|
166
167
|
let sourceName = _path().default.join(_path().default.dirname(filePath), `runtime-${(0, _rust().hashString)(code)}.${bundle.type}`);
|
|
167
168
|
let assetGroup = {
|
|
168
169
|
code,
|
|
170
|
+
runtimeAssetRequiringExecutionOnLoad,
|
|
169
171
|
filePath: (0, _projectPath.toProjectPath)(options.projectRoot, sourceName),
|
|
170
172
|
env: (0, _Environment.mergeEnvironments)(options.projectRoot, (0, _EnvironmentManager.fromEnvironmentId)(bundle.env), env),
|
|
171
173
|
// Runtime assets should be considered source, as they should be
|
|
@@ -47,7 +47,6 @@ async function loadPlugin(pluginName, configPath, keyPath, options) {
|
|
|
47
47
|
let configContents = await options.inputFS.readFile(configPath, 'utf8');
|
|
48
48
|
throw new (_diagnostic().default)({
|
|
49
49
|
diagnostic: {
|
|
50
|
-
// @ts-expect-error TS2345
|
|
51
50
|
message: (0, _diagnostic().md)`Local plugins are not supported in Atlaspack config packages. Please publish "${pluginName}" as a separate npm package.`,
|
|
52
51
|
origin: '@atlaspack/core',
|
|
53
52
|
codeFrames: keyPath ? [{
|
|
@@ -77,7 +76,6 @@ async function loadPlugin(pluginName, configPath, keyPath, options) {
|
|
|
77
76
|
let alternatives = await (0, _utils().findAlternativeNodeModules)(options.inputFS, pluginName, _path().default.dirname(resolveFrom));
|
|
78
77
|
throw new (_diagnostic().default)({
|
|
79
78
|
diagnostic: {
|
|
80
|
-
// @ts-expect-error TS2345
|
|
81
79
|
message: (0, _diagnostic().md)`Cannot find Atlaspack plugin "${pluginName}"`,
|
|
82
80
|
origin: '@atlaspack/core',
|
|
83
81
|
codeFrames: keyPath ? [{
|
|
@@ -87,7 +85,6 @@ async function loadPlugin(pluginName, configPath, keyPath, options) {
|
|
|
87
85
|
codeHighlights: (0, _diagnostic().generateJSONCodeHighlights)(configContents, [{
|
|
88
86
|
key: keyPath,
|
|
89
87
|
type: 'value',
|
|
90
|
-
// @ts-expect-error TS2345
|
|
91
88
|
message: (0, _diagnostic().md)`Cannot find module "${pluginName}"${alternatives[0] ? `, did you mean "${alternatives[0]}"?` : ''}`
|
|
92
89
|
}])
|
|
93
90
|
}] : undefined
|
|
@@ -415,6 +415,14 @@ class AssetGraphBuilder {
|
|
|
415
415
|
});
|
|
416
416
|
if (assets != null) {
|
|
417
417
|
for (let asset of assets) {
|
|
418
|
+
// Pass the runtimeAssetRequiringExecutionOnLoad flag from the asset
|
|
419
|
+
// group down to the asset itself, for reading in the packager.
|
|
420
|
+
if (input.runtimeAssetRequiringExecutionOnLoad) {
|
|
421
|
+
asset.meta = {
|
|
422
|
+
...(asset.meta ?? {}),
|
|
423
|
+
runtimeAssetRequiringExecutionOnLoad: input.runtimeAssetRequiringExecutionOnLoad
|
|
424
|
+
};
|
|
425
|
+
}
|
|
418
426
|
if (this.assetGraph.safeToIncrementallyBundle) {
|
|
419
427
|
let otherAsset = this.assetGraph.getNodeByContentKey(asset.id);
|
|
420
428
|
if (otherAsset != null) {
|
|
@@ -151,7 +151,6 @@ async function resolveAtlaspackConfig(options) {
|
|
|
151
151
|
} catch (e) {
|
|
152
152
|
throw new (_diagnostic().default)({
|
|
153
153
|
diagnostic: {
|
|
154
|
-
// @ts-expect-error TS2345
|
|
155
154
|
message: (0, _diagnostic().md)`Could not find parcel config at ${_path().default.relative(options.projectRoot, configPath)}`,
|
|
156
155
|
origin: '@atlaspack/core'
|
|
157
156
|
}
|
|
@@ -359,7 +358,6 @@ async function resolveExtends(ext, configPath, extendsKey, options) {
|
|
|
359
358
|
codeHighlights: (0, _diagnostic().generateJSONCodeHighlights)(parentContents, [{
|
|
360
359
|
key: extendsKey,
|
|
361
360
|
type: 'value',
|
|
362
|
-
// @ts-expect-error TS2345
|
|
363
361
|
message: (0, _diagnostic().md)`Cannot find module "${ext}"${alternatives[0] ? `, did you mean "${alternatives[0]}"?` : ''}`
|
|
364
362
|
}])
|
|
365
363
|
}]
|
|
@@ -386,7 +384,6 @@ async function processExtendedConfig(configPath, extendsKey, extendsSpecifier, r
|
|
|
386
384
|
codeHighlights: (0, _diagnostic().generateJSONCodeHighlights)(parentContents, [{
|
|
387
385
|
key: extendsKey,
|
|
388
386
|
type: 'value',
|
|
389
|
-
// @ts-expect-error TS2345
|
|
390
387
|
message: (0, _diagnostic().md)`"${extendsSpecifier}" does not exist${alternatives[0] ? `, did you mean "${alternatives[0]}"?` : ''}`
|
|
391
388
|
}])
|
|
392
389
|
}]
|
|
@@ -92,7 +92,6 @@ async function assertFile(fs, entry, relativeSource, pkgFilePath, keyPath, optio
|
|
|
92
92
|
throw new (_diagnostic().default)({
|
|
93
93
|
diagnostic: {
|
|
94
94
|
origin: '@atlaspack/core',
|
|
95
|
-
// @ts-expect-error TS2345
|
|
96
95
|
message: (0, _diagnostic().md)`${_path().default.relative(process.cwd(), source)} does not exist.`,
|
|
97
96
|
codeFrames: [{
|
|
98
97
|
filePath: pkgFilePath,
|
|
@@ -102,7 +101,6 @@ async function assertFile(fs, entry, relativeSource, pkgFilePath, keyPath, optio
|
|
|
102
101
|
}])
|
|
103
102
|
}],
|
|
104
103
|
hints: alternatives.map(r => {
|
|
105
|
-
// @ts-expect-error TS2345
|
|
106
104
|
return (0, _diagnostic().md)`Did you mean '__${r}__'?`;
|
|
107
105
|
})
|
|
108
106
|
}
|
|
@@ -113,7 +111,6 @@ async function assertFile(fs, entry, relativeSource, pkgFilePath, keyPath, optio
|
|
|
113
111
|
throw new (_diagnostic().default)({
|
|
114
112
|
diagnostic: {
|
|
115
113
|
origin: '@atlaspack/core',
|
|
116
|
-
// @ts-expect-error TS2345
|
|
117
114
|
message: (0, _diagnostic().md)`${_path().default.relative(process.cwd(), source)} is not a file.`,
|
|
118
115
|
codeFrames: [{
|
|
119
116
|
filePath: pkgFilePath,
|
|
@@ -138,7 +135,6 @@ class EntryResolver {
|
|
|
138
135
|
if (!(0, _utils().isGlob)(entry)) {
|
|
139
136
|
throw new (_diagnostic().default)({
|
|
140
137
|
diagnostic: {
|
|
141
|
-
// @ts-expect-error TS2345
|
|
142
138
|
message: (0, _diagnostic().md)`Entry ${entry} does not exist`
|
|
143
139
|
}
|
|
144
140
|
});
|
|
@@ -250,7 +246,6 @@ class EntryResolver {
|
|
|
250
246
|
}
|
|
251
247
|
throw new (_diagnostic().default)({
|
|
252
248
|
diagnostic: {
|
|
253
|
-
// @ts-expect-error TS2345
|
|
254
249
|
message: (0, _diagnostic().md)`Could not find entry: ${entry}`
|
|
255
250
|
}
|
|
256
251
|
});
|
|
@@ -268,7 +263,6 @@ class EntryResolver {
|
|
|
268
263
|
}
|
|
269
264
|
throw new (_diagnostic().default)({
|
|
270
265
|
diagnostic: {
|
|
271
|
-
// @ts-expect-error TS2345
|
|
272
266
|
message: (0, _diagnostic().md)`Unknown entry: ${entry}`
|
|
273
267
|
}
|
|
274
268
|
});
|
|
@@ -287,7 +281,6 @@ class EntryResolver {
|
|
|
287
281
|
// TODO: code frame?
|
|
288
282
|
throw new (_diagnostic().default)({
|
|
289
283
|
diagnostic: {
|
|
290
|
-
// @ts-expect-error TS2345
|
|
291
284
|
message: (0, _diagnostic().md)`Error parsing ${_path().default.relative(this.options.inputFS.cwd(), pkgFile)}: ${err.message}`
|
|
292
285
|
}
|
|
293
286
|
});
|
|
@@ -302,9 +302,7 @@ class ResolverRunner {
|
|
|
302
302
|
var _result$query;
|
|
303
303
|
let resultFilePath = result.filePath;
|
|
304
304
|
if (!_path().default.isAbsolute(resultFilePath)) {
|
|
305
|
-
throw new Error(
|
|
306
|
-
// @ts-expect-error TS2345
|
|
307
|
-
(0, _diagnostic().md)`Resolvers must return an absolute path, ${resolver.name} returned: ${resultFilePath}`);
|
|
305
|
+
throw new Error((0, _diagnostic().md)`Resolvers must return an absolute path, ${resolver.name} returned: ${resultFilePath}`);
|
|
308
306
|
}
|
|
309
307
|
return {
|
|
310
308
|
assetGroup: {
|
|
@@ -366,9 +364,7 @@ class ResolverRunner {
|
|
|
366
364
|
}
|
|
367
365
|
let resolveFrom = dependency.resolveFrom ?? dependency.sourcePath;
|
|
368
366
|
let dir = resolveFrom != null ? (0, _utils().normalizePath)((0, _projectPath.fromProjectPathRelative)(resolveFrom)) : '';
|
|
369
|
-
let diagnostic = await this.getDiagnostic(dependency,
|
|
370
|
-
// @ts-expect-error TS2345
|
|
371
|
-
(0, _diagnostic().md)`Failed to resolve '${dependency.specifier}' ${dir ? `from '${dir}'` : ''}`);
|
|
367
|
+
let diagnostic = await this.getDiagnostic(dependency, (0, _diagnostic().md)`Failed to resolve '${dependency.specifier}' ${dir ? `from '${dir}'` : ''}`);
|
|
372
368
|
diagnostics.unshift(diagnostic);
|
|
373
369
|
return {
|
|
374
370
|
assetGroup: null,
|
|
@@ -180,7 +180,6 @@ class TargetResolver {
|
|
|
180
180
|
if (!packageTargets.has(target)) {
|
|
181
181
|
throw new (_diagnostic().default)({
|
|
182
182
|
diagnostic: {
|
|
183
|
-
// @ts-expect-error TS2345
|
|
184
183
|
message: (0, _diagnostic().md)`Could not find target with name "${target}"`,
|
|
185
184
|
origin: '@atlaspack/core'
|
|
186
185
|
}
|
|
@@ -202,7 +201,6 @@ class TargetResolver {
|
|
|
202
201
|
let optionTargetsString = JSON.stringify(optionTargets, null, '\t');
|
|
203
202
|
throw new (_diagnostic().default)({
|
|
204
203
|
diagnostic: {
|
|
205
|
-
// @ts-expect-error TS2345
|
|
206
204
|
message: (0, _diagnostic().md)`Missing distDir for target "${name}"`,
|
|
207
205
|
origin: '@atlaspack/core',
|
|
208
206
|
codeFrames: [{
|
|
@@ -314,7 +312,6 @@ class TargetResolver {
|
|
|
314
312
|
if (pkgFile == null) {
|
|
315
313
|
throw new (_diagnostic().default)({
|
|
316
314
|
diagnostic: {
|
|
317
|
-
// @ts-expect-error TS2345
|
|
318
315
|
message: (0, _diagnostic().md)`Expected package.json file in ${rootDir}`,
|
|
319
316
|
origin: '@atlaspack/core'
|
|
320
317
|
}
|
|
@@ -538,7 +535,6 @@ class TargetResolver {
|
|
|
538
535
|
let ext = _path().default.extname(distEntry);
|
|
539
536
|
throw new (_diagnostic().default)({
|
|
540
537
|
diagnostic: {
|
|
541
|
-
// @ts-expect-error TS2345
|
|
542
538
|
message: (0, _diagnostic().md)`Unexpected output file type ${ext} in target "${targetName}"`,
|
|
543
539
|
origin: '@atlaspack/core',
|
|
544
540
|
codeFrames: [{
|
|
@@ -560,7 +556,6 @@ class TargetResolver {
|
|
|
560
556
|
let contents = typeof pkgContents === 'string' ? pkgContents : JSON.stringify(pkgContents, null, '\t');
|
|
561
557
|
throw new (_diagnostic().default)({
|
|
562
558
|
diagnostic: {
|
|
563
|
-
// @ts-expect-error TS2345
|
|
564
559
|
message: (0, _diagnostic().md)`The "global" output format is not supported in the "${targetName}" target.`,
|
|
565
560
|
origin: '@atlaspack/core',
|
|
566
561
|
codeFrames: [{
|
|
@@ -587,7 +582,6 @@ class TargetResolver {
|
|
|
587
582
|
throw new (_diagnostic().default)({
|
|
588
583
|
diagnostic: {
|
|
589
584
|
// prettier-ignore
|
|
590
|
-
// @ts-expect-error TS2345
|
|
591
585
|
message: (0, _diagnostic().md)`Output format "esmodule" cannot be used in the "main" target without a .mjs extension or "type": "module" field.`,
|
|
592
586
|
origin: '@atlaspack/core',
|
|
593
587
|
codeFrames: [{
|
|
@@ -719,7 +713,6 @@ class TargetResolver {
|
|
|
719
713
|
let contents = typeof pkgContents === 'string' ? pkgContents : JSON.stringify(pkgContents, null, '\t');
|
|
720
714
|
throw new (_diagnostic().default)({
|
|
721
715
|
diagnostic: {
|
|
722
|
-
// @ts-expect-error TS2345
|
|
723
716
|
message: (0, _diagnostic().md)`Invalid distPath for target "${targetName}"`,
|
|
724
717
|
origin: '@atlaspack/core',
|
|
725
718
|
codeFrames: [{
|
|
@@ -911,7 +904,6 @@ class TargetResolver {
|
|
|
911
904
|
});
|
|
912
905
|
throw new (_diagnostic().default)({
|
|
913
906
|
diagnostic: {
|
|
914
|
-
// @ts-expect-error TS2345
|
|
915
907
|
message: (0, _diagnostic().md)`Declared output format "${descriptor.outputFormat}" does not match expected output format "${inferredOutputFormat}".`,
|
|
916
908
|
origin: '@atlaspack/core',
|
|
917
909
|
codeFrames: [{
|
|
@@ -1009,7 +1001,6 @@ function assertNoDuplicateTargets(options, targets, pkgFilePath, pkgContents) {
|
|
|
1009
1001
|
for (let [targetPath, targetNames] of targetsByPath) {
|
|
1010
1002
|
if (targetNames.length > 1 && pkgContents != null && pkgFilePath != null) {
|
|
1011
1003
|
diagnostics.push({
|
|
1012
|
-
// @ts-expect-error TS2345
|
|
1013
1004
|
message: (0, _diagnostic().md)`Multiple targets have the same destination path "${_path().default.relative(_path().default.dirname(pkgFilePath), targetPath)}"`,
|
|
1014
1005
|
origin: '@atlaspack/core',
|
|
1015
1006
|
codeFrames: [{
|
|
@@ -1150,7 +1141,6 @@ async function debugResolvedTargets(input, targets, targetInfo, options) {
|
|
|
1150
1141
|
highlight.type = null;
|
|
1151
1142
|
}
|
|
1152
1143
|
if (keyInfo.path) {
|
|
1153
|
-
// @ts-expect-error TS2345
|
|
1154
1144
|
highlight.defined = (0, _diagnostic().md)`${key} defined here`;
|
|
1155
1145
|
}
|
|
1156
1146
|
if (keyInfo.inferred) {
|
|
@@ -1193,7 +1183,6 @@ async function debugResolvedTargets(input, targets, targetInfo, options) {
|
|
|
1193
1183
|
v.message != null ? _diagnostic().md.italic(v.message) : '';
|
|
1194
1184
|
_logger().default.verbose({
|
|
1195
1185
|
origin: '@atlaspack/core',
|
|
1196
|
-
// @ts-expect-error TS2345
|
|
1197
1186
|
message: (0, _diagnostic().md)`**Target** "${target.name}"
|
|
1198
1187
|
|
|
1199
1188
|
**Entry**: ${_path().default.relative(process.cwd(), (0, _projectPath.fromProjectPath)(options.projectRoot, input.filePath))}
|
package/lib/types/types.d.ts
CHANGED
|
@@ -322,6 +322,7 @@ export type AssetRequestInput = {
|
|
|
322
322
|
isSource?: boolean;
|
|
323
323
|
canDefer?: boolean;
|
|
324
324
|
sideEffects?: boolean;
|
|
325
|
+
runtimeAssetRequiringExecutionOnLoad?: boolean;
|
|
325
326
|
code?: string;
|
|
326
327
|
pipeline?: string | null | undefined;
|
|
327
328
|
optionsRef: SharedReference;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/core",
|
|
3
|
-
"version": "2.23.
|
|
3
|
+
"version": "2.23.3-inline-requires-take-2-2a0c642df.0",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -23,21 +23,21 @@
|
|
|
23
23
|
"build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@atlaspack/build-cache": "2.13.
|
|
27
|
-
"@atlaspack/cache": "3.2.
|
|
28
|
-
"@atlaspack/diagnostic": "2.14.
|
|
29
|
-
"@atlaspack/events": "2.14.
|
|
30
|
-
"@atlaspack/feature-flags": "2.23.
|
|
31
|
-
"@atlaspack/fs": "2.15.
|
|
32
|
-
"@atlaspack/graph": "3.5.
|
|
33
|
-
"@atlaspack/logger": "2.14.
|
|
34
|
-
"@atlaspack/package-manager": "2.14.
|
|
35
|
-
"@atlaspack/plugin": "2.14.
|
|
36
|
-
"@atlaspack/profiler": "2.14.
|
|
37
|
-
"@atlaspack/rust": "3.6.
|
|
38
|
-
"@atlaspack/types": "2.15.
|
|
39
|
-
"@atlaspack/utils": "2.18.
|
|
40
|
-
"@atlaspack/workers": "2.14.
|
|
26
|
+
"@atlaspack/build-cache": "2.13.6-inline-requires-take-2-2a0c642df.0",
|
|
27
|
+
"@atlaspack/cache": "3.2.22-inline-requires-take-2-2a0c642df.0",
|
|
28
|
+
"@atlaspack/diagnostic": "2.14.4-inline-requires-take-2-2a0c642df.0",
|
|
29
|
+
"@atlaspack/events": "2.14.4-inline-requires-take-2-2a0c642df.0",
|
|
30
|
+
"@atlaspack/feature-flags": "2.23.2-inline-requires-take-2-2a0c642df.0",
|
|
31
|
+
"@atlaspack/fs": "2.15.22-inline-requires-take-2-2a0c642df.0",
|
|
32
|
+
"@atlaspack/graph": "3.5.16-inline-requires-take-2-2a0c642df.0",
|
|
33
|
+
"@atlaspack/logger": "2.14.19-inline-requires-take-2-2a0c642df.0",
|
|
34
|
+
"@atlaspack/package-manager": "2.14.27-inline-requires-take-2-2a0c642df.0",
|
|
35
|
+
"@atlaspack/plugin": "2.14.27-inline-requires-take-2-2a0c642df.0",
|
|
36
|
+
"@atlaspack/profiler": "2.14.24-inline-requires-take-2-2a0c642df.0",
|
|
37
|
+
"@atlaspack/rust": "3.6.2-inline-requires-take-2-2a0c642df.0",
|
|
38
|
+
"@atlaspack/types": "2.15.17-inline-requires-take-2-2a0c642df.0",
|
|
39
|
+
"@atlaspack/utils": "2.18.4-inline-requires-take-2-2a0c642df.0",
|
|
40
|
+
"@atlaspack/workers": "2.14.27-inline-requires-take-2-2a0c642df.0",
|
|
41
41
|
"@mischnic/json-sourcemap": "^0.1.0",
|
|
42
42
|
"@parcel/source-map": "^2.1.1",
|
|
43
43
|
"base-x": "^3.0.8",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"semver": "^7.5.2"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@atlaspack/babel-register": "2.14.
|
|
54
|
+
"@atlaspack/babel-register": "2.14.4-inline-requires-take-2-2a0c642df.0",
|
|
55
55
|
"@types/node": ">= 18",
|
|
56
56
|
"graphviz": "^0.0.9",
|
|
57
57
|
"jest-diff": "*",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"./src/serializerCore.js": "./src/serializerCore.browser.js"
|
|
63
63
|
},
|
|
64
64
|
"type": "commonjs",
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "2a0c642dfe354e30a8cbd23be0b1a283eab54040"
|
|
66
66
|
}
|
package/src/Atlaspack.ts
CHANGED
|
@@ -70,7 +70,7 @@ registerCoreWithSerializer();
|
|
|
70
70
|
export const INTERNAL_TRANSFORM: symbol = Symbol('internal_transform');
|
|
71
71
|
export const INTERNAL_RESOLVE: symbol = Symbol('internal_resolve');
|
|
72
72
|
export let WORKER_PATH: string = path.join(__dirname, 'worker.js');
|
|
73
|
-
if (
|
|
73
|
+
if (__filename.endsWith('.ts')) {
|
|
74
74
|
WORKER_PATH = path.join(__dirname, 'worker.ts');
|
|
75
75
|
}
|
|
76
76
|
|
package/src/AtlaspackConfig.ts
CHANGED
|
@@ -208,7 +208,6 @@ export class AtlaspackConfig {
|
|
|
208
208
|
|
|
209
209
|
throw await this.missingPluginError(
|
|
210
210
|
this.transformers,
|
|
211
|
-
// @ts-expect-error TS2345
|
|
212
211
|
md`No transformers found for __${fromProjectPathRelative(filePath)}__` +
|
|
213
212
|
(pipeline != null ? ` with pipeline: '${pipeline}'` : '') +
|
|
214
213
|
'.',
|
|
@@ -261,7 +260,6 @@ export class AtlaspackConfig {
|
|
|
261
260
|
if (!packager) {
|
|
262
261
|
throw await this.missingPluginError(
|
|
263
262
|
this.packagers,
|
|
264
|
-
// @ts-expect-error TS2345
|
|
265
263
|
md`No packager found for __${filePath}__.`,
|
|
266
264
|
'/packagers',
|
|
267
265
|
);
|
|
@@ -325,7 +323,6 @@ export class AtlaspackConfig {
|
|
|
325
323
|
if (compressors.length === 0) {
|
|
326
324
|
throw await this.missingPluginError(
|
|
327
325
|
this.compressors,
|
|
328
|
-
// @ts-expect-error TS2345
|
|
329
326
|
md`No compressors found for __${filePath}__.`,
|
|
330
327
|
'/compressors',
|
|
331
328
|
);
|
package/src/BundleGraph.ts
CHANGED
package/src/SymbolPropagation.ts
CHANGED
|
@@ -525,11 +525,9 @@ export function propagateSymbols({
|
|
|
525
525
|
);
|
|
526
526
|
|
|
527
527
|
errors.push({
|
|
528
|
-
// @ts-expect-error TS2345
|
|
529
528
|
message: md`${fromProjectPathRelative(
|
|
530
529
|
// @ts-expect-error TS2345
|
|
531
530
|
resolution.value.filePath,
|
|
532
|
-
// @ts-expect-error TS2731
|
|
533
531
|
)} does not export '${s}'`,
|
|
534
532
|
origin: '@atlaspack/core',
|
|
535
533
|
codeFrames: loc
|
package/src/Transformation.ts
CHANGED
package/src/applyRuntimes.ts
CHANGED
|
@@ -150,6 +150,7 @@ export default async function applyRuntimes<TResult extends RequestResult>({
|
|
|
150
150
|
filePath,
|
|
151
151
|
isEntry,
|
|
152
152
|
env,
|
|
153
|
+
runtimeAssetRequiringExecutionOnLoad,
|
|
153
154
|
priority,
|
|
154
155
|
} of runtimeAssets) {
|
|
155
156
|
let sourceName = path.join(
|
|
@@ -159,6 +160,7 @@ export default async function applyRuntimes<TResult extends RequestResult>({
|
|
|
159
160
|
|
|
160
161
|
let assetGroup = {
|
|
161
162
|
code,
|
|
163
|
+
runtimeAssetRequiringExecutionOnLoad,
|
|
162
164
|
filePath: toProjectPath(options.projectRoot, sourceName),
|
|
163
165
|
env: mergeEnvironments(
|
|
164
166
|
options.projectRoot,
|
|
@@ -31,7 +31,6 @@ export default async function loadPlugin<T>(
|
|
|
31
31
|
let configContents = await options.inputFS.readFile(configPath, 'utf8');
|
|
32
32
|
throw new ThrowableDiagnostic({
|
|
33
33
|
diagnostic: {
|
|
34
|
-
// @ts-expect-error TS2345
|
|
35
34
|
message: md`Local plugins are not supported in Atlaspack config packages. Please publish "${pluginName}" as a separate npm package.`,
|
|
36
35
|
origin: '@atlaspack/core',
|
|
37
36
|
codeFrames: keyPath
|
|
@@ -71,7 +70,6 @@ export default async function loadPlugin<T>(
|
|
|
71
70
|
);
|
|
72
71
|
throw new ThrowableDiagnostic({
|
|
73
72
|
diagnostic: {
|
|
74
|
-
// @ts-expect-error TS2345
|
|
75
73
|
message: md`Cannot find Atlaspack plugin "${pluginName}"`,
|
|
76
74
|
origin: '@atlaspack/core',
|
|
77
75
|
codeFrames: keyPath
|
|
@@ -84,7 +82,6 @@ export default async function loadPlugin<T>(
|
|
|
84
82
|
{
|
|
85
83
|
key: keyPath,
|
|
86
84
|
type: 'value',
|
|
87
|
-
// @ts-expect-error TS2345
|
|
88
85
|
message: md`Cannot find module "${pluginName}"${
|
|
89
86
|
alternatives[0]
|
|
90
87
|
? `, did you mean "${alternatives[0]}"?`
|
|
@@ -560,6 +560,16 @@ export class AssetGraphBuilder {
|
|
|
560
560
|
|
|
561
561
|
if (assets != null) {
|
|
562
562
|
for (let asset of assets) {
|
|
563
|
+
// Pass the runtimeAssetRequiringExecutionOnLoad flag from the asset
|
|
564
|
+
// group down to the asset itself, for reading in the packager.
|
|
565
|
+
if (input.runtimeAssetRequiringExecutionOnLoad) {
|
|
566
|
+
asset.meta = {
|
|
567
|
+
...(asset.meta ?? {}),
|
|
568
|
+
runtimeAssetRequiringExecutionOnLoad:
|
|
569
|
+
input.runtimeAssetRequiringExecutionOnLoad,
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
|
|
563
573
|
if (this.assetGraph.safeToIncrementallyBundle) {
|
|
564
574
|
let otherAsset = this.assetGraph.getNodeByContentKey(asset.id);
|
|
565
575
|
if (otherAsset != null) {
|
|
@@ -184,7 +184,6 @@ export async function resolveAtlaspackConfig(
|
|
|
184
184
|
} catch (e: any) {
|
|
185
185
|
throw new ThrowableDiagnostic({
|
|
186
186
|
diagnostic: {
|
|
187
|
-
// @ts-expect-error TS2345
|
|
188
187
|
message: md`Could not find parcel config at ${path.relative(
|
|
189
188
|
options.projectRoot,
|
|
190
189
|
configPath,
|
|
@@ -520,7 +519,6 @@ export async function resolveExtends(
|
|
|
520
519
|
{
|
|
521
520
|
key: extendsKey,
|
|
522
521
|
type: 'value',
|
|
523
|
-
// @ts-expect-error TS2345
|
|
524
522
|
message: md`Cannot find module "${ext}"${
|
|
525
523
|
alternatives[0]
|
|
526
524
|
? `, did you mean "${alternatives[0]}"?`
|
|
@@ -570,7 +568,6 @@ async function processExtendedConfig(
|
|
|
570
568
|
{
|
|
571
569
|
key: extendsKey,
|
|
572
570
|
type: 'value',
|
|
573
|
-
// @ts-expect-error TS2345
|
|
574
571
|
message: md`"${extendsSpecifier}" does not exist${
|
|
575
572
|
alternatives[0] ? `, did you mean "${alternatives[0]}"?` : ''
|
|
576
573
|
}`,
|
|
@@ -107,7 +107,6 @@ async function assertFile(
|
|
|
107
107
|
throw new ThrowableDiagnostic({
|
|
108
108
|
diagnostic: {
|
|
109
109
|
origin: '@atlaspack/core',
|
|
110
|
-
// @ts-expect-error TS2345
|
|
111
110
|
message: md`${path.relative(process.cwd(), source)} does not exist.`,
|
|
112
111
|
codeFrames: [
|
|
113
112
|
{
|
|
@@ -121,7 +120,6 @@ async function assertFile(
|
|
|
121
120
|
},
|
|
122
121
|
],
|
|
123
122
|
hints: alternatives.map((r) => {
|
|
124
|
-
// @ts-expect-error TS2345
|
|
125
123
|
return md`Did you mean '__${r}__'?`;
|
|
126
124
|
}),
|
|
127
125
|
},
|
|
@@ -133,7 +131,6 @@ async function assertFile(
|
|
|
133
131
|
throw new ThrowableDiagnostic({
|
|
134
132
|
diagnostic: {
|
|
135
133
|
origin: '@atlaspack/core',
|
|
136
|
-
// @ts-expect-error TS2345
|
|
137
134
|
message: md`${path.relative(process.cwd(), source)} is not a file.`,
|
|
138
135
|
codeFrames: [
|
|
139
136
|
{
|
|
@@ -166,7 +163,6 @@ export class EntryResolver {
|
|
|
166
163
|
if (!isGlob(entry)) {
|
|
167
164
|
throw new ThrowableDiagnostic({
|
|
168
165
|
diagnostic: {
|
|
169
|
-
// @ts-expect-error TS2345
|
|
170
166
|
message: md`Entry ${entry} does not exist`,
|
|
171
167
|
},
|
|
172
168
|
});
|
|
@@ -319,7 +315,6 @@ export class EntryResolver {
|
|
|
319
315
|
|
|
320
316
|
throw new ThrowableDiagnostic({
|
|
321
317
|
diagnostic: {
|
|
322
|
-
// @ts-expect-error TS2345
|
|
323
318
|
message: md`Could not find entry: ${entry}`,
|
|
324
319
|
},
|
|
325
320
|
});
|
|
@@ -346,7 +341,6 @@ export class EntryResolver {
|
|
|
346
341
|
|
|
347
342
|
throw new ThrowableDiagnostic({
|
|
348
343
|
diagnostic: {
|
|
349
|
-
// @ts-expect-error TS2345
|
|
350
344
|
message: md`Unknown entry: ${entry}`,
|
|
351
345
|
},
|
|
352
346
|
});
|
|
@@ -379,7 +373,6 @@ export class EntryResolver {
|
|
|
379
373
|
// TODO: code frame?
|
|
380
374
|
throw new ThrowableDiagnostic({
|
|
381
375
|
diagnostic: {
|
|
382
|
-
// @ts-expect-error TS2345
|
|
383
376
|
message: md`Error parsing ${path.relative(
|
|
384
377
|
this.options.inputFS.cwd(),
|
|
385
378
|
pkgFile,
|
|
@@ -357,7 +357,6 @@ export class ResolverRunner {
|
|
|
357
357
|
let resultFilePath = result.filePath;
|
|
358
358
|
if (!path.isAbsolute(resultFilePath)) {
|
|
359
359
|
throw new Error(
|
|
360
|
-
// @ts-expect-error TS2345
|
|
361
360
|
md`Resolvers must return an absolute path, ${resolver.name} returned: ${resultFilePath}`,
|
|
362
361
|
);
|
|
363
362
|
}
|
|
@@ -449,7 +448,6 @@ export class ResolverRunner {
|
|
|
449
448
|
|
|
450
449
|
let diagnostic = await this.getDiagnostic(
|
|
451
450
|
dependency,
|
|
452
|
-
// @ts-expect-error TS2345
|
|
453
451
|
md`Failed to resolve '${dependency.specifier}' ${
|
|
454
452
|
dir ? `from '${dir}'` : ''
|
|
455
453
|
}`,
|