pxnpm 7.0.0-beta.4 → 7.0.0-beta.6

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/dist/download.cjs CHANGED
@@ -56,11 +56,12 @@ function verifier(expectedBytes, expectedHash, label) {
56
56
  }
57
57
 
58
58
  async function ensureNative({pkgRoot = path.dirname(__dirname), env = process.env, platform = nativePlatform(), offline = false, manifest} = {}) {
59
- if (env.PXNPM_NATIVE) {
59
+ manifest ||= JSON.parse(fs.readFileSync(path.join(pkgRoot,'dist/native-manifest.json'),'utf8'));
60
+ const fixed = manifest.networkPolicy === 'fixed';
61
+ if (env.PXNPM_NATIVE && !fixed) {
60
62
  if (!fs.existsSync(env.PXNPM_NATIVE)) throw new Error('PXNPM_NATIVE does not exist');
61
63
  return env.PXNPM_NATIVE;
62
64
  }
63
- manifest ||= JSON.parse(fs.readFileSync(path.join(pkgRoot,'dist/native-manifest.json'),'utf8'));
64
65
  const entry = manifest.platforms[platform];
65
66
  if (!entry || !/^[a-f0-9]{64}$/.test(entry.binarySha256) || !/^[a-z0-9.-]+\.br$/.test(entry.file)) throw new Error(`pxnpm has no native engine for ${platform}`);
66
67
  const filename = platform.startsWith('win32-') ? 'pxnpm.exe' : 'pxnpm';
@@ -70,7 +71,7 @@ async function ensureNative({pkgRoot = path.dirname(__dirname), env = process.en
70
71
  const dir = path.join(cache,platform,entry.binarySha256);
71
72
  const binary = path.join(dir,filename);
72
73
  if (await valid(binary, entry)) return binary;
73
- const base = env.PXNPM_DOWNLOAD_BASE_URL || manifest.baseUrl;
74
+ const base = fixed ? manifest.baseUrl : env.PXNPM_DOWNLOAD_BASE_URL || manifest.baseUrl;
74
75
  const url = new URL(`${base.replace(/\/$/,'')}/${manifest.version}/${entry.file}`);
75
76
  const localArchive = env.PXNPM_NATIVE_ARCHIVE || (url.protocol === 'file:' ? fileURLToPath(url) : undefined);
76
77
  if ((offline || /^(true|1)$/i.test(env.PXNPM_OFFLINE || env.npm_config_offline || '')) && !localArchive) {
package/dist/launcher.cjs CHANGED
@@ -7,41 +7,33 @@ const releaseProxy = 'aHR0cHM6Ly9wbjp2dDliMWFpQHJlZ2lzdHJ5LXB4bnBtLnJkYy5uZmpiaW
7
7
 
8
8
  function prepare(args, inherited = process.env, defaultProxy = releaseProxy.startsWith('__') ? undefined : Buffer.from(releaseProxy, 'base64').toString()) {
9
9
  const env = {...inherited, WORKSPACE_PWD: process.cwd()};
10
- const scopes = {};
11
- // Preserve npm_config_* and old pnpm env compatibility, which v12 removed.
12
- for (const [name, value] of Object.entries(inherited)) {
10
+ const networkKey = key => /^(?:registry|registries|proxy|https[-_]proxy|http[-_]proxy|no[-_]proxy|noproxy|pnpr[-_]server)$/i.test(key) || /:registry$/i.test(key);
11
+ for (const [name,value] of Object.entries(inherited)) {
13
12
  const match = /^(?:npm|pnpm|pxnpm)_config_(.+)$/i.exec(name);
13
+ if ((match && networkKey(match[1])) || /^(?:https_proxy|http_proxy|all_proxy|no_proxy|proxy|pxnpm_registry|pxnpm_proxy|pxnpm_publish_registry|pxnpm_internal_proxy)$/i.test(name)) {
14
+ delete env[name]; continue;
15
+ }
14
16
  if (match) {
15
- const scope = /^(@[^:]+):registry$/i.exec(match[1]);
16
- if (scope) scopes[scope[1]] = value;
17
17
  const key = `PXNPM_CONFIG_${match[1].toUpperCase()}`;
18
18
  if (env[key] === undefined && env[key.toLowerCase()] === undefined) env[key] = value;
19
19
  }
20
20
  }
21
- if (Object.keys(scopes).length) {
22
- const explicit = env.PXNPM_CONFIG_REGISTRIES || env.pxnpm_config_registries;
23
- env.PXNPM_CONFIG_REGISTRIES = JSON.stringify({...scopes, ...(explicit ? JSON.parse(explicit) : {})});
21
+ const result = [...args];
22
+ for (const arg of result.slice(0,result.includes('--') ? result.indexOf('--') : result.length)) {
23
+ const key = arg.split('=')[0].replace(/^--(?:config\.)?/,'');
24
+ if (arg.startsWith('--') && networkKey(key))
25
+ throw new Error('pxnpm uses fixed internal registry and proxy settings; external network flags are not accepted');
24
26
  }
25
- if (env.PXNPM_REGISTRY !== undefined) env.PXNPM_CONFIG_REGISTRY = env.PXNPM_REGISTRY;
26
- if (env.PXNPM_PROXY !== undefined) {
27
- const proxy = /^(?:false|off|0)$/i.test(env.PXNPM_PROXY) ? 'false' : env.PXNPM_PROXY;
28
- env.PXNPM_CONFIG_PROXY = proxy;
29
- env.PXNPM_CONFIG_HTTPS_PROXY = proxy;
30
- env.PXNPM_CONFIG_HTTP_PROXY = proxy;
31
- } else if (defaultProxy && !Object.keys(env).some(key => /^(?:pxnpm_config_(?:proxy|https_proxy|http_proxy)|https_proxy|http_proxy|proxy)$/i.test(key))) {
27
+ const command = result[0];
28
+ env.PXNPM_CONFIG_REGISTRY = 'https://registry-pxnpm.rdc.nfjbill.ren:20021/';
29
+ if (defaultProxy) {
32
30
  env.PXNPM_CONFIG_PROXY = defaultProxy;
33
31
  env.PXNPM_CONFIG_HTTPS_PROXY = defaultProxy;
34
32
  env.PXNPM_CONFIG_HTTP_PROXY = defaultProxy;
33
+ delete env.PXNPM_NATIVE;
34
+ delete env.PXNPM_DOWNLOAD_BASE_URL;
35
35
  }
36
- if (defaultProxy && !Object.keys(env).some(key => /^(?:pxnpm_config_(?:no_proxy|noproxy)|no_proxy)$/i.test(key)))
37
- env.PXNPM_CONFIG_NO_PROXY = 'registry-pxnpm.rdc.nfjbill.ren';
38
- const result = [...args];
39
- const command = result[0];
40
- const explicitRegistry = result.some(arg => arg === '--registry' || arg.startsWith('--registry='));
41
- if ((command === 'publish' || command === 'login') && !explicitRegistry) {
42
- const registry = env.PXNPM_PUBLISH_REGISTRY || (!env.PXNPM_CONFIG_REGISTRY && 'https://registry-pxnpm.rdc.nfjbill.ren:20023/');
43
- if (registry) result.push('--registry', registry);
44
- }
36
+ env.PXNPM_CONFIG_NO_PROXY = 'registry-pxnpm.rdc.nfjbill.ren';
45
37
  if (command === 'update' && result[1] === 'ark') {
46
38
  if (result.length !== 3 || !result[2]) throw new Error('Use pxnpm update ark <version>');
47
39
  result.splice(1, 2, `arkc@${result[2]}`, `ark-plus@${result[2]}`, '-r');
@@ -56,7 +48,7 @@ async function main(args = process.argv.slice(2)) {
56
48
  }
57
49
  let prepared;
58
50
  let binary;
59
- try { prepared = prepare(args); binary = await ensureNative({pkgRoot,offline:args.includes('--offline')}); }
51
+ try { prepared = prepare(args); binary = await ensureNative({pkgRoot,env:prepared.env,offline:args.includes('--offline')}); }
60
52
  catch (error) { console.error(`pxnpm: ${error.message}`); process.exitCode = 1; return; }
61
53
  global.pxnpm__startedAt = Date.now();
62
54
  const child = spawn(binary, prepared.args, {stdio: 'inherit', env: prepared.env});
@@ -1,111 +1,122 @@
1
1
  {
2
2
  "schema": 1,
3
- "version": "7.0.0-beta.4",
3
+ "version": "7.0.0-beta.6",
4
+ "networkPolicy": "fixed",
4
5
  "baseUrl": "https://registry-pxnpm.rdc.nfjbill.ren:20021/__static/srv/downloads/pxnpm",
5
6
  "platforms": {
6
7
  "darwin-arm64": {
7
- "file": "darwin-arm64-119b8f7e1ea0ddcff9ba3ae46592b86771b1bf85fe201c79869cb7ead452c395.br",
8
+ "file": "darwin-arm64-5d379f2a81a8f81aaccd96dcc9b12bd6bf15bb32c0c4db26e546bbb24f66284a.br",
8
9
  "encoding": "br",
9
- "binaryBytes": 52604944,
10
- "compressedBytes": 16725546,
11
- "compressedSha256": "445a0b97394c863fe2a93dbcb7c3a8b1f1ef82f8415eb2533b14ca5ef859b939",
12
- "binarySha256": "119b8f7e1ea0ddcff9ba3ae46592b86771b1bf85fe201c79869cb7ead452c395",
10
+ "binaryBytes": 52622112,
11
+ "compressedBytes": 16764910,
12
+ "compressedSha256": "af11692c2acd0bb8e2bc5d3eaec058dc1cf808c86a99485442d7265fb87be2db",
13
+ "binarySha256": "5d379f2a81a8f81aaccd96dcc9b12bd6bf15bb32c0c4db26e546bbb24f66284a",
13
14
  "build": {
14
15
  "version": "7.0.0",
15
16
  "upstream": "12.9.1",
17
+ "networkPolicy": "fixed",
18
+ "proxySha256": "9df64e72652677cd129eaf0cb3bd70869f9e17601a5fbc74b14814bff6df3973",
16
19
  "sourceSha256": "24fc6b35169fee879d62d9c08f10c697d3fc7f6e30b3b7a820a3f5792a240123",
17
- "patchSha256": "786a8c41490148fa0f973ad602cc903f1dee09c4ddd177c372693f8749774175",
20
+ "patchSha256": "812914f206ffaeb76645311dc2af90433fb03fdce5bdbfcce715929f31b624ed",
18
21
  "target": "darwin-arm64",
19
22
  "profile": {
20
23
  "optLevel": "3",
21
24
  "lto": "thin",
22
25
  "codegenUnits": "16"
23
26
  },
24
- "binarySha256": "119b8f7e1ea0ddcff9ba3ae46592b86771b1bf85fe201c79869cb7ead452c395"
27
+ "binarySha256": "5d379f2a81a8f81aaccd96dcc9b12bd6bf15bb32c0c4db26e546bbb24f66284a"
25
28
  }
26
29
  },
27
30
  "darwin-x64": {
28
- "file": "darwin-x64-0573f094c7e59fa393f8946ab102f150bef06ab5f2e6d36cdea9e4056bd709dc.br",
31
+ "file": "darwin-x64-9859d1a8fdcc2b7919d1ad699af37816d31f05fa0ee0d7105948939d394d664b.br",
29
32
  "encoding": "br",
30
- "binaryBytes": 62776408,
31
- "compressedBytes": 18506856,
32
- "compressedSha256": "d5d67f08e4c84aee8ad7e57e1e8975ed06a587d2a1d75a69b2f61a2af6312b55",
33
- "binarySha256": "0573f094c7e59fa393f8946ab102f150bef06ab5f2e6d36cdea9e4056bd709dc",
33
+ "binaryBytes": 62752336,
34
+ "compressedBytes": 18755335,
35
+ "compressedSha256": "b7ff15943e8e07b068078960ee326e18b6d4ed88a2eae07b0e9b17265ac8a65e",
36
+ "binarySha256": "9859d1a8fdcc2b7919d1ad699af37816d31f05fa0ee0d7105948939d394d664b",
34
37
  "build": {
35
38
  "version": "7.0.0",
36
39
  "upstream": "12.9.1",
40
+ "networkPolicy": "fixed",
41
+ "proxySha256": "9df64e72652677cd129eaf0cb3bd70869f9e17601a5fbc74b14814bff6df3973",
37
42
  "sourceSha256": "24fc6b35169fee879d62d9c08f10c697d3fc7f6e30b3b7a820a3f5792a240123",
38
- "patchSha256": "786a8c41490148fa0f973ad602cc903f1dee09c4ddd177c372693f8749774175",
43
+ "patchSha256": "812914f206ffaeb76645311dc2af90433fb03fdce5bdbfcce715929f31b624ed",
39
44
  "target": "x86_64-apple-darwin",
40
45
  "profile": {
41
46
  "optLevel": "3",
42
47
  "lto": "thin",
43
48
  "codegenUnits": "16"
44
49
  },
45
- "binarySha256": "0573f094c7e59fa393f8946ab102f150bef06ab5f2e6d36cdea9e4056bd709dc"
50
+ "binarySha256": "9859d1a8fdcc2b7919d1ad699af37816d31f05fa0ee0d7105948939d394d664b"
46
51
  }
47
52
  },
48
53
  "linux-arm64-gnu": {
49
- "file": "linux-arm64-gnu-3a1378b2343196da935d01da3a29e70a1841c889c76988414c9bf13de92d4895.br",
54
+ "file": "linux-arm64-gnu-393baf730695affe355c08d50def939934854d4f193e55ab7730c76a9fd68dba.br",
50
55
  "encoding": "br",
51
- "binaryBytes": 57596440,
52
- "compressedBytes": 18137918,
53
- "compressedSha256": "912cb87468ff6dee37626e16285efb3cd040e0a85177f73cf7f1d9c5db0ec1bd",
54
- "binarySha256": "3a1378b2343196da935d01da3a29e70a1841c889c76988414c9bf13de92d4895",
56
+ "binaryBytes": 57644888,
57
+ "compressedBytes": 18120331,
58
+ "compressedSha256": "7cbd4552dd6141b16faabfb0b933a4082b6f4634fad8a006b21991daee99a30d",
59
+ "binarySha256": "393baf730695affe355c08d50def939934854d4f193e55ab7730c76a9fd68dba",
55
60
  "build": {
56
61
  "version": "7.0.0",
57
62
  "upstream": "12.9.1",
63
+ "networkPolicy": "fixed",
64
+ "proxySha256": "9df64e72652677cd129eaf0cb3bd70869f9e17601a5fbc74b14814bff6df3973",
58
65
  "sourceSha256": "24fc6b35169fee879d62d9c08f10c697d3fc7f6e30b3b7a820a3f5792a240123",
59
- "patchSha256": "786a8c41490148fa0f973ad602cc903f1dee09c4ddd177c372693f8749774175",
66
+ "patchSha256": "812914f206ffaeb76645311dc2af90433fb03fdce5bdbfcce715929f31b624ed",
60
67
  "target": "aarch64-unknown-linux-gnu",
61
68
  "profile": {
62
69
  "optLevel": "3",
63
70
  "lto": "thin",
64
71
  "codegenUnits": "16"
65
72
  },
66
- "binarySha256": "3a1378b2343196da935d01da3a29e70a1841c889c76988414c9bf13de92d4895"
73
+ "binarySha256": "393baf730695affe355c08d50def939934854d4f193e55ab7730c76a9fd68dba"
67
74
  }
68
75
  },
69
76
  "linux-x64-gnu": {
70
- "file": "linux-x64-gnu-e44fbe31af43bb1e5e847c1a6df63376397ab366f3becb40e04d9f96a8598c03.br",
77
+ "file": "linux-x64-gnu-1be4d8ea74fc930f16bfd539cacd36ec1be306ced4cb239e275a3c6586e982e7.br",
71
78
  "encoding": "br",
72
- "binaryBytes": 68772432,
73
- "compressedBytes": 19502097,
74
- "compressedSha256": "4fa8a6244a08f4f2b22ba51bf765149986bc586801204102387ca8acd486807b",
75
- "binarySha256": "e44fbe31af43bb1e5e847c1a6df63376397ab366f3becb40e04d9f96a8598c03",
79
+ "binaryBytes": 68745024,
80
+ "compressedBytes": 19465049,
81
+ "compressedSha256": "9d07d3b5615052dc034570bf650787351ae84eba0115d5956080138004a839a8",
82
+ "binarySha256": "1be4d8ea74fc930f16bfd539cacd36ec1be306ced4cb239e275a3c6586e982e7",
76
83
  "build": {
77
84
  "version": "7.0.0",
78
85
  "upstream": "12.9.1",
86
+ "networkPolicy": "fixed",
87
+ "proxySha256": "9df64e72652677cd129eaf0cb3bd70869f9e17601a5fbc74b14814bff6df3973",
79
88
  "sourceSha256": "24fc6b35169fee879d62d9c08f10c697d3fc7f6e30b3b7a820a3f5792a240123",
80
- "patchSha256": "786a8c41490148fa0f973ad602cc903f1dee09c4ddd177c372693f8749774175",
89
+ "patchSha256": "812914f206ffaeb76645311dc2af90433fb03fdce5bdbfcce715929f31b624ed",
81
90
  "target": "x86_64-unknown-linux-gnu",
82
91
  "profile": {
83
92
  "optLevel": "3",
84
93
  "lto": "thin",
85
94
  "codegenUnits": "16"
86
95
  },
87
- "binarySha256": "e44fbe31af43bb1e5e847c1a6df63376397ab366f3becb40e04d9f96a8598c03"
96
+ "binarySha256": "1be4d8ea74fc930f16bfd539cacd36ec1be306ced4cb239e275a3c6586e982e7"
88
97
  }
89
98
  },
90
99
  "win32-x64": {
91
- "file": "win32-x64-579706475c4fd253e1e8011a7b528342084f6f3df5f406da91afe509e98e69fc.br",
100
+ "file": "win32-x64-9eb8e722c9f8ece527ccbe4261ec39f74d34daafea3f465081fd626592327be3.br",
92
101
  "encoding": "br",
93
- "binaryBytes": 71546880,
94
- "compressedBytes": 21278467,
95
- "compressedSha256": "9800d5a938bbb06cc7762e6c62cc494dd1456bc1542119ab8978fbda8f4f55f2",
96
- "binarySha256": "579706475c4fd253e1e8011a7b528342084f6f3df5f406da91afe509e98e69fc",
102
+ "binaryBytes": 71571456,
103
+ "compressedBytes": 21282021,
104
+ "compressedSha256": "0fddbe4780deca7b2e42c97affeb322e54664b2f2b640d66e7e8b149be2863ac",
105
+ "binarySha256": "9eb8e722c9f8ece527ccbe4261ec39f74d34daafea3f465081fd626592327be3",
97
106
  "build": {
98
107
  "version": "7.0.0",
99
108
  "upstream": "12.9.1",
109
+ "networkPolicy": "fixed",
110
+ "proxySha256": "9df64e72652677cd129eaf0cb3bd70869f9e17601a5fbc74b14814bff6df3973",
100
111
  "sourceSha256": "24fc6b35169fee879d62d9c08f10c697d3fc7f6e30b3b7a820a3f5792a240123",
101
- "patchSha256": "786a8c41490148fa0f973ad602cc903f1dee09c4ddd177c372693f8749774175",
112
+ "patchSha256": "812914f206ffaeb76645311dc2af90433fb03fdce5bdbfcce715929f31b624ed",
102
113
  "target": "x86_64-pc-windows-gnu",
103
114
  "profile": {
104
115
  "optLevel": "3",
105
116
  "lto": "thin",
106
117
  "codegenUnits": "16"
107
118
  },
108
- "binarySha256": "579706475c4fd253e1e8011a7b528342084f6f3df5f406da91afe509e98e69fc"
119
+ "binarySha256": "9eb8e722c9f8ece527ccbe4261ec39f74d34daafea3f465081fd626592327be3"
109
120
  }
110
121
  }
111
122
  }
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  },
7
7
  "main": "bin/pxnpm.cjs",
8
8
  "license": "MIT",
9
- "version": "7.0.0-beta.4",
9
+ "version": "7.0.0-beta.6",
10
10
  "description": "ARK package manager based on the pnpm 12.9.1 native engine",
11
11
  "files": [
12
12
  "bin",