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 +4 -3
- package/dist/launcher.cjs +17 -25
- package/dist/native-manifest.json +47 -36
- package/package.json +1 -1
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
|
-
|
|
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
|
|
11
|
-
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
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.
|
|
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-
|
|
8
|
+
"file": "darwin-arm64-5d379f2a81a8f81aaccd96dcc9b12bd6bf15bb32c0c4db26e546bbb24f66284a.br",
|
|
8
9
|
"encoding": "br",
|
|
9
|
-
"binaryBytes":
|
|
10
|
-
"compressedBytes":
|
|
11
|
-
"compressedSha256": "
|
|
12
|
-
"binarySha256": "
|
|
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": "
|
|
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": "
|
|
27
|
+
"binarySha256": "5d379f2a81a8f81aaccd96dcc9b12bd6bf15bb32c0c4db26e546bbb24f66284a"
|
|
25
28
|
}
|
|
26
29
|
},
|
|
27
30
|
"darwin-x64": {
|
|
28
|
-
"file": "darwin-x64-
|
|
31
|
+
"file": "darwin-x64-9859d1a8fdcc2b7919d1ad699af37816d31f05fa0ee0d7105948939d394d664b.br",
|
|
29
32
|
"encoding": "br",
|
|
30
|
-
"binaryBytes":
|
|
31
|
-
"compressedBytes":
|
|
32
|
-
"compressedSha256": "
|
|
33
|
-
"binarySha256": "
|
|
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": "
|
|
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": "
|
|
50
|
+
"binarySha256": "9859d1a8fdcc2b7919d1ad699af37816d31f05fa0ee0d7105948939d394d664b"
|
|
46
51
|
}
|
|
47
52
|
},
|
|
48
53
|
"linux-arm64-gnu": {
|
|
49
|
-
"file": "linux-arm64-gnu-
|
|
54
|
+
"file": "linux-arm64-gnu-393baf730695affe355c08d50def939934854d4f193e55ab7730c76a9fd68dba.br",
|
|
50
55
|
"encoding": "br",
|
|
51
|
-
"binaryBytes":
|
|
52
|
-
"compressedBytes":
|
|
53
|
-
"compressedSha256": "
|
|
54
|
-
"binarySha256": "
|
|
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": "
|
|
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": "
|
|
73
|
+
"binarySha256": "393baf730695affe355c08d50def939934854d4f193e55ab7730c76a9fd68dba"
|
|
67
74
|
}
|
|
68
75
|
},
|
|
69
76
|
"linux-x64-gnu": {
|
|
70
|
-
"file": "linux-x64-gnu-
|
|
77
|
+
"file": "linux-x64-gnu-1be4d8ea74fc930f16bfd539cacd36ec1be306ced4cb239e275a3c6586e982e7.br",
|
|
71
78
|
"encoding": "br",
|
|
72
|
-
"binaryBytes":
|
|
73
|
-
"compressedBytes":
|
|
74
|
-
"compressedSha256": "
|
|
75
|
-
"binarySha256": "
|
|
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": "
|
|
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": "
|
|
96
|
+
"binarySha256": "1be4d8ea74fc930f16bfd539cacd36ec1be306ced4cb239e275a3c6586e982e7"
|
|
88
97
|
}
|
|
89
98
|
},
|
|
90
99
|
"win32-x64": {
|
|
91
|
-
"file": "win32-x64-
|
|
100
|
+
"file": "win32-x64-9eb8e722c9f8ece527ccbe4261ec39f74d34daafea3f465081fd626592327be3.br",
|
|
92
101
|
"encoding": "br",
|
|
93
|
-
"binaryBytes":
|
|
94
|
-
"compressedBytes":
|
|
95
|
-
"compressedSha256": "
|
|
96
|
-
"binarySha256": "
|
|
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": "
|
|
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": "
|
|
119
|
+
"binarySha256": "9eb8e722c9f8ece527ccbe4261ec39f74d34daafea3f465081fd626592327be3"
|
|
109
120
|
}
|
|
110
121
|
}
|
|
111
122
|
}
|