@atlaspack/core 2.13.2-canary.3672 → 2.13.2-canary.3673

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.
@@ -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
- var _configPkg$config$par;
70
- // If not in the config's dependencies, the plugin will be auto installed with
71
- // the version declared in "parcelDependencies".
72
- range = (_configPkg$config$par = configPkg.config.parcelDependencies) === null || _configPkg$config$par === void 0 ? void 0 : _configPkg$config$par[pluginName];
73
- if (range == null) {
74
- let contents = await options.inputFS.readFile(configPkg.files[0].filePath, 'utf8');
75
- throw new (_diagnostic().default)({
76
- diagnostic: {
77
- message: (0, _diagnostic().md)`Could not determine version of ${pluginName} in ${_path().default.relative(process.cwd(), resolveFrom)}. Either include it in "dependencies" or "parcelDependencies".`,
78
- origin: '@atlaspack/core',
79
- codeFrames: configPkg.config.dependencies || configPkg.config.parcelDependencies ? [{
80
- filePath: configPkg.files[0].filePath,
81
- language: 'json5',
82
- code: contents,
83
- codeHighlights: (0, _diagnostic().generateJSONCodeHighlights)(contents, [{
84
- key: configPkg.config.parcelDependencies ? '/parcelDependencies' : '/dependencies',
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/core",
3
- "version": "2.13.2-canary.3672+3460531d9",
3
+ "version": "2.13.2-canary.3673+8386ca4dc",
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.3672+3460531d9",
24
- "@atlaspack/cache": "2.13.2-canary.3672+3460531d9",
25
- "@atlaspack/diagnostic": "2.13.2-canary.3672+3460531d9",
26
- "@atlaspack/events": "2.13.2-canary.3672+3460531d9",
27
- "@atlaspack/feature-flags": "2.13.2-canary.3672+3460531d9",
28
- "@atlaspack/fs": "2.13.2-canary.3672+3460531d9",
29
- "@atlaspack/graph": "3.3.2-canary.3672+3460531d9",
30
- "@atlaspack/logger": "2.13.2-canary.3672+3460531d9",
31
- "@atlaspack/package-manager": "2.13.2-canary.3672+3460531d9",
32
- "@atlaspack/plugin": "2.13.2-canary.3672+3460531d9",
33
- "@atlaspack/profiler": "2.13.2-canary.3672+3460531d9",
34
- "@atlaspack/rust": "2.13.2-canary.3672+3460531d9",
35
- "@atlaspack/types": "2.13.2-canary.3672+3460531d9",
36
- "@atlaspack/utils": "2.13.2-canary.3672+3460531d9",
37
- "@atlaspack/workers": "2.13.2-canary.3672+3460531d9",
23
+ "@atlaspack/build-cache": "2.13.2-canary.3673+8386ca4dc",
24
+ "@atlaspack/cache": "2.13.2-canary.3673+8386ca4dc",
25
+ "@atlaspack/diagnostic": "2.13.2-canary.3673+8386ca4dc",
26
+ "@atlaspack/events": "2.13.2-canary.3673+8386ca4dc",
27
+ "@atlaspack/feature-flags": "2.13.2-canary.3673+8386ca4dc",
28
+ "@atlaspack/fs": "2.13.2-canary.3673+8386ca4dc",
29
+ "@atlaspack/graph": "3.3.2-canary.3673+8386ca4dc",
30
+ "@atlaspack/logger": "2.13.2-canary.3673+8386ca4dc",
31
+ "@atlaspack/package-manager": "2.13.2-canary.3673+8386ca4dc",
32
+ "@atlaspack/plugin": "2.13.2-canary.3673+8386ca4dc",
33
+ "@atlaspack/profiler": "2.13.2-canary.3673+8386ca4dc",
34
+ "@atlaspack/rust": "2.13.2-canary.3673+8386ca4dc",
35
+ "@atlaspack/types": "2.13.2-canary.3673+8386ca4dc",
36
+ "@atlaspack/utils": "2.13.2-canary.3673+8386ca4dc",
37
+ "@atlaspack/workers": "2.13.2-canary.3673+8386ca4dc",
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": "3460531d9cb036f2575a99ea69fe2b03cfd6ac06"
69
+ "gitHead": "8386ca4dc318688fbed1af3bbebf2af3e7d24552"
70
70
  }
@@ -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
- // If not in the config's dependencies, the plugin will be auto installed with
81
- // the version declared in "parcelDependencies".
82
- range = configPkg.config.parcelDependencies?.[pluginName];
83
-
84
- if (range == null) {
85
- let contents = await options.inputFS.readFile(
86
- configPkg.files[0].filePath,
87
- 'utf8',
88
- );
89
- throw new ThrowableDiagnostic({
90
- diagnostic: {
91
- message: md`Could not determine version of ${pluginName} in ${path.relative(
92
- process.cwd(),
93
- resolveFrom,
94
- )}. Either include it in "dependencies" or "parcelDependencies".`,
95
- origin: '@atlaspack/core',
96
- codeFrames:
97
- configPkg.config.dependencies ||
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
- filePath: configPkg.files[0].filePath,
102
- language: 'json5',
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
- : undefined,
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
  }