@devkong/cli 0.0.41 → 0.0.44

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 CHANGED
@@ -3928,504 +3928,256 @@ var require_main2 = __commonJS({
3928
3928
  }
3929
3929
  });
3930
3930
 
3931
- // node_modules/@napi-rs/keyring/index.js
3931
+ // packages/kong-cli/node_modules/@napi-rs/keyring/index.js
3932
3932
  var require_keyring = __commonJS({
3933
- "node_modules/@napi-rs/keyring/index.js"(exports2, module2) {
3934
- var { createRequire } = require("node:module");
3935
- require = createRequire(__filename);
3936
- var { readFileSync: readFileSync2 } = require("node:fs");
3933
+ "packages/kong-cli/node_modules/@napi-rs/keyring/index.js"(exports2, module2) {
3934
+ var { existsSync, readFileSync: readFileSync2 } = require("fs");
3935
+ var { join } = require("path");
3936
+ var { platform: platform3, arch } = process;
3937
3937
  var nativeBinding = null;
3938
- var loadErrors = [];
3939
- var isMusl = () => {
3940
- let musl = false;
3941
- if (process.platform === "linux") {
3942
- musl = isMuslFromFilesystem();
3943
- if (musl === null) {
3944
- musl = isMuslFromReport();
3945
- }
3946
- if (musl === null) {
3947
- musl = isMuslFromChildProcess();
3948
- }
3949
- }
3950
- return musl;
3951
- };
3952
- var isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
3953
- var isMuslFromFilesystem = () => {
3954
- try {
3955
- return readFileSync2("/usr/bin/ldd", "utf-8").includes("musl");
3956
- } catch {
3957
- return null;
3958
- }
3959
- };
3960
- var isMuslFromReport = () => {
3961
- let report = null;
3962
- if (typeof process.report?.getReport === "function") {
3963
- process.report.excludeNetwork = true;
3964
- report = process.report.getReport();
3965
- }
3966
- if (!report) {
3967
- return null;
3968
- }
3969
- if (report.header && report.header.glibcVersionRuntime) {
3970
- return false;
3971
- }
3972
- if (Array.isArray(report.sharedObjects)) {
3973
- if (report.sharedObjects.some(isFileMusl)) {
3974
- return true;
3975
- }
3976
- }
3977
- return false;
3978
- };
3979
- var isMuslFromChildProcess = () => {
3980
- try {
3981
- return require("child_process").execSync("ldd --version", { encoding: "utf8" }).includes("musl");
3982
- } catch (e) {
3983
- return false;
3984
- }
3985
- };
3986
- function requireNative() {
3987
- if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
3988
- try {
3989
- nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
3990
- } catch (err) {
3991
- loadErrors.push(err);
3992
- }
3993
- } else if (process.platform === "android") {
3994
- if (process.arch === "arm64") {
3995
- try {
3996
- return require("./keyring.android-arm64.node");
3997
- } catch (e) {
3998
- loadErrors.push(e);
3999
- }
4000
- try {
4001
- const binding = require("@napi-rs/keyring-android-arm64");
4002
- const bindingPackageVersion = require("@napi-rs/keyring-android-arm64/package.json").version;
4003
- if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
4004
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
4005
- }
4006
- return binding;
4007
- } catch (e) {
4008
- loadErrors.push(e);
4009
- }
4010
- } else if (process.arch === "arm") {
4011
- try {
4012
- return require("./keyring.android-arm-eabi.node");
4013
- } catch (e) {
4014
- loadErrors.push(e);
4015
- }
4016
- try {
4017
- const binding = require("@napi-rs/keyring-android-arm-eabi");
4018
- const bindingPackageVersion = require("@napi-rs/keyring-android-arm-eabi/package.json").version;
4019
- if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
4020
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
4021
- }
4022
- return binding;
4023
- } catch (e) {
4024
- loadErrors.push(e);
4025
- }
4026
- } else {
4027
- loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`));
4028
- }
4029
- } else if (process.platform === "win32") {
4030
- if (process.arch === "x64") {
4031
- try {
4032
- return require("./keyring.win32-x64-msvc.node");
4033
- } catch (e) {
4034
- loadErrors.push(e);
4035
- }
4036
- try {
4037
- const binding = require("@napi-rs/keyring-win32-x64-msvc");
4038
- const bindingPackageVersion = require("@napi-rs/keyring-win32-x64-msvc/package.json").version;
4039
- if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
4040
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
4041
- }
4042
- return binding;
4043
- } catch (e) {
4044
- loadErrors.push(e);
4045
- }
4046
- } else if (process.arch === "ia32") {
4047
- try {
4048
- return require("./keyring.win32-ia32-msvc.node");
4049
- } catch (e) {
4050
- loadErrors.push(e);
4051
- }
4052
- try {
4053
- const binding = require("@napi-rs/keyring-win32-ia32-msvc");
4054
- const bindingPackageVersion = require("@napi-rs/keyring-win32-ia32-msvc/package.json").version;
4055
- if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
4056
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
4057
- }
4058
- return binding;
4059
- } catch (e) {
4060
- loadErrors.push(e);
4061
- }
4062
- } else if (process.arch === "arm64") {
4063
- try {
4064
- return require("./keyring.win32-arm64-msvc.node");
4065
- } catch (e) {
4066
- loadErrors.push(e);
4067
- }
4068
- try {
4069
- const binding = require("@napi-rs/keyring-win32-arm64-msvc");
4070
- const bindingPackageVersion = require("@napi-rs/keyring-win32-arm64-msvc/package.json").version;
4071
- if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
4072
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
4073
- }
4074
- return binding;
4075
- } catch (e) {
4076
- loadErrors.push(e);
4077
- }
4078
- } else {
4079
- loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`));
4080
- }
4081
- } else if (process.platform === "darwin") {
3938
+ var localFileExisted = false;
3939
+ var loadError = null;
3940
+ function isMusl() {
3941
+ if (!process.report || typeof process.report.getReport !== "function") {
4082
3942
  try {
4083
- return require("./keyring.darwin-universal.node");
3943
+ const lddPath = require("child_process").execSync("which ldd").toString().trim();
3944
+ return readFileSync2(lddPath, "utf8").includes("musl");
4084
3945
  } catch (e) {
4085
- loadErrors.push(e);
4086
- }
4087
- try {
4088
- const binding = require("@napi-rs/keyring-darwin-universal");
4089
- const bindingPackageVersion = require("@napi-rs/keyring-darwin-universal/package.json").version;
4090
- if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
4091
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
4092
- }
4093
- return binding;
4094
- } catch (e) {
4095
- loadErrors.push(e);
4096
- }
4097
- if (process.arch === "x64") {
4098
- try {
4099
- return require("./keyring.darwin-x64.node");
4100
- } catch (e) {
4101
- loadErrors.push(e);
4102
- }
4103
- try {
4104
- const binding = require("@napi-rs/keyring-darwin-x64");
4105
- const bindingPackageVersion = require("@napi-rs/keyring-darwin-x64/package.json").version;
4106
- if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
4107
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
4108
- }
4109
- return binding;
4110
- } catch (e) {
4111
- loadErrors.push(e);
4112
- }
4113
- } else if (process.arch === "arm64") {
4114
- try {
4115
- return require("./keyring.darwin-arm64.node");
4116
- } catch (e) {
4117
- loadErrors.push(e);
4118
- }
4119
- try {
4120
- const binding = require("@napi-rs/keyring-darwin-arm64");
4121
- const bindingPackageVersion = require("@napi-rs/keyring-darwin-arm64/package.json").version;
4122
- if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
4123
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
4124
- }
4125
- return binding;
4126
- } catch (e) {
4127
- loadErrors.push(e);
4128
- }
4129
- } else {
4130
- loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`));
4131
- }
4132
- } else if (process.platform === "freebsd") {
4133
- if (process.arch === "x64") {
4134
- try {
4135
- return require("./keyring.freebsd-x64.node");
4136
- } catch (e) {
4137
- loadErrors.push(e);
4138
- }
4139
- try {
4140
- const binding = require("@napi-rs/keyring-freebsd-x64");
4141
- const bindingPackageVersion = require("@napi-rs/keyring-freebsd-x64/package.json").version;
4142
- if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
4143
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
4144
- }
4145
- return binding;
4146
- } catch (e) {
4147
- loadErrors.push(e);
4148
- }
4149
- } else if (process.arch === "arm64") {
4150
- try {
4151
- return require("./keyring.freebsd-arm64.node");
4152
- } catch (e) {
4153
- loadErrors.push(e);
4154
- }
4155
- try {
4156
- const binding = require("@napi-rs/keyring-freebsd-arm64");
4157
- const bindingPackageVersion = require("@napi-rs/keyring-freebsd-arm64/package.json").version;
4158
- if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
4159
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
4160
- }
4161
- return binding;
4162
- } catch (e) {
4163
- loadErrors.push(e);
4164
- }
4165
- } else {
4166
- loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
3946
+ return true;
4167
3947
  }
4168
- } else if (process.platform === "linux") {
4169
- if (process.arch === "x64") {
4170
- if (isMusl()) {
4171
- try {
4172
- return require("./keyring.linux-x64-musl.node");
4173
- } catch (e) {
4174
- loadErrors.push(e);
4175
- }
3948
+ } else {
3949
+ const { glibcVersionRuntime } = process.report.getReport().header;
3950
+ return !glibcVersionRuntime;
3951
+ }
3952
+ }
3953
+ switch (platform3) {
3954
+ case "android":
3955
+ switch (arch) {
3956
+ case "arm64":
3957
+ localFileExisted = existsSync(join(__dirname, "keyring.android-arm64.node"));
4176
3958
  try {
4177
- const binding = require("@napi-rs/keyring-linux-x64-musl");
4178
- const bindingPackageVersion = require("@napi-rs/keyring-linux-x64-musl/package.json").version;
4179
- if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
4180
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3959
+ if (localFileExisted) {
3960
+ nativeBinding = require("./keyring.android-arm64.node");
3961
+ } else {
3962
+ nativeBinding = require("@napi-rs/keyring-android-arm64");
4181
3963
  }
4182
- return binding;
4183
- } catch (e) {
4184
- loadErrors.push(e);
4185
- }
4186
- } else {
4187
- try {
4188
- return require("./keyring.linux-x64-gnu.node");
4189
3964
  } catch (e) {
4190
- loadErrors.push(e);
3965
+ loadError = e;
4191
3966
  }
3967
+ break;
3968
+ case "arm":
3969
+ localFileExisted = existsSync(join(__dirname, "keyring.android-arm-eabi.node"));
4192
3970
  try {
4193
- const binding = require("@napi-rs/keyring-linux-x64-gnu");
4194
- const bindingPackageVersion = require("@napi-rs/keyring-linux-x64-gnu/package.json").version;
4195
- if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
4196
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3971
+ if (localFileExisted) {
3972
+ nativeBinding = require("./keyring.android-arm-eabi.node");
3973
+ } else {
3974
+ nativeBinding = require("@napi-rs/keyring-android-arm-eabi");
4197
3975
  }
4198
- return binding;
4199
- } catch (e) {
4200
- loadErrors.push(e);
4201
- }
4202
- }
4203
- } else if (process.arch === "arm64") {
4204
- if (isMusl()) {
4205
- try {
4206
- return require("./keyring.linux-arm64-musl.node");
4207
3976
  } catch (e) {
4208
- loadErrors.push(e);
3977
+ loadError = e;
4209
3978
  }
3979
+ break;
3980
+ default:
3981
+ throw new Error(`Unsupported architecture on Android ${arch}`);
3982
+ }
3983
+ break;
3984
+ case "win32":
3985
+ switch (arch) {
3986
+ case "x64":
3987
+ localFileExisted = existsSync(
3988
+ join(__dirname, "keyring.win32-x64-msvc.node")
3989
+ );
4210
3990
  try {
4211
- const binding = require("@napi-rs/keyring-linux-arm64-musl");
4212
- const bindingPackageVersion = require("@napi-rs/keyring-linux-arm64-musl/package.json").version;
4213
- if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
4214
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
3991
+ if (localFileExisted) {
3992
+ nativeBinding = require("./keyring.win32-x64-msvc.node");
3993
+ } else {
3994
+ nativeBinding = require("@napi-rs/keyring-win32-x64-msvc");
4215
3995
  }
4216
- return binding;
4217
- } catch (e) {
4218
- loadErrors.push(e);
4219
- }
4220
- } else {
4221
- try {
4222
- return require("./keyring.linux-arm64-gnu.node");
4223
3996
  } catch (e) {
4224
- loadErrors.push(e);
3997
+ loadError = e;
4225
3998
  }
3999
+ break;
4000
+ case "ia32":
4001
+ localFileExisted = existsSync(
4002
+ join(__dirname, "keyring.win32-ia32-msvc.node")
4003
+ );
4226
4004
  try {
4227
- const binding = require("@napi-rs/keyring-linux-arm64-gnu");
4228
- const bindingPackageVersion = require("@napi-rs/keyring-linux-arm64-gnu/package.json").version;
4229
- if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
4230
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
4005
+ if (localFileExisted) {
4006
+ nativeBinding = require("./keyring.win32-ia32-msvc.node");
4007
+ } else {
4008
+ nativeBinding = require("@napi-rs/keyring-win32-ia32-msvc");
4231
4009
  }
4232
- return binding;
4233
4010
  } catch (e) {
4234
- loadErrors.push(e);
4235
- }
4236
- }
4237
- } else if (process.arch === "arm") {
4238
- if (isMusl()) {
4239
- try {
4240
- return require("./keyring.linux-arm-musleabihf.node");
4241
- } catch (e) {
4242
- loadErrors.push(e);
4011
+ loadError = e;
4243
4012
  }
4013
+ break;
4014
+ case "arm64":
4015
+ localFileExisted = existsSync(
4016
+ join(__dirname, "keyring.win32-arm64-msvc.node")
4017
+ );
4244
4018
  try {
4245
- const binding = require("@napi-rs/keyring-linux-arm-musleabihf");
4246
- const bindingPackageVersion = require("@napi-rs/keyring-linux-arm-musleabihf/package.json").version;
4247
- if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
4248
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
4019
+ if (localFileExisted) {
4020
+ nativeBinding = require("./keyring.win32-arm64-msvc.node");
4021
+ } else {
4022
+ nativeBinding = require("@napi-rs/keyring-win32-arm64-msvc");
4249
4023
  }
4250
- return binding;
4251
4024
  } catch (e) {
4252
- loadErrors.push(e);
4025
+ loadError = e;
4253
4026
  }
4027
+ break;
4028
+ default:
4029
+ throw new Error(`Unsupported architecture on Windows: ${arch}`);
4030
+ }
4031
+ break;
4032
+ case "darwin":
4033
+ localFileExisted = existsSync(join(__dirname, "keyring.darwin-universal.node"));
4034
+ try {
4035
+ if (localFileExisted) {
4036
+ nativeBinding = require("./keyring.darwin-universal.node");
4254
4037
  } else {
4038
+ nativeBinding = require("@napi-rs/keyring-darwin-universal");
4039
+ }
4040
+ break;
4041
+ } catch {
4042
+ }
4043
+ switch (arch) {
4044
+ case "x64":
4045
+ localFileExisted = existsSync(join(__dirname, "keyring.darwin-x64.node"));
4255
4046
  try {
4256
- return require("./keyring.linux-arm-gnueabihf.node");
4047
+ if (localFileExisted) {
4048
+ nativeBinding = require("./keyring.darwin-x64.node");
4049
+ } else {
4050
+ nativeBinding = require("@napi-rs/keyring-darwin-x64");
4051
+ }
4257
4052
  } catch (e) {
4258
- loadErrors.push(e);
4053
+ loadError = e;
4259
4054
  }
4055
+ break;
4056
+ case "arm64":
4057
+ localFileExisted = existsSync(
4058
+ join(__dirname, "keyring.darwin-arm64.node")
4059
+ );
4260
4060
  try {
4261
- const binding = require("@napi-rs/keyring-linux-arm-gnueabihf");
4262
- const bindingPackageVersion = require("@napi-rs/keyring-linux-arm-gnueabihf/package.json").version;
4263
- if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
4264
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
4061
+ if (localFileExisted) {
4062
+ nativeBinding = require("./keyring.darwin-arm64.node");
4063
+ } else {
4064
+ nativeBinding = require("@napi-rs/keyring-darwin-arm64");
4265
4065
  }
4266
- return binding;
4267
4066
  } catch (e) {
4268
- loadErrors.push(e);
4067
+ loadError = e;
4269
4068
  }
4069
+ break;
4070
+ default:
4071
+ throw new Error(`Unsupported architecture on macOS: ${arch}`);
4072
+ }
4073
+ break;
4074
+ case "freebsd":
4075
+ if (arch !== "x64") {
4076
+ throw new Error(`Unsupported architecture on FreeBSD: ${arch}`);
4077
+ }
4078
+ localFileExisted = existsSync(join(__dirname, "keyring.freebsd-x64.node"));
4079
+ try {
4080
+ if (localFileExisted) {
4081
+ nativeBinding = require("./keyring.freebsd-x64.node");
4082
+ } else {
4083
+ nativeBinding = require("@napi-rs/keyring-freebsd-x64");
4270
4084
  }
4271
- } else if (process.arch === "riscv64") {
4272
- if (isMusl()) {
4273
- try {
4274
- return require("./keyring.linux-riscv64-musl.node");
4275
- } catch (e) {
4276
- loadErrors.push(e);
4277
- }
4278
- try {
4279
- const binding = require("@napi-rs/keyring-linux-riscv64-musl");
4280
- const bindingPackageVersion = require("@napi-rs/keyring-linux-riscv64-musl/package.json").version;
4281
- if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
4282
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
4085
+ } catch (e) {
4086
+ loadError = e;
4087
+ }
4088
+ break;
4089
+ case "linux":
4090
+ switch (arch) {
4091
+ case "x64":
4092
+ if (isMusl()) {
4093
+ localFileExisted = existsSync(
4094
+ join(__dirname, "keyring.linux-x64-musl.node")
4095
+ );
4096
+ try {
4097
+ if (localFileExisted) {
4098
+ nativeBinding = require("./keyring.linux-x64-musl.node");
4099
+ } else {
4100
+ nativeBinding = require("@napi-rs/keyring-linux-x64-musl");
4101
+ }
4102
+ } catch (e) {
4103
+ loadError = e;
4104
+ }
4105
+ } else {
4106
+ localFileExisted = existsSync(
4107
+ join(__dirname, "keyring.linux-x64-gnu.node")
4108
+ );
4109
+ try {
4110
+ if (localFileExisted) {
4111
+ nativeBinding = require("./keyring.linux-x64-gnu.node");
4112
+ } else {
4113
+ nativeBinding = require("@napi-rs/keyring-linux-x64-gnu");
4114
+ }
4115
+ } catch (e) {
4116
+ loadError = e;
4283
4117
  }
4284
- return binding;
4285
- } catch (e) {
4286
- loadErrors.push(e);
4287
4118
  }
4288
- } else {
4289
- try {
4290
- return require("./keyring.linux-riscv64-gnu.node");
4291
- } catch (e) {
4292
- loadErrors.push(e);
4119
+ break;
4120
+ case "arm64":
4121
+ if (isMusl()) {
4122
+ localFileExisted = existsSync(
4123
+ join(__dirname, "keyring.linux-arm64-musl.node")
4124
+ );
4125
+ try {
4126
+ if (localFileExisted) {
4127
+ nativeBinding = require("./keyring.linux-arm64-musl.node");
4128
+ } else {
4129
+ nativeBinding = require("@napi-rs/keyring-linux-arm64-musl");
4130
+ }
4131
+ } catch (e) {
4132
+ loadError = e;
4133
+ }
4134
+ } else {
4135
+ localFileExisted = existsSync(
4136
+ join(__dirname, "keyring.linux-arm64-gnu.node")
4137
+ );
4138
+ try {
4139
+ if (localFileExisted) {
4140
+ nativeBinding = require("./keyring.linux-arm64-gnu.node");
4141
+ } else {
4142
+ nativeBinding = require("@napi-rs/keyring-linux-arm64-gnu");
4143
+ }
4144
+ } catch (e) {
4145
+ loadError = e;
4146
+ }
4293
4147
  }
4148
+ break;
4149
+ case "arm":
4150
+ localFileExisted = existsSync(
4151
+ join(__dirname, "keyring.linux-arm-gnueabihf.node")
4152
+ );
4294
4153
  try {
4295
- const binding = require("@napi-rs/keyring-linux-riscv64-gnu");
4296
- const bindingPackageVersion = require("@napi-rs/keyring-linux-riscv64-gnu/package.json").version;
4297
- if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
4298
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
4154
+ if (localFileExisted) {
4155
+ nativeBinding = require("./keyring.linux-arm-gnueabihf.node");
4156
+ } else {
4157
+ nativeBinding = require("@napi-rs/keyring-linux-arm-gnueabihf");
4299
4158
  }
4300
- return binding;
4301
4159
  } catch (e) {
4302
- loadErrors.push(e);
4160
+ loadError = e;
4303
4161
  }
4304
- }
4305
- } else if (process.arch === "ppc64") {
4306
- try {
4307
- return require("./keyring.linux-ppc64-gnu.node");
4308
- } catch (e) {
4309
- loadErrors.push(e);
4310
- }
4311
- try {
4312
- const binding = require("@napi-rs/keyring-linux-ppc64-gnu");
4313
- const bindingPackageVersion = require("@napi-rs/keyring-linux-ppc64-gnu/package.json").version;
4314
- if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
4315
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
4316
- }
4317
- return binding;
4318
- } catch (e) {
4319
- loadErrors.push(e);
4320
- }
4321
- } else if (process.arch === "s390x") {
4322
- try {
4323
- return require("./keyring.linux-s390x-gnu.node");
4324
- } catch (e) {
4325
- loadErrors.push(e);
4326
- }
4327
- try {
4328
- const binding = require("@napi-rs/keyring-linux-s390x-gnu");
4329
- const bindingPackageVersion = require("@napi-rs/keyring-linux-s390x-gnu/package.json").version;
4330
- if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
4331
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
4332
- }
4333
- return binding;
4334
- } catch (e) {
4335
- loadErrors.push(e);
4336
- }
4337
- } else {
4338
- loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`));
4339
- }
4340
- } else if (process.platform === "openharmony") {
4341
- if (process.arch === "arm64") {
4342
- try {
4343
- return require("./keyring.openharmony-arm64.node");
4344
- } catch (e) {
4345
- loadErrors.push(e);
4346
- }
4347
- try {
4348
- const binding = require("@napi-rs/keyring-openharmony-arm64");
4349
- const bindingPackageVersion = require("@napi-rs/keyring-openharmony-arm64/package.json").version;
4350
- if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
4351
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
4352
- }
4353
- return binding;
4354
- } catch (e) {
4355
- loadErrors.push(e);
4356
- }
4357
- } else if (process.arch === "x64") {
4358
- try {
4359
- return require("./keyring.openharmony-x64.node");
4360
- } catch (e) {
4361
- loadErrors.push(e);
4362
- }
4363
- try {
4364
- const binding = require("@napi-rs/keyring-openharmony-x64");
4365
- const bindingPackageVersion = require("@napi-rs/keyring-openharmony-x64/package.json").version;
4366
- if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
4367
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
4368
- }
4369
- return binding;
4370
- } catch (e) {
4371
- loadErrors.push(e);
4372
- }
4373
- } else if (process.arch === "arm") {
4374
- try {
4375
- return require("./keyring.openharmony-arm.node");
4376
- } catch (e) {
4377
- loadErrors.push(e);
4378
- }
4379
- try {
4380
- const binding = require("@napi-rs/keyring-openharmony-arm");
4381
- const bindingPackageVersion = require("@napi-rs/keyring-openharmony-arm/package.json").version;
4382
- if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
4383
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
4384
- }
4385
- return binding;
4386
- } catch (e) {
4387
- loadErrors.push(e);
4388
- }
4389
- } else {
4390
- loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
4391
- }
4392
- } else {
4393
- loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
4394
- }
4395
- }
4396
- nativeBinding = requireNative();
4397
- if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
4398
- try {
4399
- nativeBinding = require("./keyring.wasi.cjs");
4400
- } catch (err) {
4401
- if (process.env.NAPI_RS_FORCE_WASI) {
4402
- loadErrors.push(err);
4403
- }
4404
- }
4405
- if (!nativeBinding) {
4406
- try {
4407
- nativeBinding = require("@napi-rs/keyring-wasm32-wasi");
4408
- } catch (err) {
4409
- if (process.env.NAPI_RS_FORCE_WASI) {
4410
- loadErrors.push(err);
4411
- }
4162
+ break;
4163
+ default:
4164
+ throw new Error(`Unsupported architecture on Linux: ${arch}`);
4412
4165
  }
4413
- }
4166
+ break;
4167
+ default:
4168
+ throw new Error(`Unsupported OS: ${platform3}, architecture: ${arch}`);
4414
4169
  }
4415
4170
  if (!nativeBinding) {
4416
- if (loadErrors.length > 0) {
4417
- throw new Error(
4418
- `Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try \`npm i\` again after removing both package-lock.json and node_modules directory.`,
4419
- { cause: loadErrors }
4420
- );
4171
+ if (loadError) {
4172
+ throw loadError;
4421
4173
  }
4422
4174
  throw new Error(`Failed to load native binding`);
4423
4175
  }
4424
- module2.exports = nativeBinding;
4425
- module2.exports.AsyncEntry = nativeBinding.AsyncEntry;
4426
- module2.exports.Entry = nativeBinding.Entry;
4427
- module2.exports.findCredentials = nativeBinding.findCredentials;
4428
- module2.exports.findCredentialsAsync = nativeBinding.findCredentialsAsync;
4176
+ var { AsyncEntry, Entry: Entry3, findCredentials, findCredentialsAsync } = nativeBinding;
4177
+ module2.exports.AsyncEntry = AsyncEntry;
4178
+ module2.exports.Entry = Entry3;
4179
+ module2.exports.findCredentials = findCredentials;
4180
+ module2.exports.findCredentialsAsync = findCredentialsAsync;
4429
4181
  }
4430
4182
  });
4431
4183
 
@@ -81946,14 +81698,12 @@ var ManagementClient = class {
81946
81698
  this.headerProvider = headerProvider2;
81947
81699
  this.baseUrl = joinUrlAndPath(baseUrl, "/api/management");
81948
81700
  }
81949
- async createExtensionSnapshot(extensionId, extensionName, snapshot) {
81950
- const url2 = joinUrlAndPath(
81951
- this.baseUrl,
81952
- "v1/extensions",
81953
- extensionId,
81954
- extensionName,
81955
- "snapshots"
81956
- );
81701
+ async updateExtension(extension) {
81702
+ const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions");
81703
+ await axios_default.put(url2, extension, await this.headerProvider());
81704
+ }
81705
+ async createExtensionSnapshot(extensionId, snapshot) {
81706
+ const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions", extensionId, "snapshots");
81957
81707
  await axios_default.post(url2, snapshot, await this.headerProvider());
81958
81708
  }
81959
81709
  async getExtensionSnapshot(extensionName, extensionSnapshotVersion) {
@@ -82311,9 +82061,21 @@ var PublishVersionCommand = class {
82311
82061
  created: utcNow(DEFAULT_TIMEZONE),
82312
82062
  createdBy: ""
82313
82063
  };
82314
- await this.managementClient.createExtensionSnapshot(kongJson.id, kongJson.name, snapshot);
82315
- task.output = `The version ${publishDetails.imageVersion} has been successfully published!
82316
- ${joinUrlAndPath(this.profile.kongBaseUrl, "/extensions/aliases")}`;
82064
+ await this.managementClient.updateExtension({
82065
+ id: kongJson.id,
82066
+ name: kongJson.name,
82067
+ category: kongJson.category,
82068
+ deprecated: false,
82069
+ createdBy: "",
82070
+ created: utcNow(DEFAULT_TIMEZONE),
82071
+ updated: utcNow(DEFAULT_TIMEZONE),
82072
+ updatedBy: ""
82073
+ });
82074
+ await this.managementClient.createExtensionSnapshot(kongJson.id, snapshot);
82075
+ task.output = [
82076
+ `The version ${publishDetails.imageVersion} has been successfully published!`,
82077
+ joinUrlAndPath(this.profile.kongBaseUrl, "/extensions/aliases")
82078
+ ].join("\n");
82317
82079
  },
82318
82080
  rendererOptions: this.defaultRendererOptions
82319
82081
  };
@@ -82421,8 +82183,10 @@ var SetAliasCommand = class {
82421
82183
  updatedBy: ""
82422
82184
  };
82423
82185
  await this.publicClient.assignExtensionAlias(ctx.kongJson.id, alias);
82424
- task.output = `Please wait a moment for it to appear in the UI.
82425
- ${joinUrlAndPath(this.profile.kongBaseUrl, "/extensions/aliases")}`;
82186
+ task.output = [
82187
+ "Please wait a moment for it to appear in the UI",
82188
+ joinUrlAndPath(this.profile.kongBaseUrl, "/extensions/aliases")
82189
+ ].join("\n");
82426
82190
  },
82427
82191
  rendererOptions: { persistentOutput: true }
82428
82192
  }
@@ -82451,7 +82215,7 @@ function getPresetVersion() {
82451
82215
  }
82452
82216
 
82453
82217
  // packages/kong-cli/src/index.ts
82454
- import_dotenv_expand.default.expand(import_dotenv.default.config({ path: import_path5.default.join(__dirname, ".env") }));
82218
+ import_dotenv_expand.default.expand(import_dotenv.default.config({ path: import_path5.default.join(__dirname, ".env"), quiet: true }));
82455
82219
  async function main() {
82456
82220
  const generateCommand = new Command("generate").description("Generate new extension").argument("name", "Extension name").addOption(
82457
82221
  new Option("--sdk <name>", "Target sdk platform for extension").choices(["python", "kotlin"]).default("python")
package/package.json CHANGED
@@ -1,11 +1,13 @@
1
1
  {
2
2
  "name": "@devkong/cli",
3
- "version": "0.0.41",
3
+ "version": "0.0.44",
4
4
  "type": "commonjs",
5
5
  "main": "./index.js",
6
6
  "typings": "./index.d.ts",
7
7
  "bin": {
8
8
  "kong": "./index.js"
9
9
  },
10
- "dependencies": {}
10
+ "dependencies": {
11
+ "@napi-rs/keyring": "1.1.6"
12
+ }
11
13
  }
@@ -5,7 +5,8 @@ export declare class ManagementClient {
5
5
  private headerProvider;
6
6
  private readonly baseUrl;
7
7
  constructor(baseUrl: UrlText, headerProvider: HeaderProvider);
8
- createExtensionSnapshot(extensionId: AppExtension["id"], extensionName: AppExtension["name"], snapshot: Omit<AppSnapshotDetails, "id">): Promise<void>;
8
+ updateExtension(extension: AppExtension): Promise<void>;
9
+ createExtensionSnapshot(extensionId: AppExtension["id"], snapshot: Omit<AppSnapshotDetails, "id">): Promise<void>;
9
10
  getExtensionSnapshot(extensionName: AppExtension["name"], extensionSnapshotVersion: AppSnapshot["version"]): Promise<Optional<AppSnapshotDetails>>;
10
11
  getExtensionSnapshotVersions(extensionId: AppExtension["id"]): Promise<AppSnapshot[]>;
11
12
  getExtensionSnapshotAliases(extensionId: AppExtension["id"]): Promise<AppExtensionAlias[]>;