@atlaspack/cli 2.13.3-dev.43 → 2.13.3-dev.50

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.
Files changed (3) hide show
  1. package/lib/cli.js +13 -9
  2. package/package.json +14 -14
  3. package/src/cli.js +21 -10
package/lib/cli.js CHANGED
@@ -116,15 +116,21 @@ command) {
116
116
  entries = ['.'];
117
117
  }
118
118
  entries = entries.map(entry => _path().default.resolve(entry));
119
- let Atlaspack = require('@atlaspack/core').default;
120
119
  let fs = new (_fs().NodeFS)();
120
+ let Atlaspack = require('@atlaspack/core').default;
121
121
  let options = await (0, _normalizeOptions.normalizeOptions)(command, fs);
122
122
  let atlaspack = new Atlaspack({
123
123
  entries,
124
- defaultConfig: ((specifier, {
125
- paths
126
- }) => {
127
- for (let path of paths) {
124
+ defaultConfig: (() => {
125
+ if ((0, _core().isSuperPackage)()) {
126
+ // We're in the super package so resolve the inbuilt config
127
+ let inbuiltDefaultConfig = _path().default.join( /*#__ATLASPACK_IGNORE__*/__dirname, '../../configs/default/index.json.js');
128
+ if (!fs.existsSync(inbuiltDefaultConfig)) {
129
+ throw new Error(`Missing inbuilt default config. Expected '${inbuiltDefaultConfig}' to exist`);
130
+ }
131
+ return inbuiltDefaultConfig;
132
+ }
133
+ for (let path of [fs.cwd(), __dirname]) {
128
134
  let customRequire = require('module').createRequire(path);
129
135
  try {
130
136
  return customRequire.resolve('@atlaspack/config-default');
@@ -132,10 +138,8 @@ command) {
132
138
  // Ignore error
133
139
  }
134
140
  }
135
- throw new Error(`Can't resolve "${specifier}" from any of [${paths.join(', ')}]`);
136
- })('@atlaspack/config-default', {
137
- paths: [fs.cwd(), __dirname]
138
- }),
141
+ throw new Error(`Can't resolve default config`);
142
+ })(),
139
143
  shouldPatchConsole: false,
140
144
  ...options
141
145
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/cli",
3
- "version": "2.13.3-dev.43+e1584ed4e",
3
+ "version": "2.13.3-dev.50+0914fcd0b",
4
4
  "description": "Blazing fast, zero configuration web application bundler",
5
5
  "license": "(MIT OR Apache-2.0)",
6
6
  "type": "commonjs",
@@ -24,18 +24,18 @@
24
24
  "node": ">= 16.0.0"
25
25
  },
26
26
  "dependencies": {
27
- "@atlaspack/config-default": "3.1.1-dev.43+e1584ed4e",
28
- "@atlaspack/core": "2.14.1-dev.43+e1584ed4e",
29
- "@atlaspack/diagnostic": "2.14.1-dev.43+e1584ed4e",
30
- "@atlaspack/events": "2.14.1-dev.43+e1584ed4e",
31
- "@atlaspack/feature-flags": "2.14.1-dev.43+e1584ed4e",
32
- "@atlaspack/fs": "2.14.1-dev.43+e1584ed4e",
33
- "@atlaspack/logger": "2.14.1-dev.43+e1584ed4e",
34
- "@atlaspack/package-manager": "2.14.1-dev.43+e1584ed4e",
35
- "@atlaspack/reporter-cli": "2.14.1-dev.43+e1584ed4e",
36
- "@atlaspack/reporter-dev-server": "2.14.1-dev.43+e1584ed4e",
37
- "@atlaspack/reporter-tracer": "2.14.1-dev.43+e1584ed4e",
38
- "@atlaspack/utils": "2.14.1-dev.43+e1584ed4e",
27
+ "@atlaspack/config-default": "3.1.1-dev.50+0914fcd0b",
28
+ "@atlaspack/core": "2.14.1-dev.50+0914fcd0b",
29
+ "@atlaspack/diagnostic": "2.14.1-dev.50+0914fcd0b",
30
+ "@atlaspack/events": "2.14.1-dev.50+0914fcd0b",
31
+ "@atlaspack/feature-flags": "2.14.1-dev.50+0914fcd0b",
32
+ "@atlaspack/fs": "2.14.1-dev.50+0914fcd0b",
33
+ "@atlaspack/logger": "2.14.1-dev.50+0914fcd0b",
34
+ "@atlaspack/package-manager": "2.14.1-dev.50+0914fcd0b",
35
+ "@atlaspack/reporter-cli": "2.14.1-dev.50+0914fcd0b",
36
+ "@atlaspack/reporter-dev-server": "2.14.1-dev.50+0914fcd0b",
37
+ "@atlaspack/reporter-tracer": "2.14.1-dev.50+0914fcd0b",
38
+ "@atlaspack/utils": "2.14.1-dev.50+0914fcd0b",
39
39
  "chalk": "^4.1.0",
40
40
  "commander": "^7.0.0",
41
41
  "get-port": "^4.2.0"
@@ -45,5 +45,5 @@
45
45
  "@babel/core": "^7.22.11",
46
46
  "rimraf": "^5.0.5"
47
47
  },
48
- "gitHead": "e1584ed4eba00a5920c981f8622f8c04ee3c73c3"
48
+ "gitHead": "0914fcd0b475df31a4e105a1cda98df3c679c661"
49
49
  }
package/src/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @flow
2
2
 
3
- import {BuildError} from '@atlaspack/core';
3
+ import {BuildError, isSuperPackage} from '@atlaspack/core';
4
4
  import {NodeFS} from '@atlaspack/fs';
5
5
  import {openInBrowser} from '@atlaspack/utils';
6
6
  import {Disposable} from '@atlaspack/events';
@@ -132,8 +132,24 @@ async function run(
132
132
 
133
133
  entries = entries.map((entry) => path.resolve(entry));
134
134
 
135
- const resolve = (specifier, {paths}) => {
136
- for (let path of paths) {
135
+ let fs = new NodeFS();
136
+
137
+ const resolveDefaultConfig = () => {
138
+ if (isSuperPackage()) {
139
+ // We're in the super package so resolve the inbuilt config
140
+ let inbuiltDefaultConfig = path.join(
141
+ /*#__ATLASPACK_IGNORE__*/ __dirname,
142
+ '../../configs/default/index.json.js',
143
+ );
144
+ if (!fs.existsSync(inbuiltDefaultConfig)) {
145
+ throw new Error(
146
+ `Missing inbuilt default config. Expected '${inbuiltDefaultConfig}' to exist`,
147
+ );
148
+ }
149
+ return inbuiltDefaultConfig;
150
+ }
151
+
152
+ for (let path of [fs.cwd(), __dirname]) {
137
153
  let customRequire = require('module').createRequire(path);
138
154
  try {
139
155
  return customRequire.resolve('@atlaspack/config-default');
@@ -141,19 +157,14 @@ async function run(
141
157
  // Ignore error
142
158
  }
143
159
  }
144
- throw new Error(
145
- `Can't resolve "${specifier}" from any of [${paths.join(', ')}]`,
146
- );
160
+ throw new Error(`Can't resolve default config`);
147
161
  };
148
162
 
149
163
  let Atlaspack = require('@atlaspack/core').default;
150
- let fs = new NodeFS();
151
164
  let options = await normalizeOptions(command, fs);
152
165
  let atlaspack = new Atlaspack({
153
166
  entries,
154
- defaultConfig: resolve('@atlaspack/config-default', {
155
- paths: [fs.cwd(), __dirname],
156
- }),
167
+ defaultConfig: resolveDefaultConfig(),
157
168
  shouldPatchConsole: false,
158
169
  ...options,
159
170
  });