storm-lua-minify 0.3.0 → 0.9.0

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 (43) hide show
  1. package/README.md +119 -41
  2. package/dist/aggregateSpecialization.js +406 -0
  3. package/dist/ast2lua.js +156 -68
  4. package/dist/astWalk.js +162 -0
  5. package/dist/callGraph.js +372 -0
  6. package/dist/cli.js +53 -58
  7. package/dist/cliOptions.js +36 -0
  8. package/dist/cliProgress.js +87 -0
  9. package/dist/config.js +73 -0
  10. package/dist/constantFold.js +798 -0
  11. package/dist/controlFlow.js +266 -0
  12. package/dist/functionRewrites.js +580 -0
  13. package/dist/generatedAst.js +108 -0
  14. package/dist/generatedNode.js +23 -0
  15. package/dist/interproceduralAnalysis.js +842 -0
  16. package/dist/interproceduralConstants.js +120 -0
  17. package/dist/luaString.js +157 -0
  18. package/dist/minifier.js +1178 -44
  19. package/dist/optimizerAnalysis.js +43 -0
  20. package/dist/optimizerDiagnostics.js +65 -0
  21. package/dist/optimizerFacts.js +529 -0
  22. package/dist/optimizerPass.js +96 -0
  23. package/dist/optimizerTransaction.js +56 -0
  24. package/dist/optimizerValueDomain.js +180 -0
  25. package/dist/options.js +233 -0
  26. package/dist/progress.js +2 -0
  27. package/dist/removeUnused.js +145 -0
  28. package/dist/renamer.js +223 -54
  29. package/dist/resolver.js +28 -11
  30. package/dist/runtimeEnvironment.js +105 -0
  31. package/dist/sourceMetadata.js +314 -0
  32. package/dist/statementDataflow.js +259 -0
  33. package/dist/statementScheduler.js +595 -0
  34. package/dist/symbolLiveness.js +92 -0
  35. package/dist/tableEffects.js +356 -0
  36. package/dist/transform.js +10 -371
  37. package/dist/valueFlow.js +409 -0
  38. package/dist/wholeProgramExports.js +646 -0
  39. package/dist/wholeProgramFieldRenames.js +583 -0
  40. package/dist/wholeProgramFields.js +672 -0
  41. package/dist/wholeProgramObjects.js +783 -0
  42. package/package.json +11 -2
  43. package/dist/index.js +0 -27
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "storm-lua-minify",
3
3
  "description": "A Lua minifier also outputs source map",
4
- "version": "0.3.0",
4
+ "version": "0.9.0",
5
5
  "engines": {
6
6
  "node": ">=22"
7
7
  },
@@ -31,9 +31,18 @@
31
31
  "start": "node ./dist/cli.js",
32
32
  "build": "tsc",
33
33
  "test": "tsc -p tsconfig.eslint.json && npx vitest run",
34
+ "test:smoke": "pnpm run build && vitest run --config vitest.smoke.config.ts",
34
35
  "lint": "eslint .",
35
36
  "format": "prettier --write .",
36
- "format:check": "prettier --check ."
37
+ "format:check": "prettier --check .",
38
+ "verify:lua-budget": "node scripts/verify-lua-resource-budget.cjs",
39
+ "report:optimizer": "pnpm run build && node scripts/report-optimizer-diagnostics.cjs",
40
+ "report:whole-program-objects": "pnpm run build && node scripts/report-whole-program-objects.cjs",
41
+ "report:whole-program-fields": "pnpm run build && node scripts/report-whole-program-fields.cjs",
42
+ "report:aggregate-specialization": "pnpm run build && node scripts/report-aggregate-specialization.cjs",
43
+ "report:whole-program-exports": "pnpm run build && node scripts/report-whole-program-exports.cjs",
44
+ "report:whole-program-field-renames": "pnpm run build && node scripts/report-whole-program-field-renames.cjs",
45
+ "verify:effect-semantics": "pnpm run build && node scripts/verify-effect-semantics.cjs"
37
46
  },
38
47
  "bin": {
39
48
  "storm-lua-minify": "dist/cli.js"
package/dist/index.js DELETED
@@ -1,27 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const fs_1 = __importDefault(require("fs"));
7
- const luaparse_1 = __importDefault(require("luaparse"));
8
- const node_process_1 = require("node:process");
9
- const ast2lua_1 = require("./ast2lua");
10
- const luaparseSetting = {
11
- locations: true,
12
- luaVersion: '5.3',
13
- ranges: true,
14
- scope: true,
15
- };
16
- const argPath = node_process_1.argv[2];
17
- if (fs_1.default.existsSync(argPath)) {
18
- const code = fs_1.default.readFileSync(argPath).toString();
19
- const ast = luaparse_1.default.parse(code, luaparseSetting);
20
- if ("globals" in ast) {
21
- const map = (0, ast2lua_1.minify)(ast);
22
- map.add("\n--[[\n//# sourceMappingURL=test.lua.map\n]]");
23
- console.log(map.toStringWithSourceMap().code);
24
- // toStringWithSourceMap().map の file に書き出したのちのファイル名を入れないとVSCode Extでは検索失敗する
25
- //console.log(JSON.stringify(map.toStringWithSourceMap().map));
26
- }
27
- }