@atlaspack/package-manager 2.12.1-dev.3567 → 2.13.1-canary.3630

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/package-manager",
3
- "version": "2.12.1-dev.3567+c06f4487e",
3
+ "version": "2.13.1-canary.3630+10a6f37ef",
4
4
  "description": "Blazing fast, zero configuration web application bundler",
5
5
  "license": "(MIT OR Apache-2.0)",
6
6
  "publishConfig": {
@@ -39,15 +39,15 @@
39
39
  }
40
40
  },
41
41
  "dependencies": {
42
- "@atlaspack/build-cache": "2.12.1-dev.3567+c06f4487e",
43
- "@atlaspack/diagnostic": "2.12.1-dev.3567+c06f4487e",
44
- "@atlaspack/fs": "2.12.1-dev.3567+c06f4487e",
45
- "@atlaspack/logger": "2.12.1-dev.3567+c06f4487e",
46
- "@atlaspack/node-resolver-core": "3.3.1-dev.3567+c06f4487e",
47
- "@atlaspack/types": "2.12.1-dev.3567+c06f4487e",
48
- "@atlaspack/utils": "2.12.1-dev.3567+c06f4487e",
49
- "@atlaspack/workers": "2.12.1-dev.3567+c06f4487e",
50
- "@swc/core": "^1.7.26",
42
+ "@atlaspack/build-cache": "2.13.1-canary.3630+10a6f37ef",
43
+ "@atlaspack/diagnostic": "2.13.1-canary.3630+10a6f37ef",
44
+ "@atlaspack/fs": "2.13.1-canary.3630+10a6f37ef",
45
+ "@atlaspack/logger": "2.13.1-canary.3630+10a6f37ef",
46
+ "@atlaspack/node-resolver-core": "3.4.1-canary.3630+10a6f37ef",
47
+ "@atlaspack/types": "2.13.1-canary.3630+10a6f37ef",
48
+ "@atlaspack/utils": "2.13.1-canary.3630+10a6f37ef",
49
+ "@atlaspack/workers": "2.13.1-canary.3630+10a6f37ef",
50
+ "@swc/core": "^1.10.0",
51
51
  "semver": "^7.5.2"
52
52
  },
53
53
  "devDependencies": {
@@ -62,5 +62,5 @@
62
62
  "./src/Pnpm.js": false,
63
63
  "./src/Yarn.js": false
64
64
  },
65
- "gitHead": "c06f4487ebddc632957147c8b585a97e149062a1"
65
+ "gitHead": "10a6f37ef063d0227ebb26310383e899dbd9b1e6"
66
66
  }
@@ -33,6 +33,7 @@ import {getModuleParts} from '@atlaspack/utils';
33
33
  import {getConflictingLocalDependencies} from './utils';
34
34
  import {installPackage} from './installPackage';
35
35
  import pkg from '../package.json';
36
+ import {getConditionsFromEnv} from './nodejsConditions';
36
37
  import {ResolverBase} from '@atlaspack/node-resolver-core';
37
38
  import {pathToFileURL} from 'url';
38
39
  import {transformSync} from '@swc/core';
@@ -587,6 +588,7 @@ export class NodePackageManager implements PackageManager {
587
588
  filename: name,
588
589
  specifierType: 'commonjs',
589
590
  parent: from,
591
+ packageConditions: getConditionsFromEnv(),
590
592
  });
591
593
 
592
594
  // Invalidate whenever the .pnp.js file changes.
@@ -0,0 +1,35 @@
1
+ // @flow
2
+ import process from 'process';
3
+
4
+ // https://nodejs.org/api/packages.html#conditional-exports
5
+ // TODO We don't support { "type": "module" }
6
+ export const defaultNodejsConditions: Array<string> = Object.freeze([
7
+ 'node-addons',
8
+ 'node',
9
+ // 'import',
10
+ 'require',
11
+ 'module-sync',
12
+ 'default',
13
+ ]);
14
+
15
+ let envConditions: void | Array<string> = undefined;
16
+
17
+ /** @description Gets the export conditions from NODE_OPTIONS and node arguments */
18
+ export function getConditionsFromEnv(): Array<string> {
19
+ if (!envConditions) {
20
+ const conditions = [];
21
+
22
+ for (const arg of [
23
+ ...process.execArgv,
24
+ ...(process.env.NODE_OPTIONS || '').split(' '),
25
+ ]) {
26
+ if (arg.startsWith('--conditions=')) {
27
+ conditions.push(arg.substring(13));
28
+ }
29
+ }
30
+
31
+ envConditions = Object.freeze([...conditions, ...defaultNodejsConditions]);
32
+ }
33
+
34
+ return envConditions;
35
+ }