genshin-ts-touyu 0.2.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.
- package/LICENSE +21 -0
- package/README.md +129 -0
- package/bin/gsts.mjs +3 -0
- package/configs/eslint/full.mjs +109 -0
- package/configs/eslint/recommended.mjs +27 -0
- package/configs/ts-plugin/index.cjs +199 -0
- package/configs/ts-plugin/package.json +6 -0
- package/configs/tsconfig/base.json +19 -0
- package/configs/tsconfig/eslint.json +7 -0
- package/dist/src/cli/checks.d.ts +4 -0
- package/dist/src/cli/checks.js +68 -0
- package/dist/src/cli/checks.js.map +1 -0
- package/dist/src/cli/data.d.ts +6 -0
- package/dist/src/cli/data.js +20 -0
- package/dist/src/cli/data.js.map +1 -0
- package/dist/src/cli/gil_paths.d.ts +21 -0
- package/dist/src/cli/gil_paths.js +107 -0
- package/dist/src/cli/gil_paths.js.map +1 -0
- package/dist/src/cli/gil_resources.d.ts +19 -0
- package/dist/src/cli/gil_resources.js +213 -0
- package/dist/src/cli/gil_resources.js.map +1 -0
- package/dist/src/cli/gsts.d.ts +2 -0
- package/dist/src/cli/gsts.js +1316 -0
- package/dist/src/cli/gsts.js.map +1 -0
- package/dist/src/cli/markdown_render.d.ts +1 -0
- package/dist/src/cli/markdown_render.js +29 -0
- package/dist/src/cli/markdown_render.js.map +1 -0
- package/dist/src/cli/net.d.ts +3 -0
- package/dist/src/cli/net.js +35 -0
- package/dist/src/cli/net.js.map +1 -0
- package/dist/src/cli/notice_frontmatter.d.ts +15 -0
- package/dist/src/cli/notice_frontmatter.js +48 -0
- package/dist/src/cli/notice_frontmatter.js.map +1 -0
- package/dist/src/cli/pkg.d.ts +1 -0
- package/dist/src/cli/pkg.js +30 -0
- package/dist/src/cli/pkg.js.map +1 -0
- package/dist/src/cli/state.d.ts +14 -0
- package/dist/src/cli/state.js +22 -0
- package/dist/src/cli/state.js.map +1 -0
- package/dist/src/cli/ui.d.ts +8 -0
- package/dist/src/cli/ui.js +11 -0
- package/dist/src/cli/ui.js.map +1 -0
- package/dist/src/cli/update_changelog.d.ts +5 -0
- package/dist/src/cli/update_changelog.js +56 -0
- package/dist/src/cli/update_changelog.js.map +1 -0
- package/dist/src/cli/windows_open.d.ts +2 -0
- package/dist/src/cli/windows_open.js +8 -0
- package/dist/src/cli/windows_open.js.map +1 -0
- package/dist/src/compiler/config_loader.d.ts +4 -0
- package/dist/src/compiler/config_loader.js +93 -0
- package/dist/src/compiler/config_loader.js.map +1 -0
- package/dist/src/compiler/gia_vendor.d.ts +8 -0
- package/dist/src/compiler/gia_vendor.js +9 -0
- package/dist/src/compiler/gia_vendor.js.map +1 -0
- package/dist/src/compiler/gs_to_ir_json_transform/index.d.ts +14 -0
- package/dist/src/compiler/gs_to_ir_json_transform/index.js +68 -0
- package/dist/src/compiler/gs_to_ir_json_transform/index.js.map +1 -0
- package/dist/src/compiler/gs_to_ir_json_transform/runner.d.ts +1 -0
- package/dist/src/compiler/gs_to_ir_json_transform/runner.js +44 -0
- package/dist/src/compiler/gs_to_ir_json_transform/runner.js.map +1 -0
- package/dist/src/compiler/gsts_config.d.ts +229 -0
- package/dist/src/compiler/gsts_config.js +2 -0
- package/dist/src/compiler/gsts_config.js.map +1 -0
- package/dist/src/compiler/ir_merge.d.ts +11 -0
- package/dist/src/compiler/ir_merge.js +353 -0
- package/dist/src/compiler/ir_merge.js.map +1 -0
- package/dist/src/compiler/ir_to_gia.d.ts +1 -0
- package/dist/src/compiler/ir_to_gia.js +55 -0
- package/dist/src/compiler/ir_to_gia.js.map +1 -0
- package/dist/src/compiler/ir_to_gia_pipeline.d.ts +19 -0
- package/dist/src/compiler/ir_to_gia_pipeline.js +94 -0
- package/dist/src/compiler/ir_to_gia_pipeline.js.map +1 -0
- package/dist/src/compiler/ir_to_gia_transform/client_gia.d.ts +77 -0
- package/dist/src/compiler/ir_to_gia_transform/client_gia.js +469 -0
- package/dist/src/compiler/ir_to_gia_transform/client_gia.js.map +1 -0
- package/dist/src/compiler/ir_to_gia_transform/index.d.ts +18 -0
- package/dist/src/compiler/ir_to_gia_transform/index.js +680 -0
- package/dist/src/compiler/ir_to_gia_transform/index.js.map +1 -0
- package/dist/src/compiler/ir_to_gia_transform/layout.d.ts +247 -0
- package/dist/src/compiler/ir_to_gia_transform/layout.js +217 -0
- package/dist/src/compiler/ir_to_gia_transform/layout.js.map +1 -0
- package/dist/src/compiler/ir_to_gia_transform/mappings.d.ts +14 -0
- package/dist/src/compiler/ir_to_gia_transform/mappings.js +440 -0
- package/dist/src/compiler/ir_to_gia_transform/mappings.js.map +1 -0
- package/dist/src/compiler/ir_to_gia_transform/node_id.d.ts +20 -0
- package/dist/src/compiler/ir_to_gia_transform/node_id.js +618 -0
- package/dist/src/compiler/ir_to_gia_transform/node_id.js.map +1 -0
- package/dist/src/compiler/ir_to_gia_transform/optimize_timer_dispatch.d.ts +2 -0
- package/dist/src/compiler/ir_to_gia_transform/optimize_timer_dispatch.js +314 -0
- package/dist/src/compiler/ir_to_gia_transform/optimize_timer_dispatch.js.map +1 -0
- package/dist/src/compiler/ir_to_gia_transform/pins.d.ts +4 -0
- package/dist/src/compiler/ir_to_gia_transform/pins.js +118 -0
- package/dist/src/compiler/ir_to_gia_transform/pins.js.map +1 -0
- package/dist/src/compiler/ir_to_gia_transform/preprocess.d.ts +505 -0
- package/dist/src/compiler/ir_to_gia_transform/preprocess.js +40 -0
- package/dist/src/compiler/ir_to_gia_transform/preprocess.js.map +1 -0
- package/dist/src/compiler/ir_to_gia_transform/runner.d.ts +1 -0
- package/dist/src/compiler/ir_to_gia_transform/runner.js +36 -0
- package/dist/src/compiler/ir_to_gia_transform/runner.js.map +1 -0
- package/dist/src/compiler/ir_to_gia_transform/shared.d.ts +19 -0
- package/dist/src/compiler/ir_to_gia_transform/shared.js +56 -0
- package/dist/src/compiler/ir_to_gia_transform/shared.js.map +1 -0
- package/dist/src/compiler/ir_to_gia_transform/types.d.ts +4 -0
- package/dist/src/compiler/ir_to_gia_transform/types.js +2 -0
- package/dist/src/compiler/ir_to_gia_transform/types.js.map +1 -0
- package/dist/src/compiler/ts_to_gs.d.ts +1 -0
- package/dist/src/compiler/ts_to_gs.js +31 -0
- package/dist/src/compiler/ts_to_gs.js.map +1 -0
- package/dist/src/compiler/ts_to_gs_pipeline.d.ts +33 -0
- package/dist/src/compiler/ts_to_gs_pipeline.js +320 -0
- package/dist/src/compiler/ts_to_gs_pipeline.js.map +1 -0
- package/dist/src/compiler/ts_to_gs_transform/builtins.d.ts +5 -0
- package/dist/src/compiler/ts_to_gs_transform/builtins.js +398 -0
- package/dist/src/compiler/ts_to_gs_transform/builtins.js.map +1 -0
- package/dist/src/compiler/ts_to_gs_transform/errors.d.ts +5 -0
- package/dist/src/compiler/ts_to_gs_transform/errors.js +23 -0
- package/dist/src/compiler/ts_to_gs_transform/errors.js.map +1 -0
- package/dist/src/compiler/ts_to_gs_transform/expr.d.ts +13 -0
- package/dist/src/compiler/ts_to_gs_transform/expr.js +1677 -0
- package/dist/src/compiler/ts_to_gs_transform/expr.js.map +1 -0
- package/dist/src/compiler/ts_to_gs_transform/index.d.ts +5 -0
- package/dist/src/compiler/ts_to_gs_transform/index.js +457 -0
- package/dist/src/compiler/ts_to_gs_transform/index.js.map +1 -0
- package/dist/src/compiler/ts_to_gs_transform/list_methods.d.ts +5 -0
- package/dist/src/compiler/ts_to_gs_transform/list_methods.js +706 -0
- package/dist/src/compiler/ts_to_gs_transform/list_methods.js.map +1 -0
- package/dist/src/compiler/ts_to_gs_transform/list_utils.d.ts +34 -0
- package/dist/src/compiler/ts_to_gs_transform/list_utils.js +257 -0
- package/dist/src/compiler/ts_to_gs_transform/list_utils.js.map +1 -0
- package/dist/src/compiler/ts_to_gs_transform/lists.d.ts +8 -0
- package/dist/src/compiler/ts_to_gs_transform/lists.js +75 -0
- package/dist/src/compiler/ts_to_gs_transform/lists.js.map +1 -0
- package/dist/src/compiler/ts_to_gs_transform/loops.d.ts +8 -0
- package/dist/src/compiler/ts_to_gs_transform/loops.js +220 -0
- package/dist/src/compiler/ts_to_gs_transform/loops.js.map +1 -0
- package/dist/src/compiler/ts_to_gs_transform/matcher.d.ts +3 -0
- package/dist/src/compiler/ts_to_gs_transform/matcher.js +110 -0
- package/dist/src/compiler/ts_to_gs_transform/matcher.js.map +1 -0
- package/dist/src/compiler/ts_to_gs_transform/ops.d.ts +12 -0
- package/dist/src/compiler/ts_to_gs_transform/ops.js +73 -0
- package/dist/src/compiler/ts_to_gs_transform/ops.js.map +1 -0
- package/dist/src/compiler/ts_to_gs_transform/stmt.d.ts +9 -0
- package/dist/src/compiler/ts_to_gs_transform/stmt.js +1142 -0
- package/dist/src/compiler/ts_to_gs_transform/stmt.js.map +1 -0
- package/dist/src/compiler/ts_to_gs_transform/types.d.ts +128 -0
- package/dist/src/compiler/ts_to_gs_transform/types.js +13 -0
- package/dist/src/compiler/ts_to_gs_transform/types.js.map +1 -0
- package/dist/src/compiler/ts_to_gs_transform/utils.d.ts +7 -0
- package/dist/src/compiler/ts_to_gs_transform/utils.js +19 -0
- package/dist/src/compiler/ts_to_gs_transform/utils.js.map +1 -0
- package/dist/src/definitions/entity_helpers.d.ts +5274 -0
- package/dist/src/definitions/entity_helpers.js +841 -0
- package/dist/src/definitions/entity_helpers.js.map +1 -0
- package/dist/src/definitions/enum.d.ts +1608 -0
- package/dist/src/definitions/enum.js +1652 -0
- package/dist/src/definitions/enum.js.map +1 -0
- package/dist/src/definitions/events-payload-mode.d.ts +6 -0
- package/dist/src/definitions/events-payload-mode.js +2 -0
- package/dist/src/definitions/events-payload-mode.js.map +1 -0
- package/dist/src/definitions/events-payload.d.ts +1835 -0
- package/dist/src/definitions/events-payload.js +2 -0
- package/dist/src/definitions/events-payload.js.map +1 -0
- package/dist/src/definitions/events.d.ts +1397 -0
- package/dist/src/definitions/events.js +478 -0
- package/dist/src/definitions/events.js.map +1 -0
- package/dist/src/definitions/node_modes.d.ts +68 -0
- package/dist/src/definitions/node_modes.js +69 -0
- package/dist/src/definitions/node_modes.js.map +1 -0
- package/dist/src/definitions/nodes.d.ts +8155 -0
- package/dist/src/definitions/nodes.js +13597 -0
- package/dist/src/definitions/nodes.js.map +1 -0
- package/dist/src/definitions/prefabs.d.ts +2770 -0
- package/dist/src/definitions/prefabs.js +2771 -0
- package/dist/src/definitions/prefabs.js.map +1 -0
- package/dist/src/definitions/server_on_overloads.d.ts +717 -0
- package/dist/src/definitions/zh_aliases.d.ts +943 -0
- package/dist/src/definitions/zh_aliases.js +941 -0
- package/dist/src/definitions/zh_aliases.js.map +1 -0
- package/dist/src/eslint/index.d.ts +177 -0
- package/dist/src/eslint/index.js +128 -0
- package/dist/src/eslint/index.js.map +1 -0
- package/dist/src/eslint/rules/assignment-restrictions.d.ts +3 -0
- package/dist/src/eslint/rules/assignment-restrictions.js +110 -0
- package/dist/src/eslint/rules/assignment-restrictions.js.map +1 -0
- package/dist/src/eslint/rules/bigint-index-in-server.d.ts +3 -0
- package/dist/src/eslint/rules/bigint-index-in-server.js +116 -0
- package/dist/src/eslint/rules/bigint-index-in-server.js.map +1 -0
- package/dist/src/eslint/rules/builtin-console-log-arity.d.ts +3 -0
- package/dist/src/eslint/rules/builtin-console-log-arity.js +53 -0
- package/dist/src/eslint/rules/builtin-console-log-arity.js.map +1 -0
- package/dist/src/eslint/rules/builtin-math-support.d.ts +3 -0
- package/dist/src/eslint/rules/builtin-math-support.js +121 -0
- package/dist/src/eslint/rules/builtin-math-support.js.map +1 -0
- package/dist/src/eslint/rules/builtin-wrapper-arity.d.ts +3 -0
- package/dist/src/eslint/rules/builtin-wrapper-arity.js +49 -0
- package/dist/src/eslint/rules/builtin-wrapper-arity.js.map +1 -0
- package/dist/src/eslint/rules/for-structure.d.ts +3 -0
- package/dist/src/eslint/rules/for-structure.js +104 -0
- package/dist/src/eslint/rules/for-structure.js.map +1 -0
- package/dist/src/eslint/rules/gstsserver-call-scope.d.ts +3 -0
- package/dist/src/eslint/rules/gstsserver-call-scope.js +57 -0
- package/dist/src/eslint/rules/gstsserver-call-scope.js.map +1 -0
- package/dist/src/eslint/rules/gstsserver-params.d.ts +3 -0
- package/dist/src/eslint/rules/gstsserver-params.js +70 -0
- package/dist/src/eslint/rules/gstsserver-params.js.map +1 -0
- package/dist/src/eslint/rules/gstsserver-return.d.ts +3 -0
- package/dist/src/eslint/rules/gstsserver-return.js +118 -0
- package/dist/src/eslint/rules/gstsserver-return.js.map +1 -0
- package/dist/src/eslint/rules/gstsserver-top-level.d.ts +3 -0
- package/dist/src/eslint/rules/gstsserver-top-level.js +68 -0
- package/dist/src/eslint/rules/gstsserver-top-level.js.map +1 -0
- package/dist/src/eslint/rules/list-callback-return.d.ts +3 -0
- package/dist/src/eslint/rules/list-callback-return.js +106 -0
- package/dist/src/eslint/rules/list-callback-return.js.map +1 -0
- package/dist/src/eslint/rules/list-callback-signature.d.ts +3 -0
- package/dist/src/eslint/rules/list-callback-signature.js +115 -0
- package/dist/src/eslint/rules/list-callback-signature.js.map +1 -0
- package/dist/src/eslint/rules/list-method-type-constraints.d.ts +3 -0
- package/dist/src/eslint/rules/list-method-type-constraints.js +65 -0
- package/dist/src/eslint/rules/list-method-type-constraints.js.map +1 -0
- package/dist/src/eslint/rules/list-method-usage.d.ts +3 -0
- package/dist/src/eslint/rules/list-method-usage.js +114 -0
- package/dist/src/eslint/rules/list-method-usage.js.map +1 -0
- package/dist/src/eslint/rules/list-type-annotation.d.ts +3 -0
- package/dist/src/eslint/rules/list-type-annotation.js +63 -0
- package/dist/src/eslint/rules/list-type-annotation.js.map +1 -0
- package/dist/src/eslint/rules/no-gsts-f-outside-server.d.ts +3 -0
- package/dist/src/eslint/rules/no-gsts-f-outside-server.js +50 -0
- package/dist/src/eslint/rules/no-gsts-f-outside-server.js.map +1 -0
- package/dist/src/eslint/rules/no-gstsserver-recursion.d.ts +3 -0
- package/dist/src/eslint/rules/no-gstsserver-recursion.js +118 -0
- package/dist/src/eslint/rules/no-gstsserver-recursion.js.map +1 -0
- package/dist/src/eslint/rules/no-inner-declarations.d.ts +3 -0
- package/dist/src/eslint/rules/no-inner-declarations.js +46 -0
- package/dist/src/eslint/rules/no-inner-declarations.js.map +1 -0
- package/dist/src/eslint/rules/no-json.d.ts +3 -0
- package/dist/src/eslint/rules/no-json.js +63 -0
- package/dist/src/eslint/rules/no-json.js.map +1 -0
- package/dist/src/eslint/rules/no-nullish-coalesce.d.ts +3 -0
- package/dist/src/eslint/rules/no-nullish-coalesce.js +43 -0
- package/dist/src/eslint/rules/no-nullish-coalesce.js.map +1 -0
- package/dist/src/eslint/rules/no-object-static.d.ts +3 -0
- package/dist/src/eslint/rules/no-object-static.js +50 -0
- package/dist/src/eslint/rules/no-object-static.js.map +1 -0
- package/dist/src/eslint/rules/no-plain-object.d.ts +3 -0
- package/dist/src/eslint/rules/no-plain-object.js +65 -0
- package/dist/src/eslint/rules/no-plain-object.js.map +1 -0
- package/dist/src/eslint/rules/no-promise.d.ts +3 -0
- package/dist/src/eslint/rules/no-promise.js +63 -0
- package/dist/src/eslint/rules/no-promise.js.map +1 -0
- package/dist/src/eslint/rules/no-spread-array-without-type.d.ts +3 -0
- package/dist/src/eslint/rules/no-spread-array-without-type.js +65 -0
- package/dist/src/eslint/rules/no-spread-array-without-type.js.map +1 -0
- package/dist/src/eslint/rules/no-string-ops.d.ts +3 -0
- package/dist/src/eslint/rules/no-string-ops.js +119 -0
- package/dist/src/eslint/rules/no-string-ops.js.map +1 -0
- package/dist/src/eslint/rules/no-timer-in-loop.d.ts +3 -0
- package/dist/src/eslint/rules/no-timer-in-loop.js +81 -0
- package/dist/src/eslint/rules/no-timer-in-loop.js.map +1 -0
- package/dist/src/eslint/rules/no-undefined-array-return.d.ts +3 -0
- package/dist/src/eslint/rules/no-undefined-array-return.js +87 -0
- package/dist/src/eslint/rules/no-undefined-array-return.js.map +1 -0
- package/dist/src/eslint/rules/no-unsupported-statement.d.ts +3 -0
- package/dist/src/eslint/rules/no-unsupported-statement.js +107 -0
- package/dist/src/eslint/rules/no-unsupported-statement.js.map +1 -0
- package/dist/src/eslint/rules/no-while-true.d.ts +3 -0
- package/dist/src/eslint/rules/no-while-true.js +44 -0
- package/dist/src/eslint/rules/no-while-true.js.map +1 -0
- package/dist/src/eslint/rules/prefer-bigint.d.ts +3 -0
- package/dist/src/eslint/rules/prefer-bigint.js +102 -0
- package/dist/src/eslint/rules/prefer-bigint.js.map +1 -0
- package/dist/src/eslint/rules/prefer-const-outside-server.d.ts +3 -0
- package/dist/src/eslint/rules/prefer-const-outside-server.js +200 -0
- package/dist/src/eslint/rules/prefer-const-outside-server.js.map +1 -0
- package/dist/src/eslint/rules/require-boolean-condition.d.ts +3 -0
- package/dist/src/eslint/rules/require-boolean-condition.js +77 -0
- package/dist/src/eslint/rules/require-boolean-condition.js.map +1 -0
- package/dist/src/eslint/rules/switch-restrictions.d.ts +3 -0
- package/dist/src/eslint/rules/switch-restrictions.js +125 -0
- package/dist/src/eslint/rules/switch-restrictions.js.map +1 -0
- package/dist/src/eslint/rules/ternary-branch-type.d.ts +3 -0
- package/dist/src/eslint/rules/ternary-branch-type.js +112 -0
- package/dist/src/eslint/rules/ternary-branch-type.js.map +1 -0
- package/dist/src/eslint/rules/timer-callback-signature.d.ts +3 -0
- package/dist/src/eslint/rules/timer-callback-signature.js +88 -0
- package/dist/src/eslint/rules/timer-callback-signature.js.map +1 -0
- package/dist/src/eslint/rules/timer-interval-frequency.d.ts +3 -0
- package/dist/src/eslint/rules/timer-interval-frequency.js +76 -0
- package/dist/src/eslint/rules/timer-interval-frequency.js.map +1 -0
- package/dist/src/eslint/rules/timer-outer-capture.d.ts +3 -0
- package/dist/src/eslint/rules/timer-outer-capture.js +345 -0
- package/dist/src/eslint/rules/timer-outer-capture.js.map +1 -0
- package/dist/src/eslint/rules/unsupported-binary-operator.d.ts +3 -0
- package/dist/src/eslint/rules/unsupported-binary-operator.js +46 -0
- package/dist/src/eslint/rules/unsupported-binary-operator.js.map +1 -0
- package/dist/src/eslint/utils/ast.d.ts +14 -0
- package/dist/src/eslint/utils/ast.js +28 -0
- package/dist/src/eslint/utils/ast.js.map +1 -0
- package/dist/src/eslint/utils/list.d.ts +2 -0
- package/dist/src/eslint/utils/list.js +3 -0
- package/dist/src/eslint/utils/list.js.map +1 -0
- package/dist/src/eslint/utils/list_methods.d.ts +2 -0
- package/dist/src/eslint/utils/list_methods.js +30 -0
- package/dist/src/eslint/utils/list_methods.js.map +1 -0
- package/dist/src/eslint/utils/messages.d.ts +2 -0
- package/dist/src/eslint/utils/messages.js +8 -0
- package/dist/src/eslint/utils/messages.js.map +1 -0
- package/dist/src/eslint/utils/options.d.ts +8 -0
- package/dist/src/eslint/utils/options.js +7 -0
- package/dist/src/eslint/utils/options.js.map +1 -0
- package/dist/src/eslint/utils/parser.d.ts +14 -0
- package/dist/src/eslint/utils/parser.js +30 -0
- package/dist/src/eslint/utils/parser.js.map +1 -0
- package/dist/src/eslint/utils/scope.d.ts +13 -0
- package/dist/src/eslint/utils/scope.js +70 -0
- package/dist/src/eslint/utils/scope.js.map +1 -0
- package/dist/src/eslint/utils/ts_matchers.d.ts +11 -0
- package/dist/src/eslint/utils/ts_matchers.js +124 -0
- package/dist/src/eslint/utils/ts_matchers.js.map +1 -0
- package/dist/src/eslint/utils/type_position.d.ts +2 -0
- package/dist/src/eslint/utils/type_position.js +16 -0
- package/dist/src/eslint/utils/type_position.js.map +1 -0
- package/dist/src/eslint/utils/types.d.ts +9 -0
- package/dist/src/eslint/utils/types.js +103 -0
- package/dist/src/eslint/utils/types.js.map +1 -0
- package/dist/src/i18n/index.d.ts +13 -0
- package/dist/src/i18n/index.js +78 -0
- package/dist/src/i18n/index.js.map +1 -0
- package/dist/src/i18n/locales/en-US/main.json +58 -0
- package/dist/src/i18n/locales/zh-CN/main.json +58 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/index.js +6 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/injector/binary.d.ts +20 -0
- package/dist/src/injector/binary.js +167 -0
- package/dist/src/injector/binary.js.map +1 -0
- package/dist/src/injector/folder.d.ts +9 -0
- package/dist/src/injector/folder.js +279 -0
- package/dist/src/injector/folder.js.map +1 -0
- package/dist/src/injector/index.d.ts +14 -0
- package/dist/src/injector/index.js +152 -0
- package/dist/src/injector/index.js.map +1 -0
- package/dist/src/injector/node_graph.d.ts +14 -0
- package/dist/src/injector/node_graph.js +155 -0
- package/dist/src/injector/node_graph.js.map +1 -0
- package/dist/src/injector/proto.d.ts +9 -0
- package/dist/src/injector/proto.js +21 -0
- package/dist/src/injector/proto.js.map +1 -0
- package/dist/src/injector/signal_nodes.d.ts +22 -0
- package/dist/src/injector/signal_nodes.js +283 -0
- package/dist/src/injector/signal_nodes.js.map +1 -0
- package/dist/src/injector/types.d.ts +67 -0
- package/dist/src/injector/types.js +2 -0
- package/dist/src/injector/types.js.map +1 -0
- package/dist/src/runtime/IR.d.ts +235 -0
- package/dist/src/runtime/core.d.ts +252 -0
- package/dist/src/runtime/core.js +665 -0
- package/dist/src/runtime/core.js.map +1 -0
- package/dist/src/runtime/execution_flow_types.d.ts +65 -0
- package/dist/src/runtime/execution_flow_types.js +2 -0
- package/dist/src/runtime/execution_flow_types.js.map +1 -0
- package/dist/src/runtime/ir_builder.d.ts +3 -0
- package/dist/src/runtime/ir_builder.js +169 -0
- package/dist/src/runtime/ir_builder.js.map +1 -0
- package/dist/src/runtime/ir_optimize_return_vars.d.ts +2 -0
- package/dist/src/runtime/ir_optimize_return_vars.js +96 -0
- package/dist/src/runtime/ir_optimize_return_vars.js.map +1 -0
- package/dist/src/runtime/meta_call_types.d.ts +9 -0
- package/dist/src/runtime/meta_call_types.js +2 -0
- package/dist/src/runtime/meta_call_types.js.map +1 -0
- package/dist/src/runtime/runtime_config.d.ts +11 -0
- package/dist/src/runtime/runtime_config.js +30 -0
- package/dist/src/runtime/runtime_config.js.map +1 -0
- package/dist/src/runtime/server_globals.d.ts +31 -0
- package/dist/src/runtime/server_globals.global.d.ts +792 -0
- package/dist/src/runtime/server_globals.js +802 -0
- package/dist/src/runtime/server_globals.js.map +1 -0
- package/dist/src/runtime/value.d.ts +421 -0
- package/dist/src/runtime/value.js +574 -0
- package/dist/src/runtime/value.js.map +1 -0
- package/dist/src/runtime/variables.d.ts +165 -0
- package/dist/src/runtime/variables.js +350 -0
- package/dist/src/runtime/variables.js.map +1 -0
- package/dist/src/shared/ts_list_utils.d.ts +11 -0
- package/dist/src/shared/ts_list_utils.js +143 -0
- package/dist/src/shared/ts_list_utils.js.map +1 -0
- package/dist/src/shared/ts_type_utils.d.ts +2 -0
- package/dist/src/shared/ts_type_utils.js +48 -0
- package/dist/src/shared/ts_type_utils.js.map +1 -0
- package/dist/src/shared/type_string_utils.d.ts +4 -0
- package/dist/src/shared/type_string_utils.js +78 -0
- package/dist/src/shared/type_string_utils.js.map +1 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/gia_gen/basic.d.ts +395 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/gia_gen/basic.js +802 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/gia_gen/basic.js.map +1 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/gia_gen/extract.d.ts +22 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/gia_gen/extract.js +111 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/gia_gen/extract.js.map +1 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/gia_gen/graph.d.ts +138 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/gia_gen/graph.js +635 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/gia_gen/graph.js.map +1 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/gia_gen/index.d.ts +7 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/gia_gen/index.js +7 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/gia_gen/index.js.map +1 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/gia_gen/nodes.d.ts +131 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/gia_gen/nodes.js +890 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/gia_gen/nodes.js.map +1 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/gia_gen/utils.d.ts +27 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/gia_gen/utils.js +145 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/gia_gen/utils.js.map +1 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/node_data/concrete_map.d.ts +18 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/node_data/concrete_map.js +376 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/node_data/concrete_map.js.map +1 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/node_data/enum_id.d.ts +330 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/node_data/enum_id.js +384 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/node_data/enum_id.js.map +1 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/node_data/helpers.d.ts +26 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/node_data/helpers.js +127 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/node_data/helpers.js.map +1 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/node_data/index.d.ts +18 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/node_data/index.js +20 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/node_data/index.js.map +1 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/node_data/node_id.d.ts +4099 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/node_data/node_id.js +4099 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/node_data/node_id.js.map +1 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/node_data/node_pin_records.d.ts +2459 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/node_data/node_pin_records.js +6346 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/node_data/node_pin_records.js.map +1 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/node_data/types_list.d.ts +301 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/node_data/types_list.js +281 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/node_data/types_list.js.map +1 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/protobuf/decode.d.ts +6 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/protobuf/decode.js +119 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/protobuf/decode.js.map +1 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/protobuf/gia.proto +524 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/protobuf/gia.proto.d.ts +820 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/protobuf/gia.proto.js +156 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/protobuf/gia.proto.js.map +1 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/gia_gen/auto_layout.d.ts +13 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/gia_gen/auto_layout.js +91 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/gia_gen/auto_layout.js.map +1 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/gia_gen/core.d.ts +84 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/gia_gen/core.js +742 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/gia_gen/core.js.map +1 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/gia_gen/interface.d.ts +670 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/gia_gen/interface.js +1399 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/gia_gen/interface.js.map +1 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/gia_gen/utils.d.ts +19 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/gia_gen/utils.js +80 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/gia_gen/utils.js.map +1 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/node_data/core.d.ts +364 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/node_data/core.js +932 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/node_data/core.js.map +1 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/node_data/data.json +157548 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/node_data/instances.d.ts +12 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/node_data/instances.js +20 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/node_data/instances.js.map +1 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/node_data/node_type.d.ts +397 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/node_data/node_type.js +507 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/node_data/node_type.js.map +1 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/node_data/types.d.ts +477 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/node_data/types.js +44 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/node_data/types.js.map +1 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/protobuf/decode.d.ts +6 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/protobuf/decode.js +60 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/protobuf/decode.js.map +1 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/protobuf/gia.proto +867 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/protobuf/gia.proto.d.ts +867 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/protobuf/gia.proto.js +206 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/protobuf/gia.proto.js.map +1 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/utils.d.ts +40 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/utils.js +503 -0
- package/dist/src/thirdparty/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack/utils/utils.js.map +1 -0
- package/eslint.globals.mjs +43 -0
- package/package.json +116 -0
- package/types/gsts/index.d.ts +3 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 josStorer
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img width="256" height="256" alt="logo" src="https://github.com/user-attachments/assets/a1000ae8-8633-449f-9b90-fd3c5da8c4a2" />
|
|
3
|
+
</p>
|
|
4
|
+
<h1 align="center">Genshin-TS</h1>
|
|
5
|
+
|
|
6
|
+
<div align="center">
|
|
7
|
+
|
|
8
|
+
Use TypeScript to develop Genshin UGC (Miliastra Wonderland) projects. Full type system, practical helpers, JS-native and Unity3D-style APIs, npm ecosystem support, and an AI-friendly workflow.
|
|
9
|
+
|
|
10
|
+
[](https://github.com/TheTouYu/genshin-ts/blob/master/LICENSE)
|
|
11
|
+
[](https://github.com/TheTouYu/genshin-ts/releases/latest)
|
|
12
|
+
[](https://www.npmjs.com/package/genshin-ts-touyu)
|
|
13
|
+
[](https://www.typescriptlang.org/)
|
|
14
|
+
|
|
15
|
+
English · [简体中文](README_ZH.md)
|
|
16
|
+
|
|
17
|
+
[Docs](https://gsts.moe) · [Intro Video](https://www.youtube.com/watch?v=kEACvJzHwr0) · [Template Guide & Usage Details](create-genshin-ts/templates/start/README.md)
|
|
18
|
+
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
## Introduction
|
|
22
|
+
|
|
23
|
+
Genshin-TS (gsts) is a toolchain for building Miliastra Wonderland projects in TypeScript. It focuses on a code-first experience with controllable node-graph semantics, supporting compilation, injection, debugging, optimization, parallel builds, and incremental builds.
|
|
24
|
+
|
|
25
|
+
https://github.com/user-attachments/assets/0f2ec8af-c753-4c54-940c-8147ec856635
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm create genshin-ts-touyu@latest
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
genshin-ts-touyu includes a TypeScript plugin for more advanced TypeScript support enhancements. It is optional (disabling it does not affect functionality and developer experience), but recommended. See:
|
|
34
|
+
[https://gsts.moe/doc/quick-start/install.html#typescript-plugin](https://gsts.moe/doc/quick-start/install.html#typescript-plugin)
|
|
35
|
+
|
|
36
|
+
Then in the template:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm install
|
|
40
|
+
npm run dev
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
For detailed usage and constraints, see the template guide and docs:
|
|
44
|
+
- [`create-genshin-ts/templates/start/README.md`](create-genshin-ts/templates/start/README.md)
|
|
45
|
+
- [https://gsts.moe](https://gsts.moe)
|
|
46
|
+
|
|
47
|
+
## Highlights
|
|
48
|
+
|
|
49
|
+
- TS -> NodeGraph compilation: event entry points, control flow, reusable functions, and client-side node graphs (124 nodes).
|
|
50
|
+
- Full type hints with Chinese/English aliases: events, functions, APIs, entity subtypes.
|
|
51
|
+
- `g.server(...).on(...)` chaining, multi-entry merge by identical ID.
|
|
52
|
+
- `gstsServer*` function compilation (reusable logic, controlled returns).
|
|
53
|
+
- JS-style timers: `setTimeout` / `setInterval` + closure capture + name pools + dispatch aggregation.
|
|
54
|
+
- Compile-time optimizations: constant precompute, dead node removal, local variable reuse.
|
|
55
|
+
- Readable IR JSON for debugging and further processing.
|
|
56
|
+
- CLI toolchain: incremental builds, injection safety checks, map discovery, auto backups.
|
|
57
|
+
- Custom ESLint rules to surface semantic constraints early.
|
|
58
|
+
- Built-in prefab/resource ID support.
|
|
59
|
+
|
|
60
|
+
## Compilation Pipeline and Outputs
|
|
61
|
+
|
|
62
|
+
Pipeline:
|
|
63
|
+
1. TS -> `.gs.ts` (node function call form)
|
|
64
|
+
2. `.gs.ts` -> IR `.json` (nodes and connections)
|
|
65
|
+
3. IR -> `.gia` (injectable output)
|
|
66
|
+
|
|
67
|
+
Outputs are written to `dist/` by default. `.gs.ts` and `.json` are the primary debugging entry points.
|
|
68
|
+
|
|
69
|
+
## Key Optimizations
|
|
70
|
+
|
|
71
|
+
Enabled by default (can be disabled in `gsts.config.ts`):
|
|
72
|
+
- `precompileExpression`: precompute literal-only expressions.
|
|
73
|
+
- `removeUnusedNodes`: remove unused exec/data nodes.
|
|
74
|
+
- `timerPool`: timer name pools to avoid collisions.
|
|
75
|
+
- `timerDispatchAggregate`: aggregate timer dispatch to reduce graph complexity.
|
|
76
|
+
|
|
77
|
+
## How to Use
|
|
78
|
+
|
|
79
|
+
- **Template**: `npm create genshin-ts-touyu@latest` (recommended; TypeScript plugin guidance: [https://gsts.moe/doc/quick-start/install.html#typescript-plugin](https://gsts.moe/doc/quick-start/install.html#typescript-plugin))
|
|
80
|
+
- **As a dependency**: `npm i genshin-ts-touyu` and call compiler/injector APIs in your project
|
|
81
|
+
- **Global CLI**: `npm install -g genshin-ts-touyu`, then use `gsts` for compile/inject
|
|
82
|
+
|
|
83
|
+
## Constraints (Overview)
|
|
84
|
+
|
|
85
|
+
- Only a supported TS subset (no Promise/async/recursion).
|
|
86
|
+
- Conditions must be boolean.
|
|
87
|
+
- `gstsServer*` allows only a single trailing return.
|
|
88
|
+
- `console.log` supports only one argument (rewritten to `print(str(...))`).
|
|
89
|
+
- Native `Object.*` / `JSON.*` are generally unavailable in node-graph scope.
|
|
90
|
+
|
|
91
|
+
See the template guide for the full list and best practices.
|
|
92
|
+
|
|
93
|
+
## Detailed Usage & AI Guidance
|
|
94
|
+
|
|
95
|
+
- Template guide: `create-genshin-ts/templates/start/README.md`
|
|
96
|
+
- AI guidance: `create-genshin-ts/templates/start/CLAUDE.md` / `create-genshin-ts/templates/start/AGENTS.md`
|
|
97
|
+
- Function/event notes: `node_modules/genshin-ts-touyu/dist/src/definitions/`
|
|
98
|
+
|
|
99
|
+
## TODO (Some items may be dropped based on feasibility; in no particular order)
|
|
100
|
+
|
|
101
|
+
- Improve CI pipeline
|
|
102
|
+
- Client-side node graph support (124 nodes, full arithmetic/query/execution DSL)
|
|
103
|
+
- Improve documentation site
|
|
104
|
+
- Signal and struct definitions with parameter passing (generic parameter type hints)
|
|
105
|
+
- Auto-detect node graph limit overflow (3000)
|
|
106
|
+
- Auto re-inject on external map save detection
|
|
107
|
+
- `g.scene()` programmatic scene definition support
|
|
108
|
+
- Auto variable mounting support
|
|
109
|
+
- Node graph JSON visual previewer
|
|
110
|
+
- Programmatic struct and global timer definitions
|
|
111
|
+
- More `// @gsts:` decorator optimization flags, e.g., local precompile toggle
|
|
112
|
+
- `await delay` support? (highly uncertain)
|
|
113
|
+
- GIA to TypeScript conversion support
|
|
114
|
+
- npm library development template
|
|
115
|
+
- Generate JS source maps for better error tracing
|
|
116
|
+
- Fix cross-file duplicate ID level cache issues
|
|
117
|
+
- JSX component development abstraction
|
|
118
|
+
- Expand examples
|
|
119
|
+
- Simplify `{}` style 3D vector array inference
|
|
120
|
+
- Extract custom prefab IDs from GIL directly into project
|
|
121
|
+
- VFX, sound, and other resource IDs
|
|
122
|
+
|
|
123
|
+
## Special Thanks
|
|
124
|
+
|
|
125
|
+
- https://github.com/Wu-Yijun/Genshin-Impact-Miliastra-Wonderland-Code-Node-Editor-Pack
|
|
126
|
+
|
|
127
|
+
- Before discovering this project, I spent nearly a month reversing GIA/GIL; their approach was more complete. I integrated it as a third-party module and merged some of my reverse-engineered data.
|
|
128
|
+
|
|
129
|
+
- The work is excellent and MIT-licensed. Please consider supporting the project as well.
|
package/bin/gsts.mjs
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import eslint from '@eslint/js'
|
|
2
|
+
import tseslint from '@typescript-eslint/eslint-plugin'
|
|
3
|
+
import tsparser from '@typescript-eslint/parser'
|
|
4
|
+
import prettierConfig from 'eslint-config-prettier'
|
|
5
|
+
import prettier from 'eslint-plugin-prettier'
|
|
6
|
+
import gsts from 'genshin-ts-touyu/eslint'
|
|
7
|
+
import { gstsDslGlobals } from 'genshin-ts-touyu/eslint.globals.mjs'
|
|
8
|
+
|
|
9
|
+
export default [
|
|
10
|
+
{
|
|
11
|
+
ignores: ['dist/**', 'out/**', 'node_modules/**']
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
eslint.configs.recommended,
|
|
15
|
+
|
|
16
|
+
// TypeScript 文件配置
|
|
17
|
+
{
|
|
18
|
+
files: ['**/*.ts', '**/*.tsx'],
|
|
19
|
+
languageOptions: {
|
|
20
|
+
parser: tsparser,
|
|
21
|
+
parserOptions: {
|
|
22
|
+
ecmaVersion: 2022,
|
|
23
|
+
sourceType: 'module',
|
|
24
|
+
project: true
|
|
25
|
+
},
|
|
26
|
+
globals: {
|
|
27
|
+
console: 'readonly',
|
|
28
|
+
process: 'readonly',
|
|
29
|
+
Buffer: 'readonly',
|
|
30
|
+
__dirname: 'readonly',
|
|
31
|
+
__filename: 'readonly',
|
|
32
|
+
AbortController: 'readonly',
|
|
33
|
+
AbortSignal: 'readonly',
|
|
34
|
+
...gstsDslGlobals
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
plugins: {
|
|
38
|
+
'@typescript-eslint': tseslint,
|
|
39
|
+
prettier: prettier,
|
|
40
|
+
gsts
|
|
41
|
+
},
|
|
42
|
+
rules: {
|
|
43
|
+
...tseslint.configs.recommended.rules,
|
|
44
|
+
...tseslint.configs['recommended-requiring-type-checking'].rules,
|
|
45
|
+
...gsts.configs.recommended.rules,
|
|
46
|
+
|
|
47
|
+
// 代码质量规则
|
|
48
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
49
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
50
|
+
'@typescript-eslint/triple-slash-reference': 'off',
|
|
51
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
52
|
+
'@typescript-eslint/ban-ts-comment': [
|
|
53
|
+
'error',
|
|
54
|
+
{
|
|
55
|
+
'ts-ignore': 'allow-with-description',
|
|
56
|
+
'ts-nocheck': 'allow-with-description'
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
'@typescript-eslint/no-unused-vars': [
|
|
60
|
+
'warn',
|
|
61
|
+
{
|
|
62
|
+
argsIgnorePattern: '^_',
|
|
63
|
+
varsIgnorePattern: '^_'
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
67
|
+
|
|
68
|
+
// this 安全规则
|
|
69
|
+
'@typescript-eslint/no-this-alias': ['error'],
|
|
70
|
+
'@typescript-eslint/unbound-method': ['error'],
|
|
71
|
+
'no-invalid-this': 'off', // 关闭基础规则
|
|
72
|
+
'@typescript-eslint/no-invalid-this': 'error', // 使用 TS 版本
|
|
73
|
+
'no-redeclare': 'off',
|
|
74
|
+
'@typescript-eslint/no-redeclare': 'error',
|
|
75
|
+
|
|
76
|
+
// 通用规则
|
|
77
|
+
'no-console': 'off',
|
|
78
|
+
'no-debugger': 'warn',
|
|
79
|
+
'prefer-const': 'off',
|
|
80
|
+
'no-var': 'error',
|
|
81
|
+
|
|
82
|
+
// Prettier 集成
|
|
83
|
+
...prettierConfig.rules,
|
|
84
|
+
'prettier/prettier': 'error'
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
// JavaScript 文件配置(如配置文件等)
|
|
89
|
+
{
|
|
90
|
+
files: ['**/*.js', '**/*.mjs'],
|
|
91
|
+
languageOptions: {
|
|
92
|
+
ecmaVersion: 2022,
|
|
93
|
+
sourceType: 'module',
|
|
94
|
+
globals: {
|
|
95
|
+
console: 'readonly',
|
|
96
|
+
process: 'readonly',
|
|
97
|
+
__dirname: 'readonly',
|
|
98
|
+
__filename: 'readonly'
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
plugins: {
|
|
102
|
+
prettier: prettier
|
|
103
|
+
},
|
|
104
|
+
rules: {
|
|
105
|
+
'no-console': 'off',
|
|
106
|
+
'prettier/prettier': 'error'
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import tsparser from '@typescript-eslint/parser'
|
|
2
|
+
import gsts from 'genshin-ts-touyu/eslint'
|
|
3
|
+
import { gstsDslGlobals } from 'genshin-ts-touyu/eslint.globals.mjs'
|
|
4
|
+
|
|
5
|
+
export default [
|
|
6
|
+
{
|
|
7
|
+
files: ['**/*.ts', '**/*.tsx'],
|
|
8
|
+
languageOptions: {
|
|
9
|
+
parser: tsparser,
|
|
10
|
+
parserOptions: {
|
|
11
|
+
ecmaVersion: 2022,
|
|
12
|
+
sourceType: 'module',
|
|
13
|
+
project: true
|
|
14
|
+
},
|
|
15
|
+
globals: {
|
|
16
|
+
...gstsDslGlobals
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
plugins: {
|
|
20
|
+
gsts
|
|
21
|
+
},
|
|
22
|
+
rules: {
|
|
23
|
+
...gsts.configs.recommended.rules,
|
|
24
|
+
'prefer-const': 'off'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
]
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gsts tsserver plugin:
|
|
3
|
+
* suppress TS2538 ("Type X cannot be used as an index type")
|
|
4
|
+
* only for bigint/int-like index expressions inside:
|
|
5
|
+
* - g.server().on/onSignal handlers
|
|
6
|
+
* - top-level gstsServer* function bodies
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
function init(modules) {
|
|
10
|
+
const ts = modules.typescript
|
|
11
|
+
|
|
12
|
+
function collectGImportNames(sourceFile) {
|
|
13
|
+
const names = new Set()
|
|
14
|
+
for (const stmt of sourceFile.statements) {
|
|
15
|
+
if (!ts.isImportDeclaration(stmt)) continue
|
|
16
|
+
if (!stmt.moduleSpecifier || !ts.isStringLiteral(stmt.moduleSpecifier)) continue
|
|
17
|
+
const spec = stmt.moduleSpecifier.text
|
|
18
|
+
if (spec !== 'genshin-ts-touyu/runtime/core' && spec !== 'genshin-ts-touyu/runtime/core.js') continue
|
|
19
|
+
const clause = stmt.importClause
|
|
20
|
+
const bindings = clause && clause.namedBindings
|
|
21
|
+
if (!bindings || !ts.isNamedImports(bindings)) continue
|
|
22
|
+
for (const e of bindings.elements) {
|
|
23
|
+
const importName = e.propertyName ? e.propertyName.text : e.name.text
|
|
24
|
+
if (importName === 'g') names.add(e.name.text)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (!names.size) names.add('g')
|
|
28
|
+
return names
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function inRange(pos, node, sourceFile) {
|
|
32
|
+
return pos >= node.getStart(sourceFile, false) && pos < node.getEnd()
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function findNodeAtPos(sourceFile, pos) {
|
|
36
|
+
let best = sourceFile
|
|
37
|
+
const visit = (node) => {
|
|
38
|
+
if (!inRange(pos, node, sourceFile)) return
|
|
39
|
+
best = node
|
|
40
|
+
ts.forEachChild(node, visit)
|
|
41
|
+
}
|
|
42
|
+
visit(sourceFile)
|
|
43
|
+
return best
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function findAncestor(node, pred) {
|
|
47
|
+
let cur = node
|
|
48
|
+
while (cur) {
|
|
49
|
+
if (pred(cur)) return cur
|
|
50
|
+
cur = cur.parent
|
|
51
|
+
}
|
|
52
|
+
return undefined
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function hasBigIntLikeConstituent(type, checker) {
|
|
56
|
+
if (!type) return false
|
|
57
|
+
if (type.flags & ts.TypeFlags.Union) {
|
|
58
|
+
return type.types.some((t) => hasBigIntLikeConstituent(t, checker))
|
|
59
|
+
}
|
|
60
|
+
if (type.flags & ts.TypeFlags.Intersection) {
|
|
61
|
+
return type.types.some((t) => hasBigIntLikeConstituent(t, checker))
|
|
62
|
+
}
|
|
63
|
+
if ((type.flags & ts.TypeFlags.BigIntLike) !== 0) return true
|
|
64
|
+
const s = checker.typeToString(type)
|
|
65
|
+
return s === 'IntValue' || s === 'int' || s === 'bigint'
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function unwrapChainBase(expr) {
|
|
69
|
+
let cur = expr
|
|
70
|
+
while (
|
|
71
|
+
ts.isCallExpression(cur) &&
|
|
72
|
+
ts.isPropertyAccessExpression(cur.expression) &&
|
|
73
|
+
(cur.expression.name.text === 'on' || cur.expression.name.text === 'onSignal')
|
|
74
|
+
) {
|
|
75
|
+
cur = cur.expression.expression
|
|
76
|
+
}
|
|
77
|
+
return cur
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function isServerHandlerFunction(fnNode, gNames) {
|
|
81
|
+
const parent = fnNode.parent
|
|
82
|
+
if (!parent || !ts.isCallExpression(parent)) return false
|
|
83
|
+
if (parent.arguments.length < 2 || parent.arguments[1] !== fnNode) return false
|
|
84
|
+
if (!ts.isPropertyAccessExpression(parent.expression)) return false
|
|
85
|
+
const method = parent.expression.name.text
|
|
86
|
+
if (method !== 'on' && method !== 'onSignal') return false
|
|
87
|
+
|
|
88
|
+
const base = unwrapChainBase(parent.expression.expression)
|
|
89
|
+
if (!ts.isCallExpression(base)) return false
|
|
90
|
+
if (!ts.isPropertyAccessExpression(base.expression)) return false
|
|
91
|
+
if (base.expression.name.text !== 'server') return false
|
|
92
|
+
if (!ts.isIdentifier(base.expression.expression)) return false
|
|
93
|
+
return gNames.has(base.expression.expression.text)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function isInGServerScope(node, gNames) {
|
|
97
|
+
let cur = node
|
|
98
|
+
while (cur) {
|
|
99
|
+
if (
|
|
100
|
+
(ts.isArrowFunction(cur) ||
|
|
101
|
+
ts.isFunctionExpression(cur) ||
|
|
102
|
+
ts.isFunctionDeclaration(cur)) &&
|
|
103
|
+
isServerHandlerFunction(cur, gNames)
|
|
104
|
+
) {
|
|
105
|
+
return true
|
|
106
|
+
}
|
|
107
|
+
cur = cur.parent
|
|
108
|
+
}
|
|
109
|
+
return false
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function isTopLevelFunctionDeclaration(node) {
|
|
113
|
+
return ts.isFunctionDeclaration(node) && !!node.name && ts.isSourceFile(node.parent)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function isTopLevelGstsServerVarInitializer(node) {
|
|
117
|
+
if (!(ts.isArrowFunction(node) || ts.isFunctionExpression(node))) return false
|
|
118
|
+
const decl = node.parent
|
|
119
|
+
if (!decl || !ts.isVariableDeclaration(decl)) return false
|
|
120
|
+
if (decl.initializer !== node) return false
|
|
121
|
+
if (!ts.isIdentifier(decl.name)) return false
|
|
122
|
+
const list = decl.parent
|
|
123
|
+
if (!list || !ts.isVariableDeclarationList(list)) return false
|
|
124
|
+
const stmt = list.parent
|
|
125
|
+
if (!stmt || !ts.isVariableStatement(stmt)) return false
|
|
126
|
+
return ts.isSourceFile(stmt.parent)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function isGstsServerRootFunction(node) {
|
|
130
|
+
if (isTopLevelFunctionDeclaration(node)) return node.name.text.startsWith('gstsServer')
|
|
131
|
+
if (isTopLevelGstsServerVarInitializer(node)) {
|
|
132
|
+
const decl = node.parent
|
|
133
|
+
return ts.isIdentifier(decl.name) && decl.name.text.startsWith('gstsServer')
|
|
134
|
+
}
|
|
135
|
+
return false
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function isInGstsServerScope(node) {
|
|
139
|
+
let cur = node
|
|
140
|
+
while (cur) {
|
|
141
|
+
if (
|
|
142
|
+
(ts.isArrowFunction(cur) ||
|
|
143
|
+
ts.isFunctionExpression(cur) ||
|
|
144
|
+
ts.isFunctionDeclaration(cur)) &&
|
|
145
|
+
isGstsServerRootFunction(cur)
|
|
146
|
+
) {
|
|
147
|
+
return true
|
|
148
|
+
}
|
|
149
|
+
cur = cur.parent
|
|
150
|
+
}
|
|
151
|
+
return false
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function shouldSuppress2538(diagnostic, sourceFile, checker) {
|
|
155
|
+
if (!diagnostic || diagnostic.code !== 2538) return false
|
|
156
|
+
if (!diagnostic.file || typeof diagnostic.start !== 'number') return false
|
|
157
|
+
const pos = diagnostic.start
|
|
158
|
+
const gNames = collectGImportNames(sourceFile)
|
|
159
|
+
const nodeAtPos = findNodeAtPos(sourceFile, pos)
|
|
160
|
+
|
|
161
|
+
const elem = findAncestor(
|
|
162
|
+
nodeAtPos,
|
|
163
|
+
(n) =>
|
|
164
|
+
ts.isElementAccessExpression(n) &&
|
|
165
|
+
!!n.argumentExpression &&
|
|
166
|
+
inRange(pos, n.argumentExpression, sourceFile)
|
|
167
|
+
)
|
|
168
|
+
if (!elem || !elem.argumentExpression) return false
|
|
169
|
+
if (!isInGServerScope(elem, gNames) && !isInGstsServerScope(elem)) return false
|
|
170
|
+
|
|
171
|
+
const indexType = checker.getTypeAtLocation(elem.argumentExpression)
|
|
172
|
+
return hasBigIntLikeConstituent(indexType, checker)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function create(info) {
|
|
176
|
+
const languageService = info.languageService
|
|
177
|
+
const proxy = Object.create(null)
|
|
178
|
+
for (const key of Object.keys(languageService)) {
|
|
179
|
+
proxy[key] = languageService[key].bind(languageService)
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
proxy.getSemanticDiagnostics = (fileName) => {
|
|
183
|
+
const base = languageService.getSemanticDiagnostics(fileName)
|
|
184
|
+
if (!Array.isArray(base) || base.length === 0) return base
|
|
185
|
+
const program = languageService.getProgram()
|
|
186
|
+
if (!program) return base
|
|
187
|
+
const sourceFile = program.getSourceFile(fileName)
|
|
188
|
+
if (!sourceFile) return base
|
|
189
|
+
const checker = program.getTypeChecker()
|
|
190
|
+
return base.filter((d) => !shouldSuppress2538(d, sourceFile, checker))
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return proxy
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return { create }
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
module.exports = init
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"lib": ["ES2022"],
|
|
7
|
+
"plugins": [{ "name": "genshin-ts-touyu/configs/ts-plugin" }],
|
|
8
|
+
"strict": true,
|
|
9
|
+
"types": ["node"],
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"noImplicitAny": true,
|
|
14
|
+
"noImplicitReturns": true,
|
|
15
|
+
"noUnusedLocals": false,
|
|
16
|
+
"noUnusedParameters": false,
|
|
17
|
+
"skipLibCheck": true
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { initCliI18n } from '../i18n/index.js';
|
|
2
|
+
import { ensureDataDirs } from './data.js';
|
|
3
|
+
import { renderMarkdownToAnsi } from './markdown_render.js';
|
|
4
|
+
import { fetchText } from './net.js';
|
|
5
|
+
import { shouldShowNotice, splitMarkdownFrontmatter } from './notice_frontmatter.js';
|
|
6
|
+
import { getSelfVersion } from './pkg.js';
|
|
7
|
+
import { loadState, saveState } from './state.js';
|
|
8
|
+
import { createUi } from './ui.js';
|
|
9
|
+
import { findLatestUpdate } from './update_changelog.js';
|
|
10
|
+
const ui = createUi();
|
|
11
|
+
const URLS = {
|
|
12
|
+
update: {
|
|
13
|
+
'en-US': 'https://github.com/TheTouYu/genshin-ts/raw/refs/heads/master/Changelog.md',
|
|
14
|
+
'zh-CN': 'https://github.com/TheTouYu/genshin-ts/raw/refs/heads/master/Changelog_ZH.md'
|
|
15
|
+
},
|
|
16
|
+
notice: {
|
|
17
|
+
'en-US': 'https://github.com/TheTouYu/genshin-ts/raw/refs/heads/master/Announcement.md',
|
|
18
|
+
'zh-CN': 'https://github.com/TheTouYu/genshin-ts/raw/refs/heads/master/Announcement_ZH.md'
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
function getBucket(state, key) {
|
|
22
|
+
return key === 'update' ? state.updateCheck : state.noticeCheck;
|
|
23
|
+
}
|
|
24
|
+
function setBucket(state, key, next) {
|
|
25
|
+
if (key === 'update')
|
|
26
|
+
state.updateCheck = next;
|
|
27
|
+
else
|
|
28
|
+
state.noticeCheck = next;
|
|
29
|
+
}
|
|
30
|
+
export async function maybeCheckRemoteMarkdown(key, lang) {
|
|
31
|
+
ensureDataDirs();
|
|
32
|
+
const { t } = initCliI18n(lang);
|
|
33
|
+
const state = loadState();
|
|
34
|
+
const bucket = getBucket(state, key) ?? {};
|
|
35
|
+
const lastAt = bucket.lastAt ?? 0;
|
|
36
|
+
const cooldownMs = 2 * 3600 * 1000;
|
|
37
|
+
const cooledDown = Date.now() - lastAt >= cooldownMs;
|
|
38
|
+
const streak = cooledDown ? 0 : (bucket.streak ?? 0);
|
|
39
|
+
const now = Date.now();
|
|
40
|
+
const minIntervalMs = 5 * 60 * 1000;
|
|
41
|
+
if (now - lastAt < minIntervalMs)
|
|
42
|
+
return;
|
|
43
|
+
if (streak >= 3)
|
|
44
|
+
return;
|
|
45
|
+
setBucket(state, key, { lastAt: now, streak: streak + 1 });
|
|
46
|
+
saveState(state);
|
|
47
|
+
const url = URLS[key][lang];
|
|
48
|
+
ui.info(key === 'update' ? t('checkUpdate') : t('checkNotice'));
|
|
49
|
+
const md = await fetchText(url);
|
|
50
|
+
const rendered = (() => {
|
|
51
|
+
if (key === 'notice') {
|
|
52
|
+
const { meta, body } = splitMarkdownFrontmatter(md);
|
|
53
|
+
const ver = getSelfVersion();
|
|
54
|
+
if (!shouldShowNotice(meta, Date.now(), ver))
|
|
55
|
+
return '';
|
|
56
|
+
return renderMarkdownToAnsi(body);
|
|
57
|
+
}
|
|
58
|
+
const hit = findLatestUpdate(md, getSelfVersion());
|
|
59
|
+
if (!hit)
|
|
60
|
+
return '';
|
|
61
|
+
ui.warn(`${t('updateFound')}: v${hit.latest}`);
|
|
62
|
+
return renderMarkdownToAnsi(hit.snippet);
|
|
63
|
+
})();
|
|
64
|
+
if (rendered.length) {
|
|
65
|
+
process.stdout.write(rendered + '\n');
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=checks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checks.js","sourceRoot":"","sources":["../../../src/cli/checks.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
export function getDataDir() {
|
|
5
|
+
const appData = process.env.APPDATA;
|
|
6
|
+
if (appData && appData.length)
|
|
7
|
+
return path.join(appData, 'genshin-ts-touyu');
|
|
8
|
+
// fallback (rare on Windows): ~/.config like style
|
|
9
|
+
return path.join(os.homedir(), '.genshin-ts-touyu');
|
|
10
|
+
}
|
|
11
|
+
export function ensureDataDirs() {
|
|
12
|
+
const dataDir = getDataDir();
|
|
13
|
+
const backupsDir = path.join(dataDir, 'backups');
|
|
14
|
+
fs.mkdirSync(backupsDir, { recursive: true });
|
|
15
|
+
return { dataDir, backupsDir };
|
|
16
|
+
}
|
|
17
|
+
export function getStatePath() {
|
|
18
|
+
return path.join(getDataDir(), 'state.json');
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../../src/cli/data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,MAAM,UAAU,UAAU;IACxB,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAA;IACnC,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAA;IAC5E,mDAAmD;IACnD,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,mBAAmB,CAAC,CAAA;AACrD,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,MAAM,OAAO,GAAG,UAAU,EAAE,CAAA;IAC5B,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;IAChD,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IAC7C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAA;AAChC,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,YAAY,CAAC,CAAA;AAC9C,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { GstsGameRegion, GstsInjectConfig } from '../compiler/gsts_config.js';
|
|
2
|
+
export type ResolvedGilTarget = {
|
|
3
|
+
region: GstsGameRegion;
|
|
4
|
+
beyondLocalRoot: string;
|
|
5
|
+
playerId: number;
|
|
6
|
+
saveLevelDir: string;
|
|
7
|
+
mapId: number;
|
|
8
|
+
gilPath: string;
|
|
9
|
+
};
|
|
10
|
+
export type ResolvedGilFolder = {
|
|
11
|
+
region: GstsGameRegion;
|
|
12
|
+
beyondLocalRoot: string;
|
|
13
|
+
playerId: number;
|
|
14
|
+
saveLevelDir: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function detectGameRegion(): {
|
|
17
|
+
region: GstsGameRegion;
|
|
18
|
+
root: string;
|
|
19
|
+
} | null;
|
|
20
|
+
export declare function resolveGilTarget(cfg: GstsInjectConfig): ResolvedGilTarget;
|
|
21
|
+
export declare function resolveGilFolder(cfg: GstsInjectConfig): ResolvedGilFolder;
|