@neon-rs/cli 0.0.176 → 0.0.177
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/index.js +257 -181
- package/package.json +8 -8
package/index.js
CHANGED
|
@@ -44171,7 +44171,7 @@ function wrappy (fn, cb) {
|
|
|
44171
44171
|
|
|
44172
44172
|
/***/ }),
|
|
44173
44173
|
|
|
44174
|
-
/***/
|
|
44174
|
+
/***/ 5834:
|
|
44175
44175
|
/***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
|
|
44176
44176
|
|
|
44177
44177
|
|
|
@@ -45954,10 +45954,10 @@ var temp = __nccwpck_require__(591);
|
|
|
45954
45954
|
;// CONCATENATED MODULE: ./data/rust.json
|
|
45955
45955
|
const rust_namespaceObject = JSON.parse('{"aarch64-apple-darwin":"darwin-arm64","x86_64-apple-darwin":"darwin-x64","aarch64-apple-ios":"ios-arm64","x86_64-apple-ios":"ios-x64","aarch64-linux-android":"android-arm64","armv7-linux-androideabi":"android-arm-eabi","i686-linux-android":"android-ia32","x86_64-linux-android":"android-x64","aarch64-pc-windows-msvc":"win32-arm64-msvc","i686-pc-windows-gnu":"win32-ia32-gnu","i686-pc-windows-msvc":"win32-ia32-msvc","x86_64-pc-windows-gnu":"win32-x64-gnu","x86_64-pc-windows-msvc":"win32-x64-msvc","aarch64-unknown-linux-gnu":"linux-arm64-gnu","aarch64-unknown-linux-musl":"linux-arm64-musl","arm-unknown-linux-gnueabihf":"linux-arm-gnueabihf","arm-unknown-linux-musleabihf":"linux-arm-musleabihf","armv7-unknown-linux-gnueabihf":"linux-arm-gnueabihf","armv7-unknown-linux-musleabihf":"linux-arm-musleabihf","i686-unknown-linux-gnu":"linux-ia32-gnu","i686-unknown-linux-musl":"linux-ia32-musl","mips-unknown-linux-gnu":"linux-mips-gnu","mips-unknown-linux-musl":"linux-mips-musl","mips64-unknown-linux-gnuabi64":"linux-mips64-gnuabi64","mips64-unknown-linux-muslabi64":"linux-mips64-muslabi64","mips64el-unknown-linux-gnuabi64":"linux-mips64el-gnuabi64","mips64el-unknown-linux-muslabi64":"linux-mips64el-muslabi64","mipsel-unknown-linux-gnu":"linux-mipsel-gnu","mipsel-unknown-linux-musl":"linux-mipsel-musl","powerpc-unknown-linux-gnu":"linux-powerpc-gnu","powerpc64-unknown-linux-gnu":"linux-powerpc64-gnu","powerpc64le-unknown-linux-gnu":"linux-powerpc64le-gnu","riscv64gc-unknown-linux-gnu":"linux-riscv64gc-gnu","s390x-unknown-linux-gnu":"linux-s390x-gnu","sparc64-unknown-linux-gnu":"linux-sparc64-gnu","x86_64-unknown-linux-gnu":"linux-x64-gnu","x86_64-unknown-linux-gnux32":"linux-x64-gnux32","x86_64-unknown-linux-musl":"linux-x64-musl","i686-unknown-freebsd":"freebsd-ia32","x86_64-unknown-freebsd":"freebsd-x64"}');
|
|
45956
45956
|
;// CONCATENATED MODULE: ./data/node.json
|
|
45957
|
-
const node_namespaceObject = JSON.parse('{"darwin-arm64":{"
|
|
45957
|
+
const node_namespaceObject = JSON.parse('{"darwin-arm64":{"os":"darwin","arch":"arm64","abi":null,"llvm":["aarch64-apple-darwin"]},"darwin-x64":{"os":"darwin","arch":"x64","abi":null,"llvm":["x86_64-apple-darwin"]},"ios-arm64":{"os":"ios","arch":"arm64","abi":null,"llvm":["aarch64-apple-ios"]},"ios-x64":{"os":"ios","arch":"x64","abi":null,"llvm":["x86_64-apple-ios"]},"android-arm64":{"os":"android","arch":"arm64","abi":null,"llvm":["aarch64-linux-android"]},"android-arm-eabi":{"os":"android","arch":"arm","abi":"eabi","llvm":["armv7-linux-androideabi"]},"android-ia32":{"os":"android","arch":"ia32","abi":null,"llvm":["i686-linux-android"]},"android-x64":{"os":"android","arch":"x64","abi":null,"llvm":["x86_64-linux-android"]},"win32-arm64-msvc":{"os":"win32","arch":"arm64","abi":"msvc","llvm":["aarch64-pc-windows-msvc"]},"win32-ia32-gnu":{"os":"win32","arch":"ia32","abi":"gnu","llvm":["i686-pc-windows-gnu"]},"win32-ia32-msvc":{"os":"win32","arch":"ia32","abi":"msvc","llvm":["i686-pc-windows-msvc"]},"win32-x64-gnu":{"os":"win32","arch":"x64","abi":"gnu","llvm":["x86_64-pc-windows-gnu"]},"win32-x64-msvc":{"os":"win32","arch":"x64","abi":"msvc","llvm":["x86_64-pc-windows-msvc"]},"linux-arm64-gnu":{"os":"linux","arch":"arm64","abi":"gnu","llvm":["aarch64-unknown-linux-gnu"]},"linux-arm64-musl":{"os":"linux","arch":"arm64","abi":"musl","llvm":["aarch64-unknown-linux-musl"]},"linux-arm-gnueabihf":{"os":"linux","arch":"arm","abi":"gnueabihf","llvm":["arm-unknown-linux-gnueabihf","armv7-unknown-linux-gnueabihf"]},"linux-arm-musleabihf":{"os":"linux","arch":"arm","abi":"musleabihf","llvm":["arm-unknown-linux-musleabihf","armv7-unknown-linux-musleabihf"]},"linux-ia32-gnu":{"os":"linux","arch":"ia32","abi":"gnu","llvm":["i686-unknown-linux-gnu"]},"linux-ia32-musl":{"os":"linux","arch":"ia32","abi":"musl","llvm":["i686-unknown-linux-musl"]},"linux-mips-gnu":{"os":"linux","arch":"mips","abi":"gnu","llvm":["mips-unknown-linux-gnu"]},"linux-mips-musl":{"os":"linux","arch":"mips","abi":"musl","llvm":["mips-unknown-linux-musl"]},"linux-mips64-gnuabi64":{"os":"linux","arch":"mips64","abi":"gnuabi64","llvm":["mips64-unknown-linux-gnuabi64"]},"linux-mips64-muslabi64":{"os":"linux","arch":"mips64","abi":"muslabi64","llvm":["mips64-unknown-linux-muslabi64"]},"linux-mips64el-gnuabi64":{"os":"linux","arch":"mips64el","abi":"gnuabi64","llvm":["mips64el-unknown-linux-gnuabi64"]},"linux-mips64el-muslabi64":{"os":"linux","arch":"mips64el","abi":"muslabi64","llvm":["mips64el-unknown-linux-muslabi64"]},"linux-mipsel-gnu":{"os":"linux","arch":"mipsel","abi":"gnu","llvm":["mipsel-unknown-linux-gnu"]},"linux-mipsel-musl":{"os":"linux","arch":"mipsel","abi":"musl","llvm":["mipsel-unknown-linux-musl"]},"linux-powerpc-gnu":{"os":"linux","arch":"powerpc","abi":"gnu","llvm":["powerpc-unknown-linux-gnu"]},"linux-powerpc64-gnu":{"os":"linux","arch":"powerpc64","abi":"gnu","llvm":["powerpc64-unknown-linux-gnu"]},"linux-powerpc64le-gnu":{"os":"linux","arch":"powerpc64le","abi":"gnu","llvm":["powerpc64le-unknown-linux-gnu"]},"linux-riscv64gc-gnu":{"os":"linux","arch":"riscv64gc","abi":"gnu","llvm":["riscv64gc-unknown-linux-gnu"]},"linux-s390x-gnu":{"os":"linux","arch":"s390x","abi":"gnu","llvm":["s390x-unknown-linux-gnu"]},"linux-sparc64-gnu":{"os":"linux","arch":"sparc64","abi":"gnu","llvm":["sparc64-unknown-linux-gnu"]},"linux-x64-gnu":{"os":"linux","arch":"x64","abi":"gnu","llvm":["x86_64-unknown-linux-gnu"]},"linux-x64-gnux32":{"os":"linux","arch":"x64","abi":"gnux32","llvm":["x86_64-unknown-linux-gnux32"]},"linux-x64-musl":{"os":"linux","arch":"x64","abi":"musl","llvm":["x86_64-unknown-linux-musl"]},"freebsd-ia32":{"os":"freebsd","arch":"ia32","abi":null,"llvm":["i686-unknown-freebsd"]},"freebsd-x64":{"os":"freebsd","arch":"x64","abi":null,"llvm":["x86_64-unknown-freebsd"]}}');
|
|
45958
45958
|
;// CONCATENATED MODULE: ./data/preset.json
|
|
45959
45959
|
const preset_namespaceObject = JSON.parse('{"windows":{"win32-x64-msvc":"x86_64-pc-windows-msvc"},"macos":{"darwin-x64":"x86_64-apple-darwin","darwin-arm64":"aarch64-apple-darwin"},"linux":{"linux-x64-gnu":"x86_64-unknown-linux-gnu","linux-arm-gnueabihf":"armv7-unknown-linux-gnueabihf"},"desktop":{"win32-x64-msvc":"x86_64-pc-windows-msvc","darwin-x64":"x86_64-apple-darwin","darwin-arm64":"aarch64-apple-darwin","linux-x64-gnu":"x86_64-unknown-linux-gnu"},"mobile":{"win32-arm64-msvc":"aarch64-pc-windows-msvc","linux-arm-gnueabihf":"armv7-unknown-linux-gnueabihf","android-arm-eabi":"armv7-linux-androideabi"},"common":["desktop"],"extended":["desktop","mobile"]}');
|
|
45960
|
-
;// CONCATENATED MODULE: ./src/
|
|
45960
|
+
;// CONCATENATED MODULE: ./src/platform.ts
|
|
45961
45961
|
|
|
45962
45962
|
|
|
45963
45963
|
|
|
@@ -45970,23 +45970,23 @@ function assertIsRustTarget(x) {
|
|
|
45970
45970
|
throw new RangeError(`invalid Rust target: ${x}`);
|
|
45971
45971
|
}
|
|
45972
45972
|
}
|
|
45973
|
-
function
|
|
45973
|
+
function isNodePlatform(x) {
|
|
45974
45974
|
return (typeof x === 'string') && (x in node_namespaceObject);
|
|
45975
45975
|
}
|
|
45976
|
-
function
|
|
45977
|
-
if (!
|
|
45978
|
-
throw new RangeError(`invalid
|
|
45976
|
+
function assertIsNodePlatform(x) {
|
|
45977
|
+
if (!isNodePlatform(x)) {
|
|
45978
|
+
throw new RangeError(`invalid platform: ${x}`);
|
|
45979
45979
|
}
|
|
45980
45980
|
}
|
|
45981
|
-
function
|
|
45981
|
+
function isPlatformPreset(x) {
|
|
45982
45982
|
return (typeof x === 'string') && (x in preset_namespaceObject);
|
|
45983
45983
|
}
|
|
45984
|
-
function
|
|
45985
|
-
if (!
|
|
45986
|
-
throw new RangeError(`invalid
|
|
45984
|
+
function assertIsPlatformPreset(x) {
|
|
45985
|
+
if (!isPlatformPreset(x)) {
|
|
45986
|
+
throw new RangeError(`invalid platform family preset: ${x}`);
|
|
45987
45987
|
}
|
|
45988
45988
|
}
|
|
45989
|
-
function
|
|
45989
|
+
function lookupPlatformPreset(key) {
|
|
45990
45990
|
return preset_namespaceObject[key];
|
|
45991
45991
|
}
|
|
45992
45992
|
function merge(maps) {
|
|
@@ -45996,19 +45996,19 @@ function merge(maps) {
|
|
|
45996
45996
|
}
|
|
45997
45997
|
return merged;
|
|
45998
45998
|
}
|
|
45999
|
-
function
|
|
46000
|
-
return
|
|
45999
|
+
function expandPlatformPreset(preset) {
|
|
46000
|
+
return expandPlatformFamily(lookupPlatformPreset(preset));
|
|
46001
46001
|
}
|
|
46002
|
-
function
|
|
46003
|
-
return
|
|
46004
|
-
?
|
|
46002
|
+
function expandPlatformFamily(family) {
|
|
46003
|
+
return isPlatformPreset(family)
|
|
46004
|
+
? expandPlatformPreset(family)
|
|
46005
46005
|
: Array.isArray(family)
|
|
46006
|
-
? merge(family.map(
|
|
46006
|
+
? merge(family.map(expandPlatformFamily))
|
|
46007
46007
|
: family;
|
|
46008
46008
|
}
|
|
46009
46009
|
function getTargetDescriptor(target) {
|
|
46010
46010
|
const node = rust_namespaceObject[target];
|
|
46011
|
-
if (!
|
|
46011
|
+
if (!isNodePlatform(node)) {
|
|
46012
46012
|
throw new Error(`Rust target ${target} not supported`);
|
|
46013
46013
|
}
|
|
46014
46014
|
const nodeDescriptor = node_namespaceObject[node];
|
|
@@ -46018,7 +46018,7 @@ function getTargetDescriptor(target) {
|
|
|
46018
46018
|
}
|
|
46019
46019
|
return {
|
|
46020
46020
|
node,
|
|
46021
|
-
|
|
46021
|
+
os: nodeDescriptor.os,
|
|
46022
46022
|
arch: nodeDescriptor.arch,
|
|
46023
46023
|
abi: nodeDescriptor.abi,
|
|
46024
46024
|
llvm: nodeDescriptor.llvm
|
|
@@ -46032,7 +46032,7 @@ function node2Rust(target) {
|
|
|
46032
46032
|
}
|
|
46033
46033
|
function rust2Node(target) {
|
|
46034
46034
|
const nt = rust_namespaceObject[target];
|
|
46035
|
-
|
|
46035
|
+
assertIsNodePlatform(nt);
|
|
46036
46036
|
return nt;
|
|
46037
46037
|
}
|
|
46038
46038
|
async function getCurrentTarget(log) {
|
|
@@ -46075,18 +46075,18 @@ function assertHasProps(keys, json, path) {
|
|
|
46075
46075
|
}
|
|
46076
46076
|
}
|
|
46077
46077
|
function assertIsBinaryCfg(json) {
|
|
46078
|
-
assertHasProps(['type', 'rust', 'node', '
|
|
46078
|
+
assertHasProps(['type', 'rust', 'node', 'os', 'arch', 'abi'], json, "neon");
|
|
46079
46079
|
if (json.type !== 'binary') {
|
|
46080
46080
|
throw new TypeError(`expected "neon.type" property to be "binary", found ${json.type}`);
|
|
46081
46081
|
}
|
|
46082
46082
|
if (typeof json.rust !== 'string' || !isRustTarget(json.rust)) {
|
|
46083
46083
|
throw new TypeError(`expected "neon.rust" to be a valid Rust target, found ${json.rust}`);
|
|
46084
46084
|
}
|
|
46085
|
-
if (typeof json.node !== 'string' || !
|
|
46085
|
+
if (typeof json.node !== 'string' || !isNodePlatform(json.node)) {
|
|
46086
46086
|
throw new TypeError(`expected "neon.node" to be a valid Node target, found ${json.node}`);
|
|
46087
46087
|
}
|
|
46088
|
-
if (typeof json.
|
|
46089
|
-
throw new TypeError(`expected "neon.
|
|
46088
|
+
if (typeof json.os !== 'string') {
|
|
46089
|
+
throw new TypeError(`expected "neon.os" to be a string, found ${json.os}`);
|
|
46090
46090
|
}
|
|
46091
46091
|
if (typeof json.arch !== 'string') {
|
|
46092
46092
|
throw new TypeError(`expected "neon.arch" to be a string, found ${json.arch}`);
|
|
@@ -46095,30 +46095,51 @@ function assertIsBinaryCfg(json) {
|
|
|
46095
46095
|
throw new TypeError(`expected "neon.abi" to be a string or null, found ${json.abi}`);
|
|
46096
46096
|
}
|
|
46097
46097
|
}
|
|
46098
|
-
function
|
|
46098
|
+
function assertIsPlatformMap(json, path) {
|
|
46099
46099
|
assertIsObject(json, path);
|
|
46100
46100
|
for (const key in json) {
|
|
46101
46101
|
const value = json[key];
|
|
46102
|
-
if (!
|
|
46103
|
-
throw new TypeError(`
|
|
46102
|
+
if (!isNodePlatform(key)) {
|
|
46103
|
+
throw new TypeError(`platform table key ${key} is not a valid Node platform`);
|
|
46104
46104
|
}
|
|
46105
46105
|
if (typeof value !== 'string' || !isRustTarget(value)) {
|
|
46106
|
-
throw new TypeError(`
|
|
46106
|
+
throw new TypeError(`platform table value ${value} is not a valid Rust target`);
|
|
46107
46107
|
}
|
|
46108
46108
|
}
|
|
46109
46109
|
}
|
|
46110
|
-
function
|
|
46110
|
+
function assertIsPlatformFamily(json, path) {
|
|
46111
46111
|
if (typeof json === 'string') {
|
|
46112
|
-
|
|
46112
|
+
assertIsPlatformPreset(json);
|
|
46113
46113
|
return;
|
|
46114
46114
|
}
|
|
46115
46115
|
if (Array.isArray(json)) {
|
|
46116
46116
|
for (const elt of json) {
|
|
46117
|
-
|
|
46117
|
+
assertIsPlatformPreset(elt);
|
|
46118
46118
|
}
|
|
46119
46119
|
return;
|
|
46120
46120
|
}
|
|
46121
|
-
|
|
46121
|
+
assertIsPlatformMap(json, path);
|
|
46122
|
+
}
|
|
46123
|
+
function assertIsBinaryV2(json) {
|
|
46124
|
+
if (!json || typeof json !== 'object') {
|
|
46125
|
+
throw new TypeError(`expected "neon" to be an object, found ${json}`);
|
|
46126
|
+
}
|
|
46127
|
+
assertHasProps(['rust', 'node', 'platform', 'arch', 'abi'], json, "neon");
|
|
46128
|
+
if (!isRustTarget(json.rust)) {
|
|
46129
|
+
throw new TypeError(`expected "neon.rust" to be a valid Rust target, found ${json.rust}`);
|
|
46130
|
+
}
|
|
46131
|
+
if (!isNodePlatform(json.node)) {
|
|
46132
|
+
throw new TypeError(`expected "neon.node" to be a valid Node platform, found ${json.node}`);
|
|
46133
|
+
}
|
|
46134
|
+
if (typeof json.platform !== 'string') {
|
|
46135
|
+
throw new TypeError(`expected "neon.platform" to be a string, found ${json.platform}`);
|
|
46136
|
+
}
|
|
46137
|
+
if (typeof json.arch !== 'string') {
|
|
46138
|
+
throw new TypeError(`expected "neon.arch" to be a string, found ${json.arch}`);
|
|
46139
|
+
}
|
|
46140
|
+
if (json.abi !== null && typeof json.abi !== 'string') {
|
|
46141
|
+
throw new TypeError(`expected "neon.abi" to be a string or null, found ${json.abi}`);
|
|
46142
|
+
}
|
|
46122
46143
|
}
|
|
46123
46144
|
function assertIsBinaryV1(json) {
|
|
46124
46145
|
assertHasProps(['binary'], json, "neon");
|
|
@@ -46130,8 +46151,8 @@ function assertIsBinaryV1(json) {
|
|
|
46130
46151
|
if (typeof binary.rust !== 'string' || !isRustTarget(binary.rust)) {
|
|
46131
46152
|
throw new TypeError(`expected "neon.binary.rust" to be a valid Rust target, found ${binary.rust}`);
|
|
46132
46153
|
}
|
|
46133
|
-
if (!
|
|
46134
|
-
throw new TypeError(`expected "neon.binary.node" to be a valid Node
|
|
46154
|
+
if (!isNodePlatform(binary.node)) {
|
|
46155
|
+
throw new TypeError(`expected "neon.binary.node" to be a valid Node platform, found ${binary.node}`);
|
|
46135
46156
|
}
|
|
46136
46157
|
if (typeof binary.platform !== 'string') {
|
|
46137
46158
|
throw new TypeError(`expected "neon.binary.platform" to be a string, found ${binary.platform}`);
|
|
@@ -46156,14 +46177,14 @@ function assertIsSourceV1(json) {
|
|
|
46156
46177
|
}
|
|
46157
46178
|
}
|
|
46158
46179
|
function assertIsSourceCfg(json) {
|
|
46159
|
-
assertHasProps(['type', 'org', '
|
|
46180
|
+
assertHasProps(['type', 'org', 'platforms'], json, "neon");
|
|
46160
46181
|
if (json.type !== 'source') {
|
|
46161
46182
|
throw new TypeError(`expected "neon.type" property to be "source", found ${json.type}`);
|
|
46162
46183
|
}
|
|
46163
46184
|
if (typeof json.org !== 'string') {
|
|
46164
46185
|
throw new TypeError(`expected "neon.org" to be a string, found ${json.org}`);
|
|
46165
46186
|
}
|
|
46166
|
-
|
|
46187
|
+
assertIsPlatformFamily(json.platforms, "neon.platforms");
|
|
46167
46188
|
if ('load' in json) {
|
|
46168
46189
|
if (typeof json.load !== 'string' && typeof json.load !== 'undefined') {
|
|
46169
46190
|
throw new TypeError(`expected "neon.load" to be a string, found ${json.load}`);
|
|
@@ -46238,6 +46259,19 @@ class BinaryManifest extends AbstractManifest {
|
|
|
46238
46259
|
}
|
|
46239
46260
|
function normalizeBinaryCfg(json) {
|
|
46240
46261
|
assertHasCfg(json);
|
|
46262
|
+
// V3 format: {
|
|
46263
|
+
// neon: {
|
|
46264
|
+
// type: 'binary',
|
|
46265
|
+
// rust: RustTarget,
|
|
46266
|
+
// node: NodeTarget,
|
|
46267
|
+
// os: string,
|
|
46268
|
+
// arch: string,
|
|
46269
|
+
// abi: string | null
|
|
46270
|
+
// }
|
|
46271
|
+
// }
|
|
46272
|
+
if ('type' in json.neon && 'os' in json.neon) {
|
|
46273
|
+
return false;
|
|
46274
|
+
}
|
|
46241
46275
|
// V2 format: {
|
|
46242
46276
|
// neon: {
|
|
46243
46277
|
// type: 'binary',
|
|
@@ -46249,7 +46283,8 @@ function normalizeBinaryCfg(json) {
|
|
|
46249
46283
|
// }
|
|
46250
46284
|
// }
|
|
46251
46285
|
if ('type' in json.neon) {
|
|
46252
|
-
|
|
46286
|
+
json.neon = upgradeBinaryV2(json.neon);
|
|
46287
|
+
return true;
|
|
46253
46288
|
}
|
|
46254
46289
|
// V1 format: {
|
|
46255
46290
|
// neon: {
|
|
@@ -46267,15 +46302,34 @@ function normalizeBinaryCfg(json) {
|
|
|
46267
46302
|
}
|
|
46268
46303
|
function normalizeSourceCfg(json) {
|
|
46269
46304
|
assertHasCfg(json);
|
|
46305
|
+
// V4 format: {
|
|
46306
|
+
// neon: {
|
|
46307
|
+
// type: 'source',
|
|
46308
|
+
// org: string,
|
|
46309
|
+
// platforms: PlatformFamily,
|
|
46310
|
+
// load?: string | undefined
|
|
46311
|
+
// }
|
|
46312
|
+
// }
|
|
46313
|
+
if ('type' in json.neon && 'platforms' in json.neon) {
|
|
46314
|
+
return false;
|
|
46315
|
+
}
|
|
46270
46316
|
// V3 format: {
|
|
46271
46317
|
// neon: {
|
|
46272
46318
|
// type: 'source',
|
|
46273
46319
|
// org: string,
|
|
46274
|
-
// targets:
|
|
46320
|
+
// targets: PlatformFamily
|
|
46275
46321
|
// }
|
|
46276
46322
|
// }
|
|
46277
46323
|
if ('type' in json.neon) {
|
|
46278
|
-
|
|
46324
|
+
const org = json.neon['org'];
|
|
46325
|
+
const targets = json.neon['targets'];
|
|
46326
|
+
assertIsPlatformFamily(targets, "neon.targets");
|
|
46327
|
+
json.neon = {
|
|
46328
|
+
type: 'source',
|
|
46329
|
+
org,
|
|
46330
|
+
platforms: targets
|
|
46331
|
+
};
|
|
46332
|
+
return true;
|
|
46279
46333
|
}
|
|
46280
46334
|
// V2 format: {
|
|
46281
46335
|
// neon: {
|
|
@@ -46284,12 +46338,12 @@ function normalizeSourceCfg(json) {
|
|
|
46284
46338
|
// }
|
|
46285
46339
|
// }
|
|
46286
46340
|
if ('org' in json.neon) {
|
|
46287
|
-
const
|
|
46288
|
-
|
|
46341
|
+
const platforms = json.neon['targets'];
|
|
46342
|
+
assertIsPlatformMap(platforms, "neon.targets");
|
|
46289
46343
|
json.neon = {
|
|
46290
46344
|
type: 'source',
|
|
46291
46345
|
org: json.neon.org,
|
|
46292
|
-
|
|
46346
|
+
platforms
|
|
46293
46347
|
};
|
|
46294
46348
|
return true;
|
|
46295
46349
|
}
|
|
@@ -46303,15 +46357,20 @@ function normalizeSourceCfg(json) {
|
|
|
46303
46357
|
json.neon = upgradeSourceV1(targets);
|
|
46304
46358
|
return true;
|
|
46305
46359
|
}
|
|
46360
|
+
// The source manifest is the source of truth for all Neon
|
|
46361
|
+
// project metadata. This means you never need to go searching
|
|
46362
|
+
// for any other files to query the Neon project's metadata.
|
|
46363
|
+
// (Some data is replicated in the binary manifests, however,
|
|
46364
|
+
// since they are independently published in npm.)
|
|
46306
46365
|
class SourceManifest extends AbstractManifest {
|
|
46307
46366
|
_sourceJSON;
|
|
46308
|
-
|
|
46367
|
+
_expandedPlatforms;
|
|
46309
46368
|
constructor(json) {
|
|
46310
46369
|
super(json);
|
|
46311
46370
|
this._upgraded = normalizeSourceCfg(this._json);
|
|
46312
46371
|
assertHasSourceCfg(this._json);
|
|
46313
46372
|
this._sourceJSON = this._json;
|
|
46314
|
-
this.
|
|
46373
|
+
this._expandedPlatforms = expandPlatformFamily(this._sourceJSON.neon.platforms);
|
|
46315
46374
|
}
|
|
46316
46375
|
static async load(dir) {
|
|
46317
46376
|
return new SourceManifest(await readManifest(dir));
|
|
@@ -46321,12 +46380,12 @@ class SourceManifest extends AbstractManifest {
|
|
|
46321
46380
|
}
|
|
46322
46381
|
packageNames() {
|
|
46323
46382
|
const cfg = this.cfg();
|
|
46324
|
-
return Object.keys(this.
|
|
46383
|
+
return Object.keys(this._expandedPlatforms).map(key => `${cfg.org}/${key}`);
|
|
46325
46384
|
}
|
|
46326
46385
|
packageFor(target) {
|
|
46327
46386
|
const cfg = this.cfg();
|
|
46328
|
-
for (const key in this.
|
|
46329
|
-
const value = this.
|
|
46387
|
+
for (const key in this._expandedPlatforms) {
|
|
46388
|
+
const value = this._expandedPlatforms[key];
|
|
46330
46389
|
if (value === target) {
|
|
46331
46390
|
return `${cfg.org}/${key}`;
|
|
46332
46391
|
}
|
|
@@ -46334,19 +46393,19 @@ class SourceManifest extends AbstractManifest {
|
|
|
46334
46393
|
return undefined;
|
|
46335
46394
|
}
|
|
46336
46395
|
rustTargetFor(node) {
|
|
46337
|
-
return this.
|
|
46396
|
+
return this._expandedPlatforms[node];
|
|
46338
46397
|
}
|
|
46339
46398
|
manifestFor(target) {
|
|
46340
46399
|
const targetInfo = getTargetDescriptor(target);
|
|
46341
46400
|
const name = this.packageFor(target);
|
|
46342
46401
|
if (!name) {
|
|
46343
|
-
throw new Error(`Rust target ${target} not found in "neon.
|
|
46402
|
+
throw new Error(`Rust target ${target} not found in "neon.platforms" table.`);
|
|
46344
46403
|
}
|
|
46345
46404
|
const json = {
|
|
46346
46405
|
name,
|
|
46347
46406
|
description: `Prebuilt binary package for \`${this.name}\` on \`${targetInfo.node}\`.`,
|
|
46348
46407
|
version: this.version,
|
|
46349
|
-
os: [targetInfo.
|
|
46408
|
+
os: [targetInfo.os],
|
|
46350
46409
|
cpu: [targetInfo.arch],
|
|
46351
46410
|
main: "index.node",
|
|
46352
46411
|
files: ["index.node"],
|
|
@@ -46354,7 +46413,7 @@ class SourceManifest extends AbstractManifest {
|
|
|
46354
46413
|
type: "binary",
|
|
46355
46414
|
rust: target,
|
|
46356
46415
|
node: targetInfo.node,
|
|
46357
|
-
|
|
46416
|
+
os: targetInfo.os,
|
|
46358
46417
|
arch: targetInfo.arch,
|
|
46359
46418
|
abi: targetInfo.abi
|
|
46360
46419
|
}
|
|
@@ -46369,25 +46428,25 @@ class SourceManifest extends AbstractManifest {
|
|
|
46369
46428
|
}
|
|
46370
46429
|
return new BinaryManifest(json);
|
|
46371
46430
|
}
|
|
46372
|
-
async
|
|
46431
|
+
async updateLoader(platforms) {
|
|
46373
46432
|
const cfg = this.cfg();
|
|
46374
46433
|
if (!cfg.load) {
|
|
46375
46434
|
return;
|
|
46376
46435
|
}
|
|
46377
46436
|
const loader = await promises_namespaceObject.readFile(cfg.load, 'utf8');
|
|
46378
|
-
function
|
|
46437
|
+
function isPlatformTable(p) {
|
|
46379
46438
|
return p.value.properties.every(p => {
|
|
46380
46439
|
return p.type === 'Property' &&
|
|
46381
46440
|
p.key.type === 'Literal' &&
|
|
46382
|
-
|
|
46441
|
+
isNodePlatform(p.key.value);
|
|
46383
46442
|
});
|
|
46384
46443
|
}
|
|
46385
46444
|
const result = jscodeshift_default()(loader)
|
|
46386
46445
|
.find((jscodeshift_default()).ObjectExpression)
|
|
46387
|
-
.filter(
|
|
46446
|
+
.filter(isPlatformTable)
|
|
46388
46447
|
.replaceWith((p) => {
|
|
46389
|
-
const newProps =
|
|
46390
|
-
return jscodeshift_default().property('init', jscodeshift_default().literal(
|
|
46448
|
+
const newProps = platforms.map(platform => {
|
|
46449
|
+
return jscodeshift_default().property('init', jscodeshift_default().literal(platform), jscodeshift_default().arrowFunctionExpression([], jscodeshift_default().callExpression(jscodeshift_default().identifier('require'), [jscodeshift_default().literal(`${cfg.org}/${platform}`)])));
|
|
46391
46450
|
});
|
|
46392
46451
|
return jscodeshift_default().objectExpression([...p.value.properties, ...newProps]);
|
|
46393
46452
|
})
|
|
@@ -46396,20 +46455,20 @@ class SourceManifest extends AbstractManifest {
|
|
|
46396
46455
|
}
|
|
46397
46456
|
async addTargetPair(pair) {
|
|
46398
46457
|
const { node, rust } = pair;
|
|
46399
|
-
if (this.
|
|
46458
|
+
if (this._expandedPlatforms[node] === rust) {
|
|
46400
46459
|
return null;
|
|
46401
46460
|
}
|
|
46402
|
-
this.
|
|
46461
|
+
this._expandedPlatforms[node] = rust;
|
|
46403
46462
|
await this.save();
|
|
46404
|
-
await this.
|
|
46463
|
+
await this.updateLoader([node]);
|
|
46405
46464
|
return pair;
|
|
46406
46465
|
}
|
|
46407
|
-
async
|
|
46408
|
-
const
|
|
46409
|
-
if (
|
|
46410
|
-
throw new Error(`multiple Rust targets found for Node
|
|
46466
|
+
async addNodePlatform(platform) {
|
|
46467
|
+
const targets = node2Rust(platform);
|
|
46468
|
+
if (targets.length > 1) {
|
|
46469
|
+
throw new Error(`multiple Rust targets found for Node platform ${platform}; please specify one of ${targets.join(', ')}`);
|
|
46411
46470
|
}
|
|
46412
|
-
return await this.addTargetPair({ node:
|
|
46471
|
+
return await this.addTargetPair({ node: platform, rust: targets[0] });
|
|
46413
46472
|
}
|
|
46414
46473
|
async addRustTarget(target) {
|
|
46415
46474
|
return await this.addTargetPair({ node: rust2Node(target), rust: target });
|
|
@@ -46419,39 +46478,39 @@ class SourceManifest extends AbstractManifest {
|
|
|
46419
46478
|
for (const [key, value] of Object.entries(family)) {
|
|
46420
46479
|
const node = key;
|
|
46421
46480
|
const rust = value;
|
|
46422
|
-
if (this.
|
|
46481
|
+
if (this._expandedPlatforms[node] === rust) {
|
|
46423
46482
|
continue;
|
|
46424
46483
|
}
|
|
46425
46484
|
newTargets.push({ node, rust });
|
|
46426
46485
|
}
|
|
46427
46486
|
return newTargets;
|
|
46428
46487
|
}
|
|
46429
|
-
async
|
|
46488
|
+
async addPlatforms(family, opts = {}) {
|
|
46430
46489
|
let newTargets = this.filterNewTargets(family);
|
|
46431
46490
|
if (!newTargets.length) {
|
|
46432
46491
|
return [];
|
|
46433
46492
|
}
|
|
46434
46493
|
for (const { node, rust } of newTargets) {
|
|
46435
|
-
if (opts.
|
|
46436
|
-
opts.
|
|
46494
|
+
if (opts.platformsSrc) {
|
|
46495
|
+
opts.platformsSrc[node] = rust;
|
|
46437
46496
|
}
|
|
46438
|
-
this.
|
|
46497
|
+
this._expandedPlatforms[node] = rust;
|
|
46439
46498
|
}
|
|
46440
46499
|
await this.save();
|
|
46441
|
-
await this.
|
|
46500
|
+
await this.updateLoader(newTargets.map(({ node }) => node));
|
|
46442
46501
|
return newTargets;
|
|
46443
46502
|
}
|
|
46444
|
-
async
|
|
46445
|
-
const
|
|
46446
|
-
if (typeof
|
|
46447
|
-
this.cfg().
|
|
46448
|
-
return this.
|
|
46503
|
+
async addPlatformPreset(preset) {
|
|
46504
|
+
const platformsSrc = this.cfg().platforms;
|
|
46505
|
+
if (typeof platformsSrc === 'string') {
|
|
46506
|
+
this.cfg().platforms = [platformsSrc, preset];
|
|
46507
|
+
return this.addPlatforms(expandPlatformFamily(preset));
|
|
46449
46508
|
}
|
|
46450
|
-
if (Array.isArray(
|
|
46451
|
-
|
|
46452
|
-
return this.
|
|
46509
|
+
if (Array.isArray(platformsSrc)) {
|
|
46510
|
+
platformsSrc.push(preset);
|
|
46511
|
+
return this.addPlatforms(expandPlatformFamily(preset));
|
|
46453
46512
|
}
|
|
46454
|
-
return this.
|
|
46513
|
+
return this.addPlatforms(expandPlatformFamily(preset), { platformsSrc });
|
|
46455
46514
|
}
|
|
46456
46515
|
async updateTargets(log, bundle) {
|
|
46457
46516
|
if (!this._json.optionalDependencies) {
|
|
@@ -46489,7 +46548,7 @@ function upgradeSourceV1(object) {
|
|
|
46489
46548
|
throw new TypeError(`expected namespaced npm package name, found ${value}`);
|
|
46490
46549
|
}
|
|
46491
46550
|
const pkg = value.split('/')[1];
|
|
46492
|
-
|
|
46551
|
+
assertIsNodePlatform(pkg);
|
|
46493
46552
|
assertIsRustTarget(key);
|
|
46494
46553
|
return [pkg, key];
|
|
46495
46554
|
}
|
|
@@ -46504,7 +46563,7 @@ function upgradeSourceV1(object) {
|
|
|
46504
46563
|
return {
|
|
46505
46564
|
type: 'source',
|
|
46506
46565
|
org: [...orgs][0],
|
|
46507
|
-
|
|
46566
|
+
platforms: Object.fromEntries(entries)
|
|
46508
46567
|
};
|
|
46509
46568
|
}
|
|
46510
46569
|
function upgradeBinaryV1(json) {
|
|
@@ -46513,11 +46572,22 @@ function upgradeBinaryV1(json) {
|
|
|
46513
46572
|
type: 'binary',
|
|
46514
46573
|
rust: json.binary.rust,
|
|
46515
46574
|
node: json.binary.node,
|
|
46516
|
-
|
|
46575
|
+
os: json.binary.platform,
|
|
46517
46576
|
arch: json.binary.arch,
|
|
46518
46577
|
abi: json.binary.abi
|
|
46519
46578
|
};
|
|
46520
46579
|
}
|
|
46580
|
+
function upgradeBinaryV2(json) {
|
|
46581
|
+
assertIsBinaryV2(json);
|
|
46582
|
+
return {
|
|
46583
|
+
type: 'binary',
|
|
46584
|
+
rust: json.rust,
|
|
46585
|
+
node: json.node,
|
|
46586
|
+
os: json.platform,
|
|
46587
|
+
arch: json.arch,
|
|
46588
|
+
abi: json.abi
|
|
46589
|
+
};
|
|
46590
|
+
}
|
|
46521
46591
|
|
|
46522
46592
|
;// CONCATENATED MODULE: ./src/commands/tarball.ts
|
|
46523
46593
|
|
|
@@ -46598,12 +46668,14 @@ class Tarball {
|
|
|
46598
46668
|
const version = sourceManifest.version;
|
|
46599
46669
|
const binaryManifest = await BinaryManifest.load(this._inDir);
|
|
46600
46670
|
const cfg = binaryManifest.cfg();
|
|
46671
|
+
// Since the source manifest is the source of truth, any time there's a
|
|
46672
|
+
// metadata mismatch between source and binary manifests, binary is wrong.
|
|
46601
46673
|
if (this._target && (cfg.rust !== this._target)) {
|
|
46602
46674
|
throw new Error(`Specified target ${this._target} does not match target ${cfg.rust} in ${this._inDir}`);
|
|
46603
46675
|
}
|
|
46604
46676
|
const targetInfo = getTargetDescriptor(cfg.rust);
|
|
46605
46677
|
cfg.node = targetInfo.node;
|
|
46606
|
-
cfg.
|
|
46678
|
+
cfg.os = targetInfo.os;
|
|
46607
46679
|
cfg.arch = targetInfo.arch;
|
|
46608
46680
|
cfg.abi = targetInfo.abi;
|
|
46609
46681
|
// FIXME: make it possible to disable this
|
|
@@ -46646,7 +46718,7 @@ class Tarball {
|
|
|
46646
46718
|
;
|
|
46647
46719
|
}
|
|
46648
46720
|
|
|
46649
|
-
;// CONCATENATED MODULE: ./src/commands/add-
|
|
46721
|
+
;// CONCATENATED MODULE: ./src/commands/add-platform.ts
|
|
46650
46722
|
|
|
46651
46723
|
|
|
46652
46724
|
|
|
@@ -46655,29 +46727,29 @@ class Tarball {
|
|
|
46655
46727
|
function optionArray(option) {
|
|
46656
46728
|
return option == null ? [] : [option];
|
|
46657
46729
|
}
|
|
46658
|
-
const
|
|
46730
|
+
const add_platform_OPTIONS = [
|
|
46659
46731
|
{ name: 'bundle', alias: 'b', type: String, defaultValue: null },
|
|
46660
|
-
{ name: '
|
|
46661
|
-
{ name: 'arch',
|
|
46732
|
+
{ name: 'os', type: String, defaultValue: null },
|
|
46733
|
+
{ name: 'arch', type: String, defaultValue: null },
|
|
46662
46734
|
{ name: 'abi', type: String, defaultValue: null },
|
|
46663
|
-
{ name: 'out-dir', alias: 'o', type: String, defaultValue: '
|
|
46735
|
+
{ name: 'out-dir', alias: 'o', type: String, defaultValue: 'platforms' },
|
|
46664
46736
|
{ name: 'verbose', alias: 'v', type: Boolean, defaultValue: false }
|
|
46665
46737
|
];
|
|
46666
|
-
class
|
|
46667
|
-
static summary() { return 'Add a
|
|
46668
|
-
static syntax() { return 'neon add-
|
|
46738
|
+
class AddPlatform {
|
|
46739
|
+
static summary() { return 'Add a platform or platform preset to a Neon project.'; }
|
|
46740
|
+
static syntax() { return 'neon add-platform [<p> | --os <a> --arch <b> [--abi <c>]] [-o <d>] [-b <f>]'; }
|
|
46669
46741
|
static options() {
|
|
46670
46742
|
return [
|
|
46671
|
-
{ name: '<
|
|
46743
|
+
{ name: '<p>', summary: 'A Node platform or platform preset.' },
|
|
46672
46744
|
{
|
|
46673
46745
|
name: '',
|
|
46674
|
-
summary: 'This
|
|
46746
|
+
summary: 'This can be a specific Node platform or one of the Neon platform family presets described below. (Default: current platform)'
|
|
46675
46747
|
},
|
|
46676
|
-
{ name: '
|
|
46677
|
-
{ name: '
|
|
46678
|
-
{ name: '--abi <
|
|
46679
|
-
{ name: '-o, --out-dir <d>', summary: 'Output directory for
|
|
46680
|
-
{ name: '-b, --bundle <f>', summary: 'File to generate bundling metadata.' },
|
|
46748
|
+
{ name: '--os <a>', summary: 'Platform OS name. (Default: current OS)' },
|
|
46749
|
+
{ name: '--arch <b>', summary: 'Platform architecture name. (Default: current arch)' },
|
|
46750
|
+
{ name: '--abi <c>', summary: 'Platform ABI name. (Default: current ABI)' },
|
|
46751
|
+
{ name: '-o, --out-dir <d>', summary: 'Output directory for platform template tree. (Default: ./platforms)' },
|
|
46752
|
+
{ name: '-b, --bundle <f>', summary: 'File to generate bundling metadata. (Default: none)' },
|
|
46681
46753
|
{
|
|
46682
46754
|
name: '',
|
|
46683
46755
|
summary: 'This generated file ensures support for bundlers (e.g. @vercel/ncc), which rely on static analysis to detect and enable any addons used by the library.'
|
|
@@ -46688,78 +46760,78 @@ class AddTarget {
|
|
|
46688
46760
|
static seeAlso() { }
|
|
46689
46761
|
static extraSection() {
|
|
46690
46762
|
return {
|
|
46691
|
-
title: '
|
|
46763
|
+
title: 'Platform Family Presets',
|
|
46692
46764
|
details: [
|
|
46693
|
-
{ name: 'linux', summary: 'Common desktop Linux
|
|
46694
|
-
{ name: 'macos', summary: 'Common desktop macOS
|
|
46695
|
-
{ name: 'windows', summary: 'Common desktop Windows
|
|
46696
|
-
{ name: 'mobile', summary: 'Common mobile and tablet
|
|
46697
|
-
{ name: 'desktop', summary: 'All common desktop
|
|
46698
|
-
{ name: 'common', summary: 'All common
|
|
46699
|
-
{ name: 'extended', summary: 'All supported
|
|
46765
|
+
{ name: 'linux', summary: 'Common desktop Linux platforms.' },
|
|
46766
|
+
{ name: 'macos', summary: 'Common desktop macOS platforms.' },
|
|
46767
|
+
{ name: 'windows', summary: 'Common desktop Windows platforms.' },
|
|
46768
|
+
{ name: 'mobile', summary: 'Common mobile and tablet platforms.' },
|
|
46769
|
+
{ name: 'desktop', summary: 'All common desktop platforms.' },
|
|
46770
|
+
{ name: 'common', summary: 'All common platforms.' },
|
|
46771
|
+
{ name: 'extended', summary: 'All supported platforms.' }
|
|
46700
46772
|
]
|
|
46701
46773
|
};
|
|
46702
46774
|
}
|
|
46703
|
-
|
|
46775
|
+
_os;
|
|
46704
46776
|
_arch;
|
|
46705
46777
|
_abi;
|
|
46706
|
-
|
|
46778
|
+
_platform;
|
|
46707
46779
|
_outDir;
|
|
46708
46780
|
_bundle;
|
|
46709
46781
|
_verbose;
|
|
46710
46782
|
constructor(argv) {
|
|
46711
|
-
const options = dist_default()(
|
|
46712
|
-
this.
|
|
46783
|
+
const options = dist_default()(add_platform_OPTIONS, { argv, partial: true });
|
|
46784
|
+
this._os = options.os || null;
|
|
46713
46785
|
this._arch = options.arch || null;
|
|
46714
46786
|
this._abi = options.abi || null;
|
|
46715
|
-
this._outDir = options['out-dir']
|
|
46787
|
+
this._outDir = options['out-dir'];
|
|
46716
46788
|
this._bundle = options.bundle || null;
|
|
46717
46789
|
this._verbose = !!options.verbose;
|
|
46718
|
-
if (options.
|
|
46719
|
-
throw new Error("Option --
|
|
46790
|
+
if (options.os && !options.arch) {
|
|
46791
|
+
throw new Error("Option --os requires option --arch to be specified as well.");
|
|
46720
46792
|
}
|
|
46721
|
-
if (!options.
|
|
46722
|
-
throw new Error("Option --arch requires option --
|
|
46793
|
+
if (!options.os && options.arch) {
|
|
46794
|
+
throw new Error("Option --arch requires option --os to be specified as well.");
|
|
46723
46795
|
}
|
|
46724
|
-
if (options.abi && (!options.
|
|
46725
|
-
throw new Error("Option --abi requires both options --
|
|
46796
|
+
if (options.abi && (!options.os || !options.arch)) {
|
|
46797
|
+
throw new Error("Option --abi requires both options --os and --arch to be specified as well.");
|
|
46726
46798
|
}
|
|
46727
|
-
if (!options.
|
|
46799
|
+
if (!options.os && !options.arch && !options.abi) {
|
|
46728
46800
|
if (!options._unknown || options._unknown.length === 0) {
|
|
46729
|
-
throw new Error("No arguments found, expected
|
|
46801
|
+
throw new Error("No arguments found, expected platform or --os and --arch options.");
|
|
46730
46802
|
}
|
|
46731
|
-
this.
|
|
46803
|
+
this._platform = options._unknown[0];
|
|
46732
46804
|
}
|
|
46733
46805
|
else {
|
|
46734
|
-
this.
|
|
46806
|
+
this._platform = `${options.os}-${options.arch}`;
|
|
46735
46807
|
if (!!options.abi) {
|
|
46736
|
-
this.
|
|
46808
|
+
this._platform = `${this._platform}-${options.abi}`;
|
|
46737
46809
|
}
|
|
46738
46810
|
}
|
|
46739
46811
|
}
|
|
46740
46812
|
log(msg) {
|
|
46741
46813
|
if (this._verbose) {
|
|
46742
|
-
console.error("[neon add-
|
|
46814
|
+
console.error("[neon add-platform] " + msg);
|
|
46743
46815
|
}
|
|
46744
46816
|
}
|
|
46745
|
-
async
|
|
46746
|
-
if (!this.
|
|
46747
|
-
this.log('adding default system
|
|
46817
|
+
async addPlatform(sourceManifest) {
|
|
46818
|
+
if (!this._platform) {
|
|
46819
|
+
this.log('adding default system platform');
|
|
46748
46820
|
return optionArray(await sourceManifest.addRustTarget(await getCurrentTarget(msg => this.log(msg))));
|
|
46749
46821
|
}
|
|
46750
|
-
else if (isRustTarget(this.
|
|
46751
|
-
this.log(`adding Rust target ${this.
|
|
46752
|
-
return optionArray(await sourceManifest.addRustTarget(this.
|
|
46822
|
+
else if (isRustTarget(this._platform)) {
|
|
46823
|
+
this.log(`adding Rust target ${this._platform}`);
|
|
46824
|
+
return optionArray(await sourceManifest.addRustTarget(this._platform));
|
|
46753
46825
|
}
|
|
46754
|
-
else if (
|
|
46755
|
-
this.log(`adding Node
|
|
46756
|
-
return optionArray(await sourceManifest.
|
|
46826
|
+
else if (isNodePlatform(this._platform)) {
|
|
46827
|
+
this.log(`adding Node platform ${this._platform}`);
|
|
46828
|
+
return optionArray(await sourceManifest.addNodePlatform(this._platform));
|
|
46757
46829
|
}
|
|
46758
|
-
else if (
|
|
46759
|
-
return sourceManifest.
|
|
46830
|
+
else if (isPlatformPreset(this._platform)) {
|
|
46831
|
+
return sourceManifest.addPlatformPreset(this._platform);
|
|
46760
46832
|
}
|
|
46761
46833
|
else {
|
|
46762
|
-
throw new Error(`unrecognized
|
|
46834
|
+
throw new Error(`unrecognized platform or preset ${this._platform}`);
|
|
46763
46835
|
}
|
|
46764
46836
|
}
|
|
46765
46837
|
async createTemplateTree(sourceManifest, pair) {
|
|
@@ -46779,7 +46851,7 @@ class AddTarget {
|
|
|
46779
46851
|
this.log(`reading package.json`);
|
|
46780
46852
|
const sourceManifest = await SourceManifest.load();
|
|
46781
46853
|
this.log(`manifest: ${sourceManifest.stringify()}`);
|
|
46782
|
-
const modified = await this.
|
|
46854
|
+
const modified = await this.addPlatform(sourceManifest);
|
|
46783
46855
|
if (modified.length) {
|
|
46784
46856
|
sourceManifest.updateTargets(msg => this.log(msg), this._bundle);
|
|
46785
46857
|
for (const pair of modified) {
|
|
@@ -46789,16 +46861,16 @@ class AddTarget {
|
|
|
46789
46861
|
}
|
|
46790
46862
|
}
|
|
46791
46863
|
|
|
46792
|
-
;// CONCATENATED MODULE: ./src/commands/update-
|
|
46864
|
+
;// CONCATENATED MODULE: ./src/commands/update-platforms.ts
|
|
46793
46865
|
|
|
46794
46866
|
|
|
46795
|
-
const
|
|
46867
|
+
const update_platforms_OPTIONS = [
|
|
46796
46868
|
{ name: 'bundle', alias: 'b', type: String, defaultValue: null },
|
|
46797
46869
|
{ name: 'verbose', alias: 'v', type: Boolean, defaultValue: false }
|
|
46798
46870
|
];
|
|
46799
|
-
class
|
|
46871
|
+
class UpdatePlatforms {
|
|
46800
46872
|
static summary() { return 'Update dependencies for all build targets in package.json.'; }
|
|
46801
|
-
static syntax() { return 'neon update-
|
|
46873
|
+
static syntax() { return 'neon update-platforms [-b <file>]'; }
|
|
46802
46874
|
static options() {
|
|
46803
46875
|
return [
|
|
46804
46876
|
{ name: '-b, --bundle <file>', summary: 'File to generate bundling metadata.' },
|
|
@@ -46818,13 +46890,13 @@ class UpdateTargets {
|
|
|
46818
46890
|
_bundle;
|
|
46819
46891
|
_verbose;
|
|
46820
46892
|
constructor(argv) {
|
|
46821
|
-
const options = dist_default()(
|
|
46893
|
+
const options = dist_default()(update_platforms_OPTIONS, { argv });
|
|
46822
46894
|
this._bundle = options.bundle || null;
|
|
46823
46895
|
this._verbose = !!options.verbose;
|
|
46824
46896
|
}
|
|
46825
46897
|
log(msg) {
|
|
46826
46898
|
if (this._verbose) {
|
|
46827
|
-
console.error("[neon update-
|
|
46899
|
+
console.error("[neon update-platforms] " + msg);
|
|
46828
46900
|
}
|
|
46829
46901
|
}
|
|
46830
46902
|
async run() {
|
|
@@ -46846,62 +46918,62 @@ class UpdateTargets {
|
|
|
46846
46918
|
|
|
46847
46919
|
|
|
46848
46920
|
const rust_target_OPTIONS = [
|
|
46849
|
-
{ name: '
|
|
46850
|
-
{ name: 'arch',
|
|
46921
|
+
{ name: 'os', type: String, defaultValue: null },
|
|
46922
|
+
{ name: 'arch', type: String, defaultValue: null },
|
|
46851
46923
|
{ name: 'abi', type: String, defaultValue: null },
|
|
46852
46924
|
{ name: 'verbose', alias: 'v', type: Boolean, defaultValue: false }
|
|
46853
46925
|
];
|
|
46854
46926
|
class RustTarget {
|
|
46855
|
-
static summary() { return 'Display the Rust target triple for a
|
|
46856
|
-
static syntax() { return 'neon rust-target <
|
|
46927
|
+
static summary() { return 'Display the Rust target triple configured for a platform.'; }
|
|
46928
|
+
static syntax() { return 'neon rust-target <platform> | (--os <os> --arch <arch> [--abi <abi>])'; }
|
|
46857
46929
|
static options() {
|
|
46858
46930
|
return [
|
|
46859
|
-
{ name: '<
|
|
46860
|
-
{ name: '
|
|
46861
|
-
{ name: '
|
|
46931
|
+
{ name: '<platform>', summary: 'Full platform name in Node convention.' },
|
|
46932
|
+
{ name: '--os <os>', summary: 'Target OS name.' },
|
|
46933
|
+
{ name: '--arch <arch>', summary: 'Target architecture name.' },
|
|
46862
46934
|
{ name: '--abi <abi>', summary: 'Target ABI name. (Default: null)' },
|
|
46863
46935
|
{ name: '-v, --verbose', summary: 'Enable verbose logging. (Default: false)' }
|
|
46864
46936
|
];
|
|
46865
46937
|
}
|
|
46866
46938
|
static seeAlso() { }
|
|
46867
46939
|
static extraSection() { }
|
|
46868
|
-
|
|
46940
|
+
_os;
|
|
46869
46941
|
_arch;
|
|
46870
46942
|
_abi;
|
|
46871
|
-
|
|
46943
|
+
_platform;
|
|
46872
46944
|
_verbose;
|
|
46873
46945
|
constructor(argv) {
|
|
46874
46946
|
const options = dist_default()(rust_target_OPTIONS, { argv, partial: true });
|
|
46875
|
-
this.
|
|
46947
|
+
this._os = options.os || null;
|
|
46876
46948
|
this._arch = options.arch || null;
|
|
46877
46949
|
this._abi = options.abi || null;
|
|
46878
46950
|
this._verbose = !!options.verbose;
|
|
46879
|
-
if (options.
|
|
46880
|
-
throw new Error("Option --
|
|
46951
|
+
if (options.os && !options.arch) {
|
|
46952
|
+
throw new Error("Option --os requires option --arch to be specified as well.");
|
|
46881
46953
|
}
|
|
46882
|
-
if (!options.
|
|
46883
|
-
throw new Error("Option --arch requires option --
|
|
46954
|
+
if (!options.os && options.arch) {
|
|
46955
|
+
throw new Error("Option --arch requires option --os to be specified as well.");
|
|
46884
46956
|
}
|
|
46885
|
-
if (options.abi && (!options.
|
|
46886
|
-
throw new Error("Option --abi requires both options --
|
|
46957
|
+
if (options.abi && (!options.os || !options.arch)) {
|
|
46958
|
+
throw new Error("Option --abi requires both options --os and --arch to be specified as well.");
|
|
46887
46959
|
}
|
|
46888
|
-
let
|
|
46889
|
-
if (!options.
|
|
46960
|
+
let platform;
|
|
46961
|
+
if (!options.os && !options.arch && !options.abi) {
|
|
46890
46962
|
if (!options._unknown || options._unknown.length === 0) {
|
|
46891
|
-
throw new Error("No arguments found, expected
|
|
46963
|
+
throw new Error("No arguments found, expected platform or --os and --arch options.");
|
|
46892
46964
|
}
|
|
46893
|
-
|
|
46965
|
+
platform = options._unknown[0];
|
|
46894
46966
|
}
|
|
46895
46967
|
else {
|
|
46896
|
-
|
|
46968
|
+
platform = `${options.os}-${options.arch}`;
|
|
46897
46969
|
if (!!options.abi) {
|
|
46898
|
-
|
|
46970
|
+
platform = `${platform}-${options.abi}`;
|
|
46899
46971
|
}
|
|
46900
46972
|
}
|
|
46901
|
-
if (!
|
|
46902
|
-
throw new Error(`${
|
|
46973
|
+
if (!isNodePlatform(platform)) {
|
|
46974
|
+
throw new Error(`${platform} is not a valid Node platform.`);
|
|
46903
46975
|
}
|
|
46904
|
-
this.
|
|
46976
|
+
this._platform = platform;
|
|
46905
46977
|
}
|
|
46906
46978
|
log(msg) {
|
|
46907
46979
|
if (this._verbose) {
|
|
@@ -46912,9 +46984,9 @@ class RustTarget {
|
|
|
46912
46984
|
this.log(`reading package.json`);
|
|
46913
46985
|
const sourceManifest = await SourceManifest.load();
|
|
46914
46986
|
this.log(`manifest: ${sourceManifest.stringify()}`);
|
|
46915
|
-
const rust = sourceManifest.rustTargetFor(this.
|
|
46987
|
+
const rust = sourceManifest.rustTargetFor(this._platform);
|
|
46916
46988
|
if (!rust) {
|
|
46917
|
-
throw new Error(`no Rust target found for ${this.
|
|
46989
|
+
throw new Error(`no Rust target found for ${this._platform}`);
|
|
46918
46990
|
}
|
|
46919
46991
|
console.log(rust);
|
|
46920
46992
|
}
|
|
@@ -46928,7 +47000,7 @@ const preset_OPTIONS = [
|
|
|
46928
47000
|
{ name: 'verbose', alias: 'v', type: Boolean, defaultValue: false }
|
|
46929
47001
|
];
|
|
46930
47002
|
class Preset {
|
|
46931
|
-
static summary() { return 'Display the target
|
|
47003
|
+
static summary() { return 'Display the JSON target data for a platform preset.'; }
|
|
46932
47004
|
static syntax() { return 'neon preset [-p] [-v] <preset>'; }
|
|
46933
47005
|
static options() {
|
|
46934
47006
|
return [
|
|
@@ -46952,7 +47024,7 @@ class Preset {
|
|
|
46952
47024
|
if (options._unknown.length > 1) {
|
|
46953
47025
|
throw new Error(`Unexpected argument ${options._unknown[1]}`);
|
|
46954
47026
|
}
|
|
46955
|
-
|
|
47027
|
+
assertIsPlatformPreset(options._unknown[0]);
|
|
46956
47028
|
this._preset = options._unknown[0];
|
|
46957
47029
|
}
|
|
46958
47030
|
log(msg) {
|
|
@@ -46961,7 +47033,7 @@ class Preset {
|
|
|
46961
47033
|
}
|
|
46962
47034
|
}
|
|
46963
47035
|
async run() {
|
|
46964
|
-
const map =
|
|
47036
|
+
const map = expandPlatformPreset(this._preset);
|
|
46965
47037
|
const output = this._pretty
|
|
46966
47038
|
? JSON.stringify(map, null, 2)
|
|
46967
47039
|
: JSON.stringify(map);
|
|
@@ -47018,8 +47090,10 @@ var CommandName;
|
|
|
47018
47090
|
CommandName["PackBuild"] = "pack-build";
|
|
47019
47091
|
CommandName["Tarball"] = "tarball";
|
|
47020
47092
|
CommandName["AddTarget"] = "add-target";
|
|
47093
|
+
CommandName["AddPlatform"] = "add-platform";
|
|
47021
47094
|
CommandName["InstallBuilds"] = "install-builds";
|
|
47022
47095
|
CommandName["UpdateTargets"] = "update-targets";
|
|
47096
|
+
CommandName["UpdatePlatforms"] = "update-platforms";
|
|
47023
47097
|
CommandName["RustTarget"] = "rust-target";
|
|
47024
47098
|
CommandName["Preset"] = "preset";
|
|
47025
47099
|
})(CommandName || (CommandName = {}));
|
|
@@ -47040,9 +47114,11 @@ const COMMANDS = {
|
|
|
47040
47114
|
[CommandName.Bump]: Bump,
|
|
47041
47115
|
[CommandName.PackBuild]: Tarball,
|
|
47042
47116
|
[CommandName.Tarball]: Tarball,
|
|
47043
|
-
[CommandName.AddTarget]:
|
|
47044
|
-
[CommandName.
|
|
47045
|
-
[CommandName.
|
|
47117
|
+
[CommandName.AddTarget]: AddPlatform,
|
|
47118
|
+
[CommandName.AddPlatform]: AddPlatform,
|
|
47119
|
+
[CommandName.InstallBuilds]: UpdatePlatforms,
|
|
47120
|
+
[CommandName.UpdateTargets]: UpdatePlatforms,
|
|
47121
|
+
[CommandName.UpdatePlatforms]: UpdatePlatforms,
|
|
47046
47122
|
[CommandName.RustTarget]: RustTarget,
|
|
47047
47123
|
[CommandName.Preset]: Preset
|
|
47048
47124
|
};
|
|
@@ -47055,8 +47131,8 @@ function summaries() {
|
|
|
47055
47131
|
{ name: CommandName.Dist, summary: Dist.summary() },
|
|
47056
47132
|
{ name: CommandName.Bump, summary: Bump.summary() },
|
|
47057
47133
|
{ name: CommandName.Tarball, summary: Tarball.summary() },
|
|
47058
|
-
{ name: CommandName.
|
|
47059
|
-
{ name: CommandName.
|
|
47134
|
+
{ name: CommandName.AddPlatform, summary: AddPlatform.summary() },
|
|
47135
|
+
{ name: CommandName.UpdatePlatforms, summary: UpdatePlatforms.summary() },
|
|
47060
47136
|
{ name: CommandName.RustTarget, summary: RustTarget.summary() },
|
|
47061
47137
|
{ name: CommandName.Preset, summary: Preset.summary() }
|
|
47062
47138
|
];
|
|
@@ -47072,7 +47148,7 @@ __nccwpck_require__.a(module, async (__webpack_handle_async_dependencies__, __we
|
|
|
47072
47148
|
/* harmony import */ var command_line_commands__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(5046);
|
|
47073
47149
|
/* harmony import */ var command_line_commands__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require__.n(command_line_commands__WEBPACK_IMPORTED_MODULE_0__);
|
|
47074
47150
|
/* harmony import */ var _print_js__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(9050);
|
|
47075
|
-
/* harmony import */ var _command_js__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(
|
|
47151
|
+
/* harmony import */ var _command_js__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(5834);
|
|
47076
47152
|
/* harmony import */ var node_module__WEBPACK_IMPORTED_MODULE_3__ = __nccwpck_require__(2033);
|
|
47077
47153
|
/* harmony import */ var node_module__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__nccwpck_require__.n(node_module__WEBPACK_IMPORTED_MODULE_3__);
|
|
47078
47154
|
|
|
@@ -50096,7 +50172,7 @@ const chalkStderr = createChalk({level: stderrColor ? stderrColor.level : 0});
|
|
|
50096
50172
|
/* harmony default export */ const chalk_source = (chalk);
|
|
50097
50173
|
|
|
50098
50174
|
// EXTERNAL MODULE: ./src/command.ts + 40 modules
|
|
50099
|
-
var command = __nccwpck_require__(
|
|
50175
|
+
var command = __nccwpck_require__(5834);
|
|
50100
50176
|
;// CONCATENATED MODULE: ./src/print.ts
|
|
50101
50177
|
|
|
50102
50178
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neon-rs/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.177",
|
|
4
4
|
"description": "Command-line build tool for Neon modules.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./index.js",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
},
|
|
28
28
|
"homepage": "https://github.com/dherman/neon-rs#readme",
|
|
29
29
|
"optionalDependencies": {
|
|
30
|
-
"@cargo-messages/android-arm-eabi": "0.0.
|
|
31
|
-
"@cargo-messages/darwin-arm64": "0.0.
|
|
32
|
-
"@cargo-messages/darwin-x64": "0.0.
|
|
33
|
-
"@cargo-messages/linux-arm-gnueabihf": "0.0.
|
|
34
|
-
"@cargo-messages/linux-x64-gnu": "0.0.
|
|
35
|
-
"@cargo-messages/win32-arm64-msvc": "0.0.
|
|
36
|
-
"@cargo-messages/win32-x64-msvc": "0.0.
|
|
30
|
+
"@cargo-messages/android-arm-eabi": "0.0.177",
|
|
31
|
+
"@cargo-messages/darwin-arm64": "0.0.177",
|
|
32
|
+
"@cargo-messages/darwin-x64": "0.0.177",
|
|
33
|
+
"@cargo-messages/linux-arm-gnueabihf": "0.0.177",
|
|
34
|
+
"@cargo-messages/linux-x64-gnu": "0.0.177",
|
|
35
|
+
"@cargo-messages/win32-arm64-msvc": "0.0.177",
|
|
36
|
+
"@cargo-messages/win32-x64-msvc": "0.0.177"
|
|
37
37
|
}
|
|
38
38
|
}
|