@hot-updater/cli-tools 0.36.14 → 0.36.15

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.
Files changed (2) hide show
  1. package/dist/index.mjs +14 -12
  2. package/package.json +4 -4
package/dist/index.mjs CHANGED
@@ -24562,14 +24562,14 @@ var ConfigBuilder = class {
24562
24562
  intermediateCode = "";
24563
24563
  collectedImports = /* @__PURE__ */ new Map();
24564
24564
  constructor() {
24565
- this.addImport({
24566
- pkg: "dotenv",
24567
- named: ["config"]
24568
- });
24569
24565
  this.addImport({
24570
24566
  pkg: "hot-updater",
24571
24567
  named: ["defineConfig"]
24572
24568
  });
24569
+ this.addImport({
24570
+ pkg: "node:fs",
24571
+ named: ["existsSync"]
24572
+ });
24573
24573
  }
24574
24574
  addImport(info) {
24575
24575
  const pkg = info.pkg;
@@ -24646,7 +24646,9 @@ var ConfigBuilder = class {
24646
24646
  const text = `
24647
24647
  ${importStatements}
24648
24648
 
24649
- config({ path: ".env.hotupdater" });
24649
+ if (existsSync(".env.hotupdater")) {
24650
+ process.loadEnvFile(".env.hotupdater");
24651
+ }
24650
24652
 
24651
24653
  ${this.intermediateCode ? `${this.intermediateCode}\n` : ""}
24652
24654
  export default defineConfig({
@@ -42990,7 +42992,6 @@ const getReactNativeMetadatas = (cwd) => {
42990
42992
  const HOT_UPDATER_CONFIG_PATH = "hot-updater.config.ts";
42991
42993
  const CONFIG_FILE_NAME = "hot-updater.config.ts";
42992
42994
  const MANAGED_IMPORT_PACKAGES = new Set([
42993
- "dotenv",
42994
42995
  "firebase-admin",
42995
42996
  "hot-updater",
42996
42997
  "@aws-sdk/credential-provider-sso",
@@ -43225,7 +43226,6 @@ const updateManagedObject = (existing, next) => {
43225
43226
  for (const edit of propertyEdits.sort((left, right) => right.start - left.start)) mergedText = mergedText.slice(0, edit.start) + edit.text + mergedText.slice(edit.end);
43226
43227
  return appendMissingProperties(mergedText, missingPropertyTexts, existing.objectExpression.properties.length > 0);
43227
43228
  };
43228
- const isConfigCallStatement = (statement) => statement.type === "ExpressionStatement" && statement.expression.type === "CallExpression" && statement.expression.callee.type === "Identifier" && statement.expression.callee.name === "config";
43229
43229
  const getManagedHelperName = (statement) => {
43230
43230
  if (statement.type !== "VariableDeclaration") return null;
43231
43231
  const declaration = statement.declarations[0];
@@ -43233,16 +43233,20 @@ const getManagedHelperName = (statement) => {
43233
43233
  return MANAGED_HELPER_NAMES.has(declaration.id.name) ? declaration.id.name : null;
43234
43234
  };
43235
43235
  const rebuildImportBlock = (source, scaffold) => {
43236
+ const imports = scaffold.imports.map((info) => info.pkg === "node:fs" ? {
43237
+ ...info,
43238
+ named: info.named?.filter((name) => name !== "existsSync")
43239
+ } : info);
43236
43240
  const importDeclarations = source.program.body.filter((statement) => statement.type === "ImportDeclaration");
43237
43241
  const firstImport = importDeclarations[0];
43238
43242
  const lastImport = importDeclarations.at(-1);
43239
43243
  if (!firstImport || !lastImport) return {
43240
43244
  start: 0,
43241
43245
  end: 0,
43242
- text: `${renderImportStatements(scaffold.imports)}\n\n`
43246
+ text: `${renderImportStatements(imports)}\n\n`
43243
43247
  };
43244
43248
  const preservedImportTexts = importDeclarations.filter((declaration) => !MANAGED_IMPORT_PACKAGES.has(declaration.source.value)).map((declaration) => source.text.slice(getTopLevelFullStart(source, declaration), declaration.end).trim());
43245
- const managedImportText = renderImportStatements(scaffold.imports);
43249
+ const managedImportText = renderImportStatements(imports);
43246
43250
  const nextImportBlock = [...preservedImportTexts, managedImportText].filter(Boolean).join("\n");
43247
43251
  return {
43248
43252
  start: getTopLevelFullStart(source, firstImport),
@@ -43256,7 +43260,6 @@ const rebuildManagedBody = (source, exportStart, scaffold) => {
43256
43260
  const emittedHelpers = /* @__PURE__ */ new Set();
43257
43261
  const bodyStatements = [];
43258
43262
  for (const statement of statementsBeforeExport) {
43259
- if (isConfigCallStatement(statement)) continue;
43260
43263
  const helperName = getManagedHelperName(statement);
43261
43264
  if (!helperName) {
43262
43265
  bodyStatements.push(getStatementText(source, statement));
@@ -43271,8 +43274,7 @@ const rebuildManagedBody = (source, exportStart, scaffold) => {
43271
43274
  }
43272
43275
  for (const helper of scaffold.helperStatements) if (!emittedHelpers.has(helper.name)) bodyStatements.push(helper.code.trim());
43273
43276
  const bodyText = bodyStatements.filter(Boolean).join("\n\n");
43274
- const configStatement = `config({ path: ".env.hotupdater" });`;
43275
- const managedBody = bodyText ? `\n\n${configStatement}\n\n${bodyText}\n\n` : `\n\n${configStatement}\n\n`;
43277
+ const managedBody = bodyText ? `\n\n${bodyText}\n\n` : "\n\n";
43276
43278
  return {
43277
43279
  start: source.program.body.filter((statement) => statement.type === "ImportDeclaration").at(-1)?.end ?? 0,
43278
43280
  end: exportStart,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/cli-tools",
3
- "version": "0.36.14",
3
+ "version": "0.36.15",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=20.19.0"
@@ -49,8 +49,8 @@
49
49
  "oxc-parser": "0.141.0",
50
50
  "oxc-transform": "0.141.0",
51
51
  "unconfig": "7.5.0",
52
- "@hot-updater/core": "0.36.14",
53
- "@hot-updater/plugin-core": "0.36.14"
52
+ "@hot-updater/core": "0.36.15",
53
+ "@hot-updater/plugin-core": "0.36.15"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@clack/prompts": "1.7.0",
@@ -64,7 +64,7 @@
64
64
  "tar": "^7.5.16",
65
65
  "verkit": "0.3.2",
66
66
  "workspace-tools": "^0.41.7",
67
- "@hot-updater/test-utils": "0.36.14"
67
+ "@hot-updater/test-utils": "0.36.15"
68
68
  },
69
69
  "inlinedDependencies": {
70
70
  "@babel/code-frame": "7.29.0",