@atlaspack/core 2.13.2-dev.3674 → 2.13.2-dev.3682
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/lib/loadAtlaspackPlugin.js +18 -30
- package/lib/requests/AtlaspackBuildRequest.js +3 -2
- package/lib/requests/BundleGraphRequest.js +1 -1
- package/package.json +17 -17
- package/src/AtlaspackConfig.js +0 -3
- package/src/loadAtlaspackPlugin.js +28 -52
- package/src/requests/AtlaspackBuildRequest.js +4 -2
- package/src/requests/BundleGraphRequest.js +3 -1
|
@@ -41,7 +41,6 @@ const NODE_MODULES = `${_path().default.sep}node_modules${_path().default.sep}`;
|
|
|
41
41
|
const CONFIG = Symbol.for('parcel-plugin-config');
|
|
42
42
|
async function loadPlugin(pluginName, configPath, keyPath, options) {
|
|
43
43
|
let resolveFrom = configPath;
|
|
44
|
-
let range;
|
|
45
44
|
if (resolveFrom.includes(NODE_MODULES)) {
|
|
46
45
|
var _configPkg$config$dep;
|
|
47
46
|
// Config packages can reference plugins, but cannot contain other plugins within them.
|
|
@@ -66,31 +65,22 @@ async function loadPlugin(pluginName, configPath, keyPath, options) {
|
|
|
66
65
|
}
|
|
67
66
|
let configPkg = await (0, _utils().loadConfig)(options.inputFS, resolveFrom, ['package.json'], options.projectRoot);
|
|
68
67
|
if (configPkg != null && ((_configPkg$config$dep = configPkg.config.dependencies) === null || _configPkg$config$dep === void 0 ? void 0 : _configPkg$config$dep[pluginName]) == null) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
type: 'key'
|
|
86
|
-
}])
|
|
87
|
-
}] : undefined
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Resolve from project root if not in the config's dependencies.
|
|
93
|
-
resolveFrom = _path().default.join(options.projectRoot, 'index');
|
|
68
|
+
let contents = await options.inputFS.readFile(configPkg.files[0].filePath, 'utf8');
|
|
69
|
+
throw new (_diagnostic().default)({
|
|
70
|
+
diagnostic: {
|
|
71
|
+
message: (0, _diagnostic().md)`Could not determine version of ${pluginName} in ${_path().default.relative(process.cwd(), resolveFrom)}. Include it in "dependencies".`,
|
|
72
|
+
origin: '@atlaspack/core',
|
|
73
|
+
codeFrames: configPkg.config.dependencies ? [{
|
|
74
|
+
filePath: configPkg.files[0].filePath,
|
|
75
|
+
language: 'json5',
|
|
76
|
+
code: contents,
|
|
77
|
+
codeHighlights: (0, _diagnostic().generateJSONCodeHighlights)(contents, [{
|
|
78
|
+
key: '/dependencies',
|
|
79
|
+
type: 'key'
|
|
80
|
+
}])
|
|
81
|
+
}] : undefined
|
|
82
|
+
}
|
|
83
|
+
});
|
|
94
84
|
}
|
|
95
85
|
}
|
|
96
86
|
let resolved, pkg;
|
|
@@ -99,8 +89,7 @@ async function loadPlugin(pluginName, configPath, keyPath, options) {
|
|
|
99
89
|
resolved,
|
|
100
90
|
pkg
|
|
101
91
|
} = await options.packageManager.resolve(pluginName, resolveFrom, {
|
|
102
|
-
shouldAutoInstall: options.shouldAutoInstall
|
|
103
|
-
range
|
|
92
|
+
shouldAutoInstall: options.shouldAutoInstall
|
|
104
93
|
}));
|
|
105
94
|
} catch (err) {
|
|
106
95
|
if (err.code !== 'MODULE_NOT_FOUND') {
|
|
@@ -142,7 +131,6 @@ async function loadPlugin(pluginName, configPath, keyPath, options) {
|
|
|
142
131
|
return {
|
|
143
132
|
plugin,
|
|
144
133
|
version: (0, _nullthrows().default)(pkg).version,
|
|
145
|
-
resolveFrom: (0, _projectPath.toProjectPath)(options.projectRoot, resolveFrom)
|
|
146
|
-
range
|
|
134
|
+
resolveFrom: (0, _projectPath.toProjectPath)(options.projectRoot, resolveFrom)
|
|
147
135
|
};
|
|
148
136
|
}
|
|
@@ -33,7 +33,8 @@ function createAtlaspackBuildRequest(input) {
|
|
|
33
33
|
async function run({
|
|
34
34
|
input,
|
|
35
35
|
api,
|
|
36
|
-
options
|
|
36
|
+
options,
|
|
37
|
+
rustAtlaspack
|
|
37
38
|
}) {
|
|
38
39
|
let {
|
|
39
40
|
optionsRef,
|
|
@@ -50,7 +51,7 @@ async function run({
|
|
|
50
51
|
changedAssets,
|
|
51
52
|
assetRequests
|
|
52
53
|
} = await api.runRequest(bundleGraphRequest, {
|
|
53
|
-
force: options.shouldBuildLazily && requestedAssetIds.size > 0
|
|
54
|
+
force: Boolean(rustAtlaspack) || options.shouldBuildLazily && requestedAssetIds.size > 0
|
|
54
55
|
});
|
|
55
56
|
|
|
56
57
|
// $FlowFixMe Added in Flow 0.121.0 upgrade in #4381 (Windows only)
|
|
@@ -146,7 +146,7 @@ function createBundleGraphRequest(input) {
|
|
|
146
146
|
changedAssets,
|
|
147
147
|
assetRequests
|
|
148
148
|
} = await api.runRequest(request, {
|
|
149
|
-
force: options.shouldBuildLazily && requestedAssetIds.size > 0
|
|
149
|
+
force: Boolean(input.rustAtlaspack) || options.shouldBuildLazily && requestedAssetIds.size > 0
|
|
150
150
|
});
|
|
151
151
|
if ((_input$options$featur = input.options.featureFlags) !== null && _input$options$featur !== void 0 && _input$options$featur.loadableSideEffects) {
|
|
152
152
|
applySideEffectsForLoadableImports(assetGraph);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/core",
|
|
3
|
-
"version": "2.13.2-dev.
|
|
3
|
+
"version": "2.13.2-dev.3682+e6c0286ea",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -20,21 +20,21 @@
|
|
|
20
20
|
"check-ts": "tsc --noEmit index.d.ts"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@atlaspack/build-cache": "2.13.2-dev.
|
|
24
|
-
"@atlaspack/cache": "2.13.2-dev.
|
|
25
|
-
"@atlaspack/diagnostic": "2.13.2-dev.
|
|
26
|
-
"@atlaspack/events": "2.13.2-dev.
|
|
27
|
-
"@atlaspack/feature-flags": "2.13.2-dev.
|
|
28
|
-
"@atlaspack/fs": "2.13.2-dev.
|
|
29
|
-
"@atlaspack/graph": "3.3.2-dev.
|
|
30
|
-
"@atlaspack/logger": "2.13.2-dev.
|
|
31
|
-
"@atlaspack/package-manager": "2.13.2-dev.
|
|
32
|
-
"@atlaspack/plugin": "2.13.2-dev.
|
|
33
|
-
"@atlaspack/profiler": "2.13.2-dev.
|
|
34
|
-
"@atlaspack/rust": "2.13.2-dev.
|
|
35
|
-
"@atlaspack/types": "2.13.2-dev.
|
|
36
|
-
"@atlaspack/utils": "2.13.2-dev.
|
|
37
|
-
"@atlaspack/workers": "2.13.2-dev.
|
|
23
|
+
"@atlaspack/build-cache": "2.13.2-dev.3682+e6c0286ea",
|
|
24
|
+
"@atlaspack/cache": "2.13.2-dev.3682+e6c0286ea",
|
|
25
|
+
"@atlaspack/diagnostic": "2.13.2-dev.3682+e6c0286ea",
|
|
26
|
+
"@atlaspack/events": "2.13.2-dev.3682+e6c0286ea",
|
|
27
|
+
"@atlaspack/feature-flags": "2.13.2-dev.3682+e6c0286ea",
|
|
28
|
+
"@atlaspack/fs": "2.13.2-dev.3682+e6c0286ea",
|
|
29
|
+
"@atlaspack/graph": "3.3.2-dev.3682+e6c0286ea",
|
|
30
|
+
"@atlaspack/logger": "2.13.2-dev.3682+e6c0286ea",
|
|
31
|
+
"@atlaspack/package-manager": "2.13.2-dev.3682+e6c0286ea",
|
|
32
|
+
"@atlaspack/plugin": "2.13.2-dev.3682+e6c0286ea",
|
|
33
|
+
"@atlaspack/profiler": "2.13.2-dev.3682+e6c0286ea",
|
|
34
|
+
"@atlaspack/rust": "2.13.2-dev.3682+e6c0286ea",
|
|
35
|
+
"@atlaspack/types": "2.13.2-dev.3682+e6c0286ea",
|
|
36
|
+
"@atlaspack/utils": "2.13.2-dev.3682+e6c0286ea",
|
|
37
|
+
"@atlaspack/workers": "2.13.2-dev.3682+e6c0286ea",
|
|
38
38
|
"@mischnic/json-sourcemap": "^0.1.0",
|
|
39
39
|
"@parcel/source-map": "^2.1.1",
|
|
40
40
|
"base-x": "^3.0.8",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"browser": {
|
|
67
67
|
"./src/serializerCore.js": "./src/serializerCore.browser.js"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "e6c0286ea2a77c6a41c6c0f38d51caf420d61aae"
|
|
70
70
|
}
|
package/src/AtlaspackConfig.js
CHANGED
|
@@ -12,7 +12,6 @@ import type {
|
|
|
12
12
|
Packager,
|
|
13
13
|
Reporter,
|
|
14
14
|
Semver,
|
|
15
|
-
SemverRange,
|
|
16
15
|
Validator,
|
|
17
16
|
FilePath,
|
|
18
17
|
} from '@atlaspack/types';
|
|
@@ -52,7 +51,6 @@ export type LoadedPlugin<T> = {|
|
|
|
52
51
|
plugin: T,
|
|
53
52
|
resolveFrom: ProjectPath,
|
|
54
53
|
keyPath?: string,
|
|
55
|
-
range?: ?SemverRange,
|
|
56
54
|
|};
|
|
57
55
|
|
|
58
56
|
export class AtlaspackConfig {
|
|
@@ -120,7 +118,6 @@ export class AtlaspackConfig {
|
|
|
120
118
|
plugin: T,
|
|
121
119
|
version: Semver,
|
|
122
120
|
resolveFrom: ProjectPath,
|
|
123
|
-
range: ?SemverRange,
|
|
124
121
|
|}> {
|
|
125
122
|
let plugin = this.pluginCache.get(node.packageName);
|
|
126
123
|
if (plugin) {
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
import type {
|
|
3
|
-
FilePath,
|
|
4
|
-
PackageName,
|
|
5
|
-
Semver,
|
|
6
|
-
SemverRange,
|
|
7
|
-
} from '@atlaspack/types';
|
|
2
|
+
import type {FilePath, PackageName, Semver} from '@atlaspack/types';
|
|
8
3
|
import type {AtlaspackOptions} from './types';
|
|
9
4
|
|
|
10
5
|
import path from 'path';
|
|
@@ -35,10 +30,8 @@ export default async function loadPlugin<T>(
|
|
|
35
30
|
plugin: T,
|
|
36
31
|
version: Semver,
|
|
37
32
|
resolveFrom: ProjectPath,
|
|
38
|
-
range: ?SemverRange,
|
|
39
33
|
|}> {
|
|
40
34
|
let resolveFrom = configPath;
|
|
41
|
-
let range;
|
|
42
35
|
if (resolveFrom.includes(NODE_MODULES)) {
|
|
43
36
|
// Config packages can reference plugins, but cannot contain other plugins within them.
|
|
44
37
|
// This forces every published plugin to be published separately so they can be mixed and matched if needed.
|
|
@@ -77,47 +70,34 @@ export default async function loadPlugin<T>(
|
|
|
77
70
|
configPkg != null &&
|
|
78
71
|
configPkg.config.dependencies?.[pluginName] == null
|
|
79
72
|
) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
configPkg.config.parcelDependencies
|
|
99
|
-
? [
|
|
73
|
+
let contents = await options.inputFS.readFile(
|
|
74
|
+
configPkg.files[0].filePath,
|
|
75
|
+
'utf8',
|
|
76
|
+
);
|
|
77
|
+
throw new ThrowableDiagnostic({
|
|
78
|
+
diagnostic: {
|
|
79
|
+
message: md`Could not determine version of ${pluginName} in ${path.relative(
|
|
80
|
+
process.cwd(),
|
|
81
|
+
resolveFrom,
|
|
82
|
+
)}. Include it in "dependencies".`,
|
|
83
|
+
origin: '@atlaspack/core',
|
|
84
|
+
codeFrames: configPkg.config.dependencies
|
|
85
|
+
? [
|
|
86
|
+
{
|
|
87
|
+
filePath: configPkg.files[0].filePath,
|
|
88
|
+
language: 'json5',
|
|
89
|
+
code: contents,
|
|
90
|
+
codeHighlights: generateJSONCodeHighlights(contents, [
|
|
100
91
|
{
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
code: contents,
|
|
104
|
-
codeHighlights: generateJSONCodeHighlights(contents, [
|
|
105
|
-
{
|
|
106
|
-
key: configPkg.config.parcelDependencies
|
|
107
|
-
? '/parcelDependencies'
|
|
108
|
-
: '/dependencies',
|
|
109
|
-
type: 'key',
|
|
110
|
-
},
|
|
111
|
-
]),
|
|
92
|
+
key: '/dependencies',
|
|
93
|
+
type: 'key',
|
|
112
94
|
},
|
|
113
|
-
]
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
// Resolve from project root if not in the config's dependencies.
|
|
120
|
-
resolveFrom = path.join(options.projectRoot, 'index');
|
|
95
|
+
]),
|
|
96
|
+
},
|
|
97
|
+
]
|
|
98
|
+
: undefined,
|
|
99
|
+
},
|
|
100
|
+
});
|
|
121
101
|
}
|
|
122
102
|
}
|
|
123
103
|
|
|
@@ -126,10 +106,7 @@ export default async function loadPlugin<T>(
|
|
|
126
106
|
({resolved, pkg} = await options.packageManager.resolve(
|
|
127
107
|
pluginName,
|
|
128
108
|
resolveFrom,
|
|
129
|
-
{
|
|
130
|
-
shouldAutoInstall: options.shouldAutoInstall,
|
|
131
|
-
range,
|
|
132
|
-
},
|
|
109
|
+
{shouldAutoInstall: options.shouldAutoInstall},
|
|
133
110
|
));
|
|
134
111
|
} catch (err) {
|
|
135
112
|
if (err.code !== 'MODULE_NOT_FOUND') {
|
|
@@ -242,6 +219,5 @@ export default async function loadPlugin<T>(
|
|
|
242
219
|
plugin,
|
|
243
220
|
version: nullthrows(pkg).version,
|
|
244
221
|
resolveFrom: toProjectPath(options.projectRoot, resolveFrom),
|
|
245
|
-
range,
|
|
246
222
|
};
|
|
247
223
|
}
|
|
@@ -61,7 +61,7 @@ export default function createAtlaspackBuildRequest(
|
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
async function run({input, api, options}) {
|
|
64
|
+
async function run({input, api, options, rustAtlaspack}) {
|
|
65
65
|
let {optionsRef, requestedAssetIds, signal} = input;
|
|
66
66
|
|
|
67
67
|
let bundleGraphRequest = createBundleGraphRequest({
|
|
@@ -72,7 +72,9 @@ async function run({input, api, options}) {
|
|
|
72
72
|
|
|
73
73
|
let {bundleGraph, changedAssets, assetRequests}: BundleGraphResult =
|
|
74
74
|
await api.runRequest(bundleGraphRequest, {
|
|
75
|
-
force:
|
|
75
|
+
force:
|
|
76
|
+
Boolean(rustAtlaspack) ||
|
|
77
|
+
(options.shouldBuildLazily && requestedAssetIds.size > 0),
|
|
76
78
|
});
|
|
77
79
|
|
|
78
80
|
// $FlowFixMe Added in Flow 0.121.0 upgrade in #4381 (Windows only)
|
|
@@ -163,7 +163,9 @@ export default function createBundleGraphRequest(
|
|
|
163
163
|
let {assetGraph, changedAssets, assetRequests} = await api.runRequest(
|
|
164
164
|
request,
|
|
165
165
|
{
|
|
166
|
-
force:
|
|
166
|
+
force:
|
|
167
|
+
Boolean(input.rustAtlaspack) ||
|
|
168
|
+
(options.shouldBuildLazily && requestedAssetIds.size > 0),
|
|
167
169
|
},
|
|
168
170
|
);
|
|
169
171
|
|