@atlaspack/core 2.14.1-dev.50 → 2.14.1-dev.53

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.
@@ -43,7 +43,8 @@ const CONFIG = Symbol.for('parcel-plugin-config');
43
43
  async function loadPlugin(pluginName, configPath, keyPath, options) {
44
44
  if (_internalPlugins.default && _internalPlugins.default[pluginName]) {
45
45
  let plugin = _internalPlugins.default[pluginName]();
46
- plugin = plugin.default[CONFIG];
46
+ plugin = plugin.default || plugin;
47
+ plugin = plugin[CONFIG];
47
48
  if (!plugin) {
48
49
  throw new Error(`Plugin ${pluginName} is not a valid Atlaspack plugin, should export an instance of a Atlaspack plugin ex. "export default new Reporter({ ... })".`);
49
50
  }
@@ -66,6 +66,7 @@ var _AtlaspackConfig2 = _interopRequireDefault(require("../AtlaspackConfig.schem
66
66
  var _projectPath = require("../projectPath");
67
67
  var _RequestTracker = require("../RequestTracker");
68
68
  var _utils2 = require("../utils");
69
+ var _isSuperPackage = require("../isSuperPackage");
69
70
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
70
71
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
71
72
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -135,28 +136,36 @@ async function resolveAtlaspackConfig(options) {
135
136
  let resolveFrom = getResolveFrom(options.inputFS, options.projectRoot);
136
137
  let configPath = options.config != null ? (await options.packageManager.resolve(options.config, resolveFrom)).resolved : await (0, _utils().resolveConfig)(options.inputFS, resolveFrom, ['.parcelrc'], options.projectRoot);
137
138
  let usedDefault = false;
138
- if (configPath == null && options.defaultConfig != null) {
139
+ let config, extendedFiles;
140
+ if (configPath == null && options.defaultConfig != null && (0, _isSuperPackage.isSuperPackage)() && options.defaultConfig.endsWith('.js')) {
139
141
  usedDefault = true;
140
- configPath = (await options.packageManager.resolve(options.defaultConfig, resolveFrom)).resolved;
141
- }
142
- if (configPath == null) {
143
- return null;
144
- }
145
- let contents;
146
- try {
147
- contents = await options.inputFS.readFile(configPath, 'utf8');
148
- } catch (e) {
149
- throw new (_diagnostic().default)({
150
- diagnostic: {
151
- message: (0, _diagnostic().md)`Could not find parcel config at ${_path().default.relative(options.projectRoot, configPath)}`,
152
- origin: '@atlaspack/core'
153
- }
154
- });
142
+ // Load the super package default config
143
+ let result = await processConfigChain(_internalPlugins.default['@atlaspack/config-default'](), options.defaultConfig, options);
144
+ config = result.config;
145
+ extendedFiles = result.extendedFiles;
146
+ } else {
147
+ if (configPath == null && options.defaultConfig != null) {
148
+ usedDefault = true;
149
+ configPath = (await options.packageManager.resolve(options.defaultConfig, resolveFrom)).resolved;
150
+ }
151
+ if (configPath == null) {
152
+ return null;
153
+ }
154
+ let contents;
155
+ try {
156
+ contents = await options.inputFS.readFile(configPath, 'utf8');
157
+ } catch (e) {
158
+ throw new (_diagnostic().default)({
159
+ diagnostic: {
160
+ message: (0, _diagnostic().md)`Could not find parcel config at ${_path().default.relative(options.projectRoot, configPath)}`,
161
+ origin: '@atlaspack/core'
162
+ }
163
+ });
164
+ }
165
+ let result = await parseAndProcessConfig(configPath, contents, options);
166
+ config = result.config;
167
+ extendedFiles = result.extendedFiles;
155
168
  }
156
- let {
157
- config,
158
- extendedFiles
159
- } = await parseAndProcessConfig(configPath, contents, options);
160
169
  if (options.additionalReporters.length > 0) {
161
170
  config.reporters = [...options.additionalReporters.map(({
162
171
  packageName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/core",
3
- "version": "2.14.1-dev.50+0914fcd0b",
3
+ "version": "2.14.1-dev.53+75290c6cb",
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.3-dev.50+0914fcd0b",
24
- "@atlaspack/cache": "2.13.3-dev.50+0914fcd0b",
25
- "@atlaspack/diagnostic": "2.14.1-dev.50+0914fcd0b",
26
- "@atlaspack/events": "2.14.1-dev.50+0914fcd0b",
27
- "@atlaspack/feature-flags": "2.14.1-dev.50+0914fcd0b",
28
- "@atlaspack/fs": "2.14.1-dev.50+0914fcd0b",
29
- "@atlaspack/graph": "3.4.1-dev.50+0914fcd0b",
30
- "@atlaspack/logger": "2.14.1-dev.50+0914fcd0b",
31
- "@atlaspack/package-manager": "2.14.1-dev.50+0914fcd0b",
32
- "@atlaspack/plugin": "2.14.1-dev.50+0914fcd0b",
33
- "@atlaspack/profiler": "2.14.1-dev.50+0914fcd0b",
34
- "@atlaspack/rust": "3.0.1-dev.50+0914fcd0b",
35
- "@atlaspack/types": "2.14.1-dev.50+0914fcd0b",
36
- "@atlaspack/utils": "2.14.1-dev.50+0914fcd0b",
37
- "@atlaspack/workers": "2.14.1-dev.50+0914fcd0b",
23
+ "@atlaspack/build-cache": "2.13.3-dev.53+75290c6cb",
24
+ "@atlaspack/cache": "2.13.3-dev.53+75290c6cb",
25
+ "@atlaspack/diagnostic": "2.14.1-dev.53+75290c6cb",
26
+ "@atlaspack/events": "2.14.1-dev.53+75290c6cb",
27
+ "@atlaspack/feature-flags": "2.14.1-dev.53+75290c6cb",
28
+ "@atlaspack/fs": "2.14.1-dev.53+75290c6cb",
29
+ "@atlaspack/graph": "3.4.1-dev.53+75290c6cb",
30
+ "@atlaspack/logger": "2.14.1-dev.53+75290c6cb",
31
+ "@atlaspack/package-manager": "2.14.1-dev.53+75290c6cb",
32
+ "@atlaspack/plugin": "2.14.1-dev.53+75290c6cb",
33
+ "@atlaspack/profiler": "2.14.1-dev.53+75290c6cb",
34
+ "@atlaspack/rust": "3.0.1-dev.53+75290c6cb",
35
+ "@atlaspack/types": "2.14.1-dev.53+75290c6cb",
36
+ "@atlaspack/utils": "2.14.1-dev.53+75290c6cb",
37
+ "@atlaspack/workers": "2.14.1-dev.53+75290c6cb",
38
38
  "@mischnic/json-sourcemap": "^0.1.0",
39
39
  "@parcel/source-map": "^2.1.1",
40
40
  "base-x": "^3.0.8",
@@ -67,5 +67,5 @@
67
67
  "./src/serializerCore.js": "./src/serializerCore.browser.js"
68
68
  },
69
69
  "type": "commonjs",
70
- "gitHead": "0914fcd0b475df31a4e105a1cda98df3c679c661"
70
+ "gitHead": "75290c6cb03e7253ab1f9bfc6859d518a7d313cc"
71
71
  }
@@ -32,7 +32,8 @@ export default async function loadPlugin<T>(
32
32
  |}> {
33
33
  if (atlaspackInternalPlugins && atlaspackInternalPlugins[pluginName]) {
34
34
  let plugin = atlaspackInternalPlugins[pluginName]();
35
- plugin = plugin.default[CONFIG];
35
+ plugin = plugin.default || plugin;
36
+ plugin = plugin[CONFIG];
36
37
  if (!plugin) {
37
38
  throw new Error(
38
39
  `Plugin ${pluginName} is not a valid Atlaspack plugin, should export an instance of a Atlaspack plugin ex. "export default new Reporter({ ... })".`,
@@ -40,6 +40,7 @@ import AtlaspackConfigSchema from '../AtlaspackConfig.schema';
40
40
  import {toProjectPath} from '../projectPath';
41
41
  import {requestTypes} from '../RequestTracker';
42
42
  import {optionsProxy} from '../utils';
43
+ import {isSuperPackage} from '../isSuperPackage';
43
44
 
44
45
  type ConfigMap<K, V> = {[K]: V, ...};
45
46
 
@@ -160,34 +161,59 @@ export async function resolveAtlaspackConfig(
160
161
  );
161
162
 
162
163
  let usedDefault = false;
163
- if (configPath == null && options.defaultConfig != null) {
164
+ let config, extendedFiles;
165
+
166
+ if (
167
+ configPath == null &&
168
+ options.defaultConfig != null &&
169
+ isSuperPackage() &&
170
+ options.defaultConfig.endsWith('.js')
171
+ ) {
164
172
  usedDefault = true;
165
- configPath = (
166
- await options.packageManager.resolve(options.defaultConfig, resolveFrom)
167
- ).resolved;
168
- }
173
+ // Load the super package default config
174
+ let result: AtlaspackConfigChain = await processConfigChain(
175
+ atlaspackInternalPlugins['@atlaspack/config-default'](),
176
+ options.defaultConfig,
177
+ options,
178
+ );
179
+ config = result.config;
180
+ extendedFiles = result.extendedFiles;
181
+ } else {
182
+ if (configPath == null && options.defaultConfig != null) {
183
+ usedDefault = true;
169
184
 
170
- if (configPath == null) {
171
- return null;
172
- }
185
+ configPath = (
186
+ await options.packageManager.resolve(options.defaultConfig, resolveFrom)
187
+ ).resolved;
188
+ }
173
189
 
174
- let contents;
175
- try {
176
- contents = await options.inputFS.readFile(configPath, 'utf8');
177
- } catch (e) {
178
- throw new ThrowableDiagnostic({
179
- diagnostic: {
180
- message: md`Could not find parcel config at ${path.relative(
181
- options.projectRoot,
182
- configPath,
183
- )}`,
184
- origin: '@atlaspack/core',
185
- },
186
- });
187
- }
190
+ if (configPath == null) {
191
+ return null;
192
+ }
193
+
194
+ let contents;
195
+ try {
196
+ contents = await options.inputFS.readFile(configPath, 'utf8');
197
+ } catch (e) {
198
+ throw new ThrowableDiagnostic({
199
+ diagnostic: {
200
+ message: md`Could not find parcel config at ${path.relative(
201
+ options.projectRoot,
202
+ configPath,
203
+ )}`,
204
+ origin: '@atlaspack/core',
205
+ },
206
+ });
207
+ }
188
208
 
189
- let {config, extendedFiles}: AtlaspackConfigChain =
190
- await parseAndProcessConfig(configPath, contents, options);
209
+ let result: AtlaspackConfigChain = await parseAndProcessConfig(
210
+ configPath,
211
+ contents,
212
+ options,
213
+ );
214
+ config = result.config;
215
+ extendedFiles = result.extendedFiles;
216
+ }
191
217
 
192
218
  if (options.additionalReporters.length > 0) {
193
219
  config.reporters = [