@atlaspack/core 2.13.2-canary.3683 → 2.13.2-canary.3686
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 +20 -41
- package/package.json +17 -17
- package/src/loadAtlaspackPlugin.js +26 -71
|
@@ -41,47 +41,26 @@ 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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
let configPkg = await (0, _utils().loadConfig)(options.inputFS, resolveFrom, ['package.json'], options.projectRoot);
|
|
67
|
-
if (configPkg != null && ((_configPkg$config$dep = configPkg.config.dependencies) === null || _configPkg$config$dep === void 0 ? void 0 : _configPkg$config$dep[pluginName]) == null) {
|
|
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
|
-
});
|
|
84
|
-
}
|
|
44
|
+
|
|
45
|
+
// Config packages can reference plugins, but cannot contain other plugins within them.
|
|
46
|
+
// This forces every published plugin to be published separately so they can be mixed and matched if needed.
|
|
47
|
+
if (resolveFrom.includes(NODE_MODULES) && pluginName.startsWith('.')) {
|
|
48
|
+
let configContents = await options.inputFS.readFile(configPath, 'utf8');
|
|
49
|
+
throw new (_diagnostic().default)({
|
|
50
|
+
diagnostic: {
|
|
51
|
+
message: (0, _diagnostic().md)`Local plugins are not supported in Atlaspack config packages. Please publish "${pluginName}" as a separate npm package.`,
|
|
52
|
+
origin: '@atlaspack/core',
|
|
53
|
+
codeFrames: keyPath ? [{
|
|
54
|
+
filePath: configPath,
|
|
55
|
+
language: 'json5',
|
|
56
|
+
code: configContents,
|
|
57
|
+
codeHighlights: (0, _diagnostic().generateJSONCodeHighlights)(configContents, [{
|
|
58
|
+
key: keyPath,
|
|
59
|
+
type: 'value'
|
|
60
|
+
}])
|
|
61
|
+
}] : undefined
|
|
62
|
+
}
|
|
63
|
+
});
|
|
85
64
|
}
|
|
86
65
|
let resolved, pkg;
|
|
87
66
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/core",
|
|
3
|
-
"version": "2.13.2-canary.
|
|
3
|
+
"version": "2.13.2-canary.3686+be88bd9fc",
|
|
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-canary.
|
|
24
|
-
"@atlaspack/cache": "2.13.2-canary.
|
|
25
|
-
"@atlaspack/diagnostic": "2.13.2-canary.
|
|
26
|
-
"@atlaspack/events": "2.13.2-canary.
|
|
27
|
-
"@atlaspack/feature-flags": "2.13.2-canary.
|
|
28
|
-
"@atlaspack/fs": "2.13.2-canary.
|
|
29
|
-
"@atlaspack/graph": "3.3.2-canary.
|
|
30
|
-
"@atlaspack/logger": "2.13.2-canary.
|
|
31
|
-
"@atlaspack/package-manager": "2.13.2-canary.
|
|
32
|
-
"@atlaspack/plugin": "2.13.2-canary.
|
|
33
|
-
"@atlaspack/profiler": "2.13.2-canary.
|
|
34
|
-
"@atlaspack/rust": "2.13.2-canary.
|
|
35
|
-
"@atlaspack/types": "2.13.2-canary.
|
|
36
|
-
"@atlaspack/utils": "2.13.2-canary.
|
|
37
|
-
"@atlaspack/workers": "2.13.2-canary.
|
|
23
|
+
"@atlaspack/build-cache": "2.13.2-canary.3686+be88bd9fc",
|
|
24
|
+
"@atlaspack/cache": "2.13.2-canary.3686+be88bd9fc",
|
|
25
|
+
"@atlaspack/diagnostic": "2.13.2-canary.3686+be88bd9fc",
|
|
26
|
+
"@atlaspack/events": "2.13.2-canary.3686+be88bd9fc",
|
|
27
|
+
"@atlaspack/feature-flags": "2.13.2-canary.3686+be88bd9fc",
|
|
28
|
+
"@atlaspack/fs": "2.13.2-canary.3686+be88bd9fc",
|
|
29
|
+
"@atlaspack/graph": "3.3.2-canary.3686+be88bd9fc",
|
|
30
|
+
"@atlaspack/logger": "2.13.2-canary.3686+be88bd9fc",
|
|
31
|
+
"@atlaspack/package-manager": "2.13.2-canary.3686+be88bd9fc",
|
|
32
|
+
"@atlaspack/plugin": "2.13.2-canary.3686+be88bd9fc",
|
|
33
|
+
"@atlaspack/profiler": "2.13.2-canary.3686+be88bd9fc",
|
|
34
|
+
"@atlaspack/rust": "2.13.2-canary.3686+be88bd9fc",
|
|
35
|
+
"@atlaspack/types": "2.13.2-canary.3686+be88bd9fc",
|
|
36
|
+
"@atlaspack/utils": "2.13.2-canary.3686+be88bd9fc",
|
|
37
|
+
"@atlaspack/workers": "2.13.2-canary.3686+be88bd9fc",
|
|
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": "be88bd9fc4cbc1c579685bf2e5d834b4136a6c7c"
|
|
70
70
|
}
|
|
@@ -10,11 +10,7 @@ import ThrowableDiagnostic, {
|
|
|
10
10
|
generateJSONCodeHighlights,
|
|
11
11
|
md,
|
|
12
12
|
} from '@atlaspack/diagnostic';
|
|
13
|
-
import {
|
|
14
|
-
findAlternativeNodeModules,
|
|
15
|
-
loadConfig,
|
|
16
|
-
resolveConfig,
|
|
17
|
-
} from '@atlaspack/utils';
|
|
13
|
+
import {findAlternativeNodeModules, resolveConfig} from '@atlaspack/utils';
|
|
18
14
|
import {type ProjectPath, toProjectPath} from './projectPath';
|
|
19
15
|
import {version as ATLASPACK_VERSION} from '../package.json';
|
|
20
16
|
|
|
@@ -32,73 +28,32 @@ export default async function loadPlugin<T>(
|
|
|
32
28
|
resolveFrom: ProjectPath,
|
|
33
29
|
|}> {
|
|
34
30
|
let resolveFrom = configPath;
|
|
35
|
-
if (resolveFrom.includes(NODE_MODULES)) {
|
|
36
|
-
// Config packages can reference plugins, but cannot contain other plugins within them.
|
|
37
|
-
// This forces every published plugin to be published separately so they can be mixed and matched if needed.
|
|
38
|
-
if (pluginName.startsWith('.')) {
|
|
39
|
-
let configContents = await options.inputFS.readFile(configPath, 'utf8');
|
|
40
|
-
throw new ThrowableDiagnostic({
|
|
41
|
-
diagnostic: {
|
|
42
|
-
message: md`Local plugins are not supported in Atlaspack config packages. Please publish "${pluginName}" as a separate npm package.`,
|
|
43
|
-
origin: '@atlaspack/core',
|
|
44
|
-
codeFrames: keyPath
|
|
45
|
-
? [
|
|
46
|
-
{
|
|
47
|
-
filePath: configPath,
|
|
48
|
-
language: 'json5',
|
|
49
|
-
code: configContents,
|
|
50
|
-
codeHighlights: generateJSONCodeHighlights(configContents, [
|
|
51
|
-
{
|
|
52
|
-
key: keyPath,
|
|
53
|
-
type: 'value',
|
|
54
|
-
},
|
|
55
|
-
]),
|
|
56
|
-
},
|
|
57
|
-
]
|
|
58
|
-
: undefined,
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
31
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
language: 'json5',
|
|
89
|
-
code: contents,
|
|
90
|
-
codeHighlights: generateJSONCodeHighlights(contents, [
|
|
91
|
-
{
|
|
92
|
-
key: '/dependencies',
|
|
93
|
-
type: 'key',
|
|
94
|
-
},
|
|
95
|
-
]),
|
|
96
|
-
},
|
|
97
|
-
]
|
|
98
|
-
: undefined,
|
|
99
|
-
},
|
|
100
|
-
});
|
|
101
|
-
}
|
|
32
|
+
// Config packages can reference plugins, but cannot contain other plugins within them.
|
|
33
|
+
// This forces every published plugin to be published separately so they can be mixed and matched if needed.
|
|
34
|
+
if (resolveFrom.includes(NODE_MODULES) && pluginName.startsWith('.')) {
|
|
35
|
+
let configContents = await options.inputFS.readFile(configPath, 'utf8');
|
|
36
|
+
throw new ThrowableDiagnostic({
|
|
37
|
+
diagnostic: {
|
|
38
|
+
message: md`Local plugins are not supported in Atlaspack config packages. Please publish "${pluginName}" as a separate npm package.`,
|
|
39
|
+
origin: '@atlaspack/core',
|
|
40
|
+
codeFrames: keyPath
|
|
41
|
+
? [
|
|
42
|
+
{
|
|
43
|
+
filePath: configPath,
|
|
44
|
+
language: 'json5',
|
|
45
|
+
code: configContents,
|
|
46
|
+
codeHighlights: generateJSONCodeHighlights(configContents, [
|
|
47
|
+
{
|
|
48
|
+
key: keyPath,
|
|
49
|
+
type: 'value',
|
|
50
|
+
},
|
|
51
|
+
]),
|
|
52
|
+
},
|
|
53
|
+
]
|
|
54
|
+
: undefined,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
102
57
|
}
|
|
103
58
|
|
|
104
59
|
let resolved, pkg;
|