@hot-updater/plugin-core 0.13.3 → 0.13.4

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 (3) hide show
  1. package/dist/index.cjs +17 -24
  2. package/dist/index.js +17 -24
  3. package/package.json +11 -18
package/dist/index.cjs CHANGED
@@ -84857,31 +84857,24 @@ var __webpack_exports__ = {};
84857
84857
  const output = (0, generator_lib["default"])(ast);
84858
84858
  return output.code;
84859
84859
  };
84860
- const external_typescript_namespaceObject = require("typescript");
84860
+ const external_ts_morph_namespaceObject = require("ts-morph");
84861
84861
  const transformTsEnv = (code, env)=>{
84862
- const sourceFile = external_typescript_namespaceObject.createSourceFile("temp.ts", code, external_typescript_namespaceObject.ScriptTarget.Latest, true);
84863
- const transformer = (context)=>{
84864
- const visitor = (node)=>{
84865
- if (external_typescript_namespaceObject.isPropertyAccessExpression(node)) {
84866
- const expression = node.expression;
84867
- const property = node.name;
84868
- if (external_typescript_namespaceObject.isIdentifier(expression) && "HotUpdater" === expression.text) {
84869
- const key = property.text;
84870
- const value1 = env[key];
84871
- if (void 0 !== value1) return external_typescript_namespaceObject.factory.createStringLiteral(value1);
84872
- }
84873
- }
84874
- return external_typescript_namespaceObject.visitEachChild(node, visitor, context);
84875
- };
84876
- return (node)=>external_typescript_namespaceObject.visitNode(node, visitor);
84877
- };
84878
- const result = external_typescript_namespaceObject.transform(sourceFile, [
84879
- transformer
84880
- ]);
84881
- const transformedSourceFile = result.transformed[0];
84882
- const printer = external_typescript_namespaceObject.createPrinter();
84883
- const transformedCode = printer.printFile(transformedSourceFile);
84884
- return transformedCode;
84862
+ const project = new external_ts_morph_namespaceObject.Project();
84863
+ const sourceFile = project.createSourceFile("temp.ts", code);
84864
+ sourceFile.forEachDescendant((node)=>{
84865
+ if (node.getKind() === external_ts_morph_namespaceObject.SyntaxKind.PropertyAccessExpression) {
84866
+ const propAccess = node.asKind(external_ts_morph_namespaceObject.SyntaxKind.PropertyAccessExpression);
84867
+ if (!propAccess) return;
84868
+ const expression = propAccess.getExpression();
84869
+ if (expression.getKind() !== external_ts_morph_namespaceObject.SyntaxKind.Identifier) return;
84870
+ const identifier = expression.asKind(external_ts_morph_namespaceObject.SyntaxKind.Identifier);
84871
+ if (!identifier || "HotUpdater" !== identifier.getText()) return;
84872
+ const propertyName = propAccess.getName();
84873
+ const value1 = env[propertyName];
84874
+ if (void 0 !== value1) propAccess.replaceWithText(`"${value1}"`);
84875
+ }
84876
+ });
84877
+ return sourceFile.getFullText();
84885
84878
  };
84886
84879
  const makeEnv = async (newEnvVars, filePath = ".env")=>{
84887
84880
  try {
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ import * as __WEBPACK_EXTERNAL_MODULE_cosmiconfig_typescript_loader_05c5f2fe__ f
16
16
  import * as __WEBPACK_EXTERNAL_MODULE_node_process_786449bf__ from "node:process";
17
17
  import * as __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__ from "node:os";
18
18
  import * as __WEBPACK_EXTERNAL_MODULE_node_tty_c64aab7e__ from "node:tty";
19
- import * as __WEBPACK_EXTERNAL_MODULE_typescript__ from "typescript";
19
+ import * as __WEBPACK_EXTERNAL_MODULE_ts_morph_07c7ce60__ from "ts-morph";
20
20
  var __webpack_modules__ = {
21
21
  "../../node_modules/.pnpm/@jridgewell+gen-mapping@0.3.5/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js": function(__unused_webpack_module, exports, __webpack_require__) {
22
22
  (function(global1, factory) {
@@ -84373,29 +84373,22 @@ const transformEnv = async (code, env)=>{
84373
84373
  return output.code;
84374
84374
  };
84375
84375
  const transformTsEnv = (code, env)=>{
84376
- const sourceFile = __WEBPACK_EXTERNAL_MODULE_typescript__.createSourceFile("temp.ts", code, __WEBPACK_EXTERNAL_MODULE_typescript__.ScriptTarget.Latest, true);
84377
- const transformer = (context)=>{
84378
- const visitor = (node)=>{
84379
- if (__WEBPACK_EXTERNAL_MODULE_typescript__.isPropertyAccessExpression(node)) {
84380
- const expression = node.expression;
84381
- const property = node.name;
84382
- if (__WEBPACK_EXTERNAL_MODULE_typescript__.isIdentifier(expression) && "HotUpdater" === expression.text) {
84383
- const key = property.text;
84384
- const value1 = env[key];
84385
- if (void 0 !== value1) return __WEBPACK_EXTERNAL_MODULE_typescript__.factory.createStringLiteral(value1);
84386
- }
84387
- }
84388
- return __WEBPACK_EXTERNAL_MODULE_typescript__.visitEachChild(node, visitor, context);
84389
- };
84390
- return (node)=>__WEBPACK_EXTERNAL_MODULE_typescript__.visitNode(node, visitor);
84391
- };
84392
- const result = __WEBPACK_EXTERNAL_MODULE_typescript__.transform(sourceFile, [
84393
- transformer
84394
- ]);
84395
- const transformedSourceFile = result.transformed[0];
84396
- const printer = __WEBPACK_EXTERNAL_MODULE_typescript__.createPrinter();
84397
- const transformedCode = printer.printFile(transformedSourceFile);
84398
- return transformedCode;
84376
+ const project = new __WEBPACK_EXTERNAL_MODULE_ts_morph_07c7ce60__.Project();
84377
+ const sourceFile = project.createSourceFile("temp.ts", code);
84378
+ sourceFile.forEachDescendant((node)=>{
84379
+ if (node.getKind() === __WEBPACK_EXTERNAL_MODULE_ts_morph_07c7ce60__.SyntaxKind.PropertyAccessExpression) {
84380
+ const propAccess = node.asKind(__WEBPACK_EXTERNAL_MODULE_ts_morph_07c7ce60__.SyntaxKind.PropertyAccessExpression);
84381
+ if (!propAccess) return;
84382
+ const expression = propAccess.getExpression();
84383
+ if (expression.getKind() !== __WEBPACK_EXTERNAL_MODULE_ts_morph_07c7ce60__.SyntaxKind.Identifier) return;
84384
+ const identifier = expression.asKind(__WEBPACK_EXTERNAL_MODULE_ts_morph_07c7ce60__.SyntaxKind.Identifier);
84385
+ if (!identifier || "HotUpdater" !== identifier.getText()) return;
84386
+ const propertyName = propAccess.getName();
84387
+ const value1 = env[propertyName];
84388
+ if (void 0 !== value1) propAccess.replaceWithText(`"${value1}"`);
84389
+ }
84390
+ });
84391
+ return sourceFile.getFullText();
84399
84392
  };
84400
84393
  const makeEnv = async (newEnvVars, filePath = ".env")=>{
84401
84394
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/plugin-core",
3
- "version": "0.13.3",
3
+ "version": "0.13.4",
4
4
  "type": "module",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "sideEffects": false,
@@ -38,34 +38,27 @@
38
38
  "access": "public"
39
39
  },
40
40
  "dependencies": {
41
- "@hot-updater/core": "0.13.3",
42
- "cosmiconfig": "^9.0.0",
43
- "cosmiconfig-typescript-loader": "^5.0.0"
41
+ "@hot-updater/core": "0.13.4",
42
+ "cosmiconfig": "9.0.0",
43
+ "cosmiconfig-typescript-loader": "5.0.0",
44
+ "ts-morph": "25.0.1"
44
45
  },
45
46
  "devDependencies": {
46
- "typescript": "5.8.2",
47
- "@babel/parser": "7.26.9",
48
- "@babel/generator": "7.26.9",
49
- "@types/babel__generator": "7.6.8",
50
47
  "@babel/core": "7.26.0",
48
+ "@babel/generator": "7.26.9",
49
+ "@babel/parser": "7.26.9",
51
50
  "@babel/traverse": "7.25.9",
52
51
  "@babel/types": "7.26.0",
53
52
  "@types/babel__core": "7.20.5",
53
+ "@types/babel__generator": "7.6.8",
54
54
  "@types/babel__traverse": "7.20.6",
55
- "workspace-tools": "^0.36.4",
56
55
  "@types/node": "^22.7.5",
57
56
  "boxen": "^8.0.1",
58
57
  "es-toolkit": "^1.32.0",
59
58
  "jszip": "^3.10.1",
60
- "picocolors": "^1.0.0"
61
- },
62
- "peerDependencies": {
63
- "typescript": ">=4.5.0"
64
- },
65
- "peerDependenciesMeta": {
66
- "typescript": {
67
- "optional": true
68
- }
59
+ "picocolors": "^1.0.0",
60
+ "typescript": "5.8.2",
61
+ "workspace-tools": "^0.36.4"
69
62
  },
70
63
  "scripts": {
71
64
  "build": "rslib build",