@mionjs/devtools 0.8.8 → 0.13.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 +1 -1
- package/README.md +34 -0
- package/dist/core/apply-edits.d.ts +8 -0
- package/dist/core/apply-edits.js +24 -0
- package/dist/core/apply-edits.js.map +1 -0
- package/dist/core/bundledApiStub.d.ts +4 -0
- package/dist/core/bundledApiStub.js +4 -0
- package/dist/core/bundledApiStub.js.map +1 -0
- package/dist/core/devReporter.d.ts +19 -0
- package/dist/core/devReporter.js +91 -0
- package/dist/core/devReporter.js.map +1 -0
- package/dist/core/diagnosticCatalog.d.ts +5 -0
- package/dist/core/diagnosticCatalog.js +18 -0
- package/dist/core/diagnosticCatalog.js.map +1 -0
- package/dist/core/downgradeErrors.d.ts +11 -0
- package/dist/core/downgradeErrors.js +34 -0
- package/dist/core/downgradeErrors.js.map +1 -0
- package/dist/core/edit-buffer.d.ts +26 -0
- package/dist/core/edit-buffer.js +209 -0
- package/dist/core/edit-buffer.js.map +1 -0
- package/dist/core/go-generated/diagnosticCatalog.generated.d.ts +9 -0
- package/dist/core/go-generated/diagnosticCatalog.generated.js +1008 -0
- package/dist/core/go-generated/diagnosticCatalog.generated.js.map +1 -0
- package/dist/core/go-generated/reflectionKind.generated.d.ts +60 -0
- package/dist/core/go-generated/reflectionKind.generated.js +60 -0
- package/dist/core/go-generated/reflectionKind.generated.js.map +1 -0
- package/dist/core/go-generated/runtypes-constants.generated.d.ts +197 -0
- package/dist/core/go-generated/runtypes-constants.generated.js +110 -0
- package/dist/core/go-generated/runtypes-constants.generated.js.map +1 -0
- package/dist/core/go-generated/tsconfig-plugin-keys.generated.d.ts +3 -0
- package/dist/core/go-generated/tsconfig-plugin-keys.generated.js +23 -0
- package/dist/core/go-generated/tsconfig-plugin-keys.generated.js.map +1 -0
- package/dist/core/groupedLog.d.ts +6 -0
- package/dist/core/groupedLog.js +163 -0
- package/dist/core/groupedLog.js.map +1 -0
- package/dist/core/levels.d.ts +6 -0
- package/dist/core/levels.js +22 -0
- package/dist/core/levels.js.map +1 -0
- package/dist/core/markerImports.d.ts +8 -0
- package/dist/core/markerImports.js +149 -0
- package/dist/core/markerImports.js.map +1 -0
- package/dist/core/option-guards.d.ts +4 -0
- package/dist/core/option-guards.js +12 -0
- package/dist/core/option-guards.js.map +1 -0
- package/dist/core/plugin-option-keys.d.ts +3 -0
- package/dist/core/plugin-option-keys.js +35 -0
- package/dist/core/plugin-option-keys.js.map +1 -0
- package/dist/core/protocol.d.ts +244 -0
- package/dist/core/protocol.js +23 -0
- package/dist/core/protocol.js.map +1 -0
- package/dist/core/resolver-client.d.ts +160 -0
- package/dist/core/resolver-client.js +354 -0
- package/dist/core/resolver-client.js.map +1 -0
- package/dist/core/scan-batcher.d.ts +6 -0
- package/dist/core/scan-batcher.js +36 -0
- package/dist/core/scan-batcher.js.map +1 -0
- package/dist/core/surface.d.ts +23 -0
- package/dist/core/surface.js +77 -0
- package/dist/core/surface.js.map +1 -0
- package/dist/core/type-deps.d.ts +11 -0
- package/dist/core/type-deps.js +72 -0
- package/dist/core/type-deps.js.map +1 -0
- package/dist/core/types.d.ts +13 -0
- package/dist/core/types.js +2 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/typescript-floor.d.ts +5 -0
- package/dist/core/typescript-floor.js +33 -0
- package/dist/core/typescript-floor.js.map +1 -0
- package/dist/core/unplugin.d.ts +67 -0
- package/dist/core/unplugin.js +636 -0
- package/dist/core/unplugin.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/lint/diagnosticRouting.d.ts +28 -0
- package/dist/lint/diagnosticRouting.js +74 -0
- package/dist/lint/diagnosticRouting.js.map +1 -0
- package/dist/lint/index.d.ts +49 -0
- package/dist/lint/index.js +96 -0
- package/dist/lint/index.js.map +1 -0
- package/dist/lint/lint-worker.d.ts +2 -0
- package/dist/lint/lint-worker.js +116 -0
- package/dist/lint/lint-worker.js.map +1 -0
- package/dist/lint/prefilter.d.ts +7 -0
- package/dist/lint/prefilter.js +31 -0
- package/dist/lint/prefilter.js.map +1 -0
- package/dist/lint/session-protocol.d.ts +38 -0
- package/dist/lint/session-protocol.js +11 -0
- package/dist/lint/session-protocol.js.map +1 -0
- package/dist/lint/session.d.ts +27 -0
- package/dist/lint/session.js +149 -0
- package/dist/lint/session.js.map +1 -0
- package/dist/lint/spawn-shim.d.ts +2 -0
- package/dist/lint/spawn-shim.js +23 -0
- package/dist/lint/spawn-shim.js.map +1 -0
- package/dist/next/index.d.ts +11 -0
- package/dist/next/index.js +17 -0
- package/dist/next/index.js.map +1 -0
- package/dist/options.d.ts +29 -0
- package/dist/options.js +36 -0
- package/dist/options.js.map +1 -0
- package/dist/runtypes/bun.d.ts +25 -0
- package/dist/runtypes/bun.js +62 -0
- package/dist/runtypes/bun.js.map +1 -0
- package/dist/runtypes/esbuild.d.ts +4 -0
- package/dist/runtypes/esbuild.js +4 -0
- package/dist/runtypes/esbuild.js.map +1 -0
- package/dist/runtypes/next/broker.d.ts +15 -0
- package/dist/runtypes/next/broker.js +316 -0
- package/dist/runtypes/next/broker.js.map +1 -0
- package/dist/runtypes/next/index.d.ts +30 -0
- package/dist/runtypes/next/index.js +57 -0
- package/dist/runtypes/next/index.js.map +1 -0
- package/dist/runtypes/next/loader.d.ts +13 -0
- package/dist/runtypes/next/loader.js +64 -0
- package/dist/runtypes/next/loader.js.map +1 -0
- package/dist/runtypes/next/wire.d.ts +17 -0
- package/dist/runtypes/next/wire.js +15 -0
- package/dist/runtypes/next/wire.js.map +1 -0
- package/dist/runtypes/rolldown.d.ts +4 -0
- package/dist/runtypes/rolldown.js +4 -0
- package/dist/runtypes/rolldown.js.map +1 -0
- package/dist/runtypes/rollup.d.ts +4 -0
- package/dist/runtypes/rollup.js +4 -0
- package/dist/runtypes/rollup.js.map +1 -0
- package/dist/runtypes/rspack.d.ts +4 -0
- package/dist/runtypes/rspack.js +4 -0
- package/dist/runtypes/rspack.js.map +1 -0
- package/dist/runtypes/vite.d.ts +4 -0
- package/dist/runtypes/vite.js +4 -0
- package/dist/runtypes/vite.js.map +1 -0
- package/dist/runtypes/webpack.d.ts +4 -0
- package/dist/runtypes/webpack.js +4 -0
- package/dist/runtypes/webpack.js.map +1 -0
- package/dist/vite/buildEntries.d.ts +2 -0
- package/dist/vite/buildEntries.js +28 -0
- package/dist/vite/buildEntries.js.map +1 -0
- package/dist/vite/cjsPackageJsonPlugin.d.ts +3 -0
- package/dist/vite/cjsPackageJsonPlugin.js +12 -0
- package/dist/vite/cjsPackageJsonPlugin.js.map +1 -0
- package/dist/vite/index.d.ts +6 -0
- package/dist/vite/index.js +5 -0
- package/dist/vite/index.js.map +1 -0
- package/dist/vite/middlewareMode.d.ts +10 -0
- package/dist/vite/middlewareMode.js +227 -0
- package/dist/vite/middlewareMode.js.map +1 -0
- package/dist/vite/mionVitePlugin.d.ts +23 -0
- package/dist/vite/mionVitePlugin.js +115 -0
- package/dist/vite/mionVitePlugin.js.map +1 -0
- package/dist/vite/nodeWebBridge.d.ts +5 -0
- package/dist/vite/nodeWebBridge.js +59 -0
- package/dist/vite/nodeWebBridge.js.map +1 -0
- package/dist/vite/sfcTransform.d.ts +8 -0
- package/dist/vite/sfcTransform.js +142 -0
- package/dist/vite/sfcTransform.js.map +1 -0
- package/oxlint-recommended.json +11 -0
- package/package.json +91 -56
- package/build/eslint/cjs/index.cjs +0 -41
- package/build/eslint/cjs/index.cjs.map +0 -1
- package/build/eslint/cjs/package.json +0 -1
- package/build/eslint/cjs/src/eslint/index.cjs +0 -13
- package/build/eslint/cjs/src/eslint/index.cjs.map +0 -1
- package/build/eslint/cjs/src/eslint/index.d.ts +0 -4
- package/build/eslint/cjs/src/eslint/index.d.ts.map +0 -1
- package/build/eslint/cjs/src/eslint/rules/enforce-type-imports.cjs +0 -121
- package/build/eslint/cjs/src/eslint/rules/enforce-type-imports.cjs.map +0 -1
- package/build/eslint/cjs/src/eslint/rules/enforce-type-imports.d.ts +0 -8
- package/build/eslint/cjs/src/eslint/rules/enforce-type-imports.d.ts.map +0 -1
- package/build/eslint/cjs/src/eslint/rules/formatTypeNames.cjs +0 -71
- package/build/eslint/cjs/src/eslint/rules/formatTypeNames.cjs.map +0 -1
- package/build/eslint/cjs/src/eslint/rules/formatTypeNames.d.ts +0 -4
- package/build/eslint/cjs/src/eslint/rules/formatTypeNames.d.ts.map +0 -1
- package/build/eslint/cjs/src/eslint/rules/no-mixed-union-properties.cjs +0 -220
- package/build/eslint/cjs/src/eslint/rules/no-mixed-union-properties.cjs.map +0 -1
- package/build/eslint/cjs/src/eslint/rules/no-mixed-union-properties.d.ts +0 -4
- package/build/eslint/cjs/src/eslint/rules/no-mixed-union-properties.d.ts.map +0 -1
- package/build/eslint/cjs/src/eslint/rules/no-type-imports.cjs +0 -251
- package/build/eslint/cjs/src/eslint/rules/no-type-imports.cjs.map +0 -1
- package/build/eslint/cjs/src/eslint/rules/no-type-imports.d.ts +0 -4
- package/build/eslint/cjs/src/eslint/rules/no-type-imports.d.ts.map +0 -1
- package/build/eslint/cjs/src/eslint/rules/no-typeof-runtype.cjs +0 -72
- package/build/eslint/cjs/src/eslint/rules/no-typeof-runtype.cjs.map +0 -1
- package/build/eslint/cjs/src/eslint/rules/no-typeof-runtype.d.ts +0 -4
- package/build/eslint/cjs/src/eslint/rules/no-typeof-runtype.d.ts.map +0 -1
- package/build/eslint/cjs/src/eslint/rules/no-unreachable-union-types.cjs +0 -220
- package/build/eslint/cjs/src/eslint/rules/no-unreachable-union-types.cjs.map +0 -1
- package/build/eslint/cjs/src/eslint/rules/no-unreachable-union-types.d.ts +0 -4
- package/build/eslint/cjs/src/eslint/rules/no-unreachable-union-types.d.ts.map +0 -1
- package/build/eslint/cjs/src/eslint/rules/no-vite-client.cjs +0 -71
- package/build/eslint/cjs/src/eslint/rules/no-vite-client.cjs.map +0 -1
- package/build/eslint/cjs/src/eslint/rules/no-vite-client.d.ts +0 -5
- package/build/eslint/cjs/src/eslint/rules/no-vite-client.d.ts.map +0 -1
- package/build/eslint/cjs/src/eslint/rules/pure-functions.cjs +0 -346
- package/build/eslint/cjs/src/eslint/rules/pure-functions.cjs.map +0 -1
- package/build/eslint/cjs/src/eslint/rules/pure-functions.d.ts +0 -5
- package/build/eslint/cjs/src/eslint/rules/pure-functions.d.ts.map +0 -1
- package/build/eslint/cjs/src/eslint/rules/strong-typed-routes.cjs +0 -328
- package/build/eslint/cjs/src/eslint/rules/strong-typed-routes.cjs.map +0 -1
- package/build/eslint/cjs/src/eslint/rules/strong-typed-routes.d.ts +0 -5
- package/build/eslint/cjs/src/eslint/rules/strong-typed-routes.d.ts.map +0 -1
- package/build/eslint/cjs/src/eslint/rules/type-formats-imports.cjs +0 -52
- package/build/eslint/cjs/src/eslint/rules/type-formats-imports.cjs.map +0 -1
- package/build/eslint/cjs/src/eslint/rules/type-formats-imports.d.ts +0 -4
- package/build/eslint/cjs/src/eslint/rules/type-formats-imports.d.ts.map +0 -1
- package/build/eslint/cjs/src/pureFns/purityRules.cjs +0 -67
- package/build/eslint/cjs/src/pureFns/purityRules.cjs.map +0 -1
- package/build/eslint/cjs/src/pureFns/purityRules.d.ts +0 -5
- package/build/eslint/cjs/src/pureFns/purityRules.d.ts.map +0 -1
- package/build/eslint/esm/index.js +0 -42
- package/build/eslint/esm/index.js.map +0 -1
- package/build/eslint/esm/src/eslint/index.d.ts +0 -4
- package/build/eslint/esm/src/eslint/index.d.ts.map +0 -1
- package/build/eslint/esm/src/eslint/index.js +0 -14
- package/build/eslint/esm/src/eslint/index.js.map +0 -1
- package/build/eslint/esm/src/eslint/rules/enforce-type-imports.d.ts +0 -8
- package/build/eslint/esm/src/eslint/rules/enforce-type-imports.d.ts.map +0 -1
- package/build/eslint/esm/src/eslint/rules/enforce-type-imports.js +0 -122
- package/build/eslint/esm/src/eslint/rules/enforce-type-imports.js.map +0 -1
- package/build/eslint/esm/src/eslint/rules/formatTypeNames.d.ts +0 -4
- package/build/eslint/esm/src/eslint/rules/formatTypeNames.d.ts.map +0 -1
- package/build/eslint/esm/src/eslint/rules/formatTypeNames.js +0 -71
- package/build/eslint/esm/src/eslint/rules/formatTypeNames.js.map +0 -1
- package/build/eslint/esm/src/eslint/rules/no-mixed-union-properties.d.ts +0 -4
- package/build/eslint/esm/src/eslint/rules/no-mixed-union-properties.d.ts.map +0 -1
- package/build/eslint/esm/src/eslint/rules/no-mixed-union-properties.js +0 -221
- package/build/eslint/esm/src/eslint/rules/no-mixed-union-properties.js.map +0 -1
- package/build/eslint/esm/src/eslint/rules/no-type-imports.d.ts +0 -4
- package/build/eslint/esm/src/eslint/rules/no-type-imports.d.ts.map +0 -1
- package/build/eslint/esm/src/eslint/rules/no-type-imports.js +0 -252
- package/build/eslint/esm/src/eslint/rules/no-type-imports.js.map +0 -1
- package/build/eslint/esm/src/eslint/rules/no-typeof-runtype.d.ts +0 -4
- package/build/eslint/esm/src/eslint/rules/no-typeof-runtype.d.ts.map +0 -1
- package/build/eslint/esm/src/eslint/rules/no-typeof-runtype.js +0 -73
- package/build/eslint/esm/src/eslint/rules/no-typeof-runtype.js.map +0 -1
- package/build/eslint/esm/src/eslint/rules/no-unreachable-union-types.d.ts +0 -4
- package/build/eslint/esm/src/eslint/rules/no-unreachable-union-types.d.ts.map +0 -1
- package/build/eslint/esm/src/eslint/rules/no-unreachable-union-types.js +0 -221
- package/build/eslint/esm/src/eslint/rules/no-unreachable-union-types.js.map +0 -1
- package/build/eslint/esm/src/eslint/rules/no-vite-client.d.ts +0 -5
- package/build/eslint/esm/src/eslint/rules/no-vite-client.d.ts.map +0 -1
- package/build/eslint/esm/src/eslint/rules/no-vite-client.js +0 -72
- package/build/eslint/esm/src/eslint/rules/no-vite-client.js.map +0 -1
- package/build/eslint/esm/src/eslint/rules/pure-functions.d.ts +0 -5
- package/build/eslint/esm/src/eslint/rules/pure-functions.d.ts.map +0 -1
- package/build/eslint/esm/src/eslint/rules/pure-functions.js +0 -347
- package/build/eslint/esm/src/eslint/rules/pure-functions.js.map +0 -1
- package/build/eslint/esm/src/eslint/rules/strong-typed-routes.d.ts +0 -5
- package/build/eslint/esm/src/eslint/rules/strong-typed-routes.d.ts.map +0 -1
- package/build/eslint/esm/src/eslint/rules/strong-typed-routes.js +0 -329
- package/build/eslint/esm/src/eslint/rules/strong-typed-routes.js.map +0 -1
- package/build/eslint/esm/src/eslint/rules/type-formats-imports.d.ts +0 -4
- package/build/eslint/esm/src/eslint/rules/type-formats-imports.d.ts.map +0 -1
- package/build/eslint/esm/src/eslint/rules/type-formats-imports.js +0 -53
- package/build/eslint/esm/src/eslint/rules/type-formats-imports.js.map +0 -1
- package/build/eslint/esm/src/pureFns/purityRules.d.ts +0 -5
- package/build/eslint/esm/src/pureFns/purityRules.d.ts.map +0 -1
- package/build/eslint/esm/src/pureFns/purityRules.js +0 -67
- package/build/eslint/esm/src/pureFns/purityRules.js.map +0 -1
- package/build/vite-plugin/cjs/index.cjs +0 -13
- package/build/vite-plugin/cjs/index.cjs.map +0 -1
- package/build/vite-plugin/cjs/package.json +0 -1
- package/build/vite-plugin/cjs/src/pureFns/purityRules.cjs +0 -65
- package/build/vite-plugin/cjs/src/pureFns/purityRules.cjs.map +0 -1
- package/build/vite-plugin/cjs/src/pureFns/purityRules.d.ts +0 -5
- package/build/vite-plugin/cjs/src/pureFns/purityRules.d.ts.map +0 -1
- package/build/vite-plugin/cjs/src/vite-plugin/aotCacheGenerator.cjs +0 -271
- package/build/vite-plugin/cjs/src/vite-plugin/aotCacheGenerator.cjs.map +0 -1
- package/build/vite-plugin/cjs/src/vite-plugin/aotCacheGenerator.d.ts +0 -32
- package/build/vite-plugin/cjs/src/vite-plugin/aotCacheGenerator.d.ts.map +0 -1
- package/build/vite-plugin/cjs/src/vite-plugin/aotDiskCache.cjs +0 -135
- package/build/vite-plugin/cjs/src/vite-plugin/aotDiskCache.cjs.map +0 -1
- package/build/vite-plugin/cjs/src/vite-plugin/aotDiskCache.d.ts +0 -7
- package/build/vite-plugin/cjs/src/vite-plugin/aotDiskCache.d.ts.map +0 -1
- package/build/vite-plugin/cjs/src/vite-plugin/cjsPackageJsonPlugin.cjs +0 -15
- package/build/vite-plugin/cjs/src/vite-plugin/cjsPackageJsonPlugin.cjs.map +0 -1
- package/build/vite-plugin/cjs/src/vite-plugin/cjsPackageJsonPlugin.d.ts +0 -3
- package/build/vite-plugin/cjs/src/vite-plugin/cjsPackageJsonPlugin.d.ts.map +0 -1
- package/build/vite-plugin/cjs/src/vite-plugin/constants.cjs +0 -29
- package/build/vite-plugin/cjs/src/vite-plugin/constants.cjs.map +0 -1
- package/build/vite-plugin/cjs/src/vite-plugin/constants.d.ts +0 -13
- package/build/vite-plugin/cjs/src/vite-plugin/constants.d.ts.map +0 -1
- package/build/vite-plugin/cjs/src/vite-plugin/extractPureFn.cjs +0 -628
- package/build/vite-plugin/cjs/src/vite-plugin/extractPureFn.cjs.map +0 -1
- package/build/vite-plugin/cjs/src/vite-plugin/extractPureFn.d.ts +0 -14
- package/build/vite-plugin/cjs/src/vite-plugin/extractPureFn.d.ts.map +0 -1
- package/build/vite-plugin/cjs/src/vite-plugin/index.cjs +0 -13
- package/build/vite-plugin/cjs/src/vite-plugin/index.cjs.map +0 -1
- package/build/vite-plugin/cjs/src/vite-plugin/index.d.ts +0 -6
- package/build/vite-plugin/cjs/src/vite-plugin/index.d.ts.map +0 -1
- package/build/vite-plugin/cjs/src/vite-plugin/mionVitePlugin.cjs +0 -511
- package/build/vite-plugin/cjs/src/vite-plugin/mionVitePlugin.cjs.map +0 -1
- package/build/vite-plugin/cjs/src/vite-plugin/mionVitePlugin.d.ts +0 -37
- package/build/vite-plugin/cjs/src/vite-plugin/mionVitePlugin.d.ts.map +0 -1
- package/build/vite-plugin/cjs/src/vite-plugin/resolveModule.cjs +0 -55
- package/build/vite-plugin/cjs/src/vite-plugin/resolveModule.cjs.map +0 -1
- package/build/vite-plugin/cjs/src/vite-plugin/resolveModule.d.ts +0 -2
- package/build/vite-plugin/cjs/src/vite-plugin/resolveModule.d.ts.map +0 -1
- package/build/vite-plugin/cjs/src/vite-plugin/transformers.cjs +0 -166
- package/build/vite-plugin/cjs/src/vite-plugin/transformers.cjs.map +0 -1
- package/build/vite-plugin/cjs/src/vite-plugin/transformers.d.ts +0 -11
- package/build/vite-plugin/cjs/src/vite-plugin/transformers.d.ts.map +0 -1
- package/build/vite-plugin/cjs/src/vite-plugin/types.cjs +0 -2
- package/build/vite-plugin/cjs/src/vite-plugin/types.cjs.map +0 -1
- package/build/vite-plugin/cjs/src/vite-plugin/types.d.ts +0 -60
- package/build/vite-plugin/cjs/src/vite-plugin/types.d.ts.map +0 -1
- package/build/vite-plugin/cjs/src/vite-plugin/virtual-modules.d.cjs +0 -2
- package/build/vite-plugin/cjs/src/vite-plugin/virtual-modules.d.cjs.map +0 -1
- package/build/vite-plugin/cjs/src/vite-plugin/virtualModule.cjs +0 -69
- package/build/vite-plugin/cjs/src/vite-plugin/virtualModule.cjs.map +0 -1
- package/build/vite-plugin/cjs/src/vite-plugin/virtualModule.d.ts +0 -3
- package/build/vite-plugin/cjs/src/vite-plugin/virtualModule.d.ts.map +0 -1
- package/build/vite-plugin/esm/index.js +0 -13
- package/build/vite-plugin/esm/index.js.map +0 -1
- package/build/vite-plugin/esm/src/pureFns/purityRules.d.ts +0 -5
- package/build/vite-plugin/esm/src/pureFns/purityRules.d.ts.map +0 -1
- package/build/vite-plugin/esm/src/pureFns/purityRules.js +0 -65
- package/build/vite-plugin/esm/src/pureFns/purityRules.js.map +0 -1
- package/build/vite-plugin/esm/src/vite-plugin/aotCacheGenerator.d.ts +0 -32
- package/build/vite-plugin/esm/src/vite-plugin/aotCacheGenerator.d.ts.map +0 -1
- package/build/vite-plugin/esm/src/vite-plugin/aotCacheGenerator.js +0 -271
- package/build/vite-plugin/esm/src/vite-plugin/aotCacheGenerator.js.map +0 -1
- package/build/vite-plugin/esm/src/vite-plugin/aotDiskCache.d.ts +0 -7
- package/build/vite-plugin/esm/src/vite-plugin/aotDiskCache.d.ts.map +0 -1
- package/build/vite-plugin/esm/src/vite-plugin/aotDiskCache.js +0 -134
- package/build/vite-plugin/esm/src/vite-plugin/aotDiskCache.js.map +0 -1
- package/build/vite-plugin/esm/src/vite-plugin/cjsPackageJsonPlugin.d.ts +0 -3
- package/build/vite-plugin/esm/src/vite-plugin/cjsPackageJsonPlugin.d.ts.map +0 -1
- package/build/vite-plugin/esm/src/vite-plugin/cjsPackageJsonPlugin.js +0 -15
- package/build/vite-plugin/esm/src/vite-plugin/cjsPackageJsonPlugin.js.map +0 -1
- package/build/vite-plugin/esm/src/vite-plugin/constants.d.ts +0 -13
- package/build/vite-plugin/esm/src/vite-plugin/constants.d.ts.map +0 -1
- package/build/vite-plugin/esm/src/vite-plugin/constants.js +0 -29
- package/build/vite-plugin/esm/src/vite-plugin/constants.js.map +0 -1
- package/build/vite-plugin/esm/src/vite-plugin/extractPureFn.d.ts +0 -14
- package/build/vite-plugin/esm/src/vite-plugin/extractPureFn.d.ts.map +0 -1
- package/build/vite-plugin/esm/src/vite-plugin/extractPureFn.js +0 -611
- package/build/vite-plugin/esm/src/vite-plugin/extractPureFn.js.map +0 -1
- package/build/vite-plugin/esm/src/vite-plugin/index.d.ts +0 -6
- package/build/vite-plugin/esm/src/vite-plugin/index.d.ts.map +0 -1
- package/build/vite-plugin/esm/src/vite-plugin/index.js +0 -13
- package/build/vite-plugin/esm/src/vite-plugin/index.js.map +0 -1
- package/build/vite-plugin/esm/src/vite-plugin/mionVitePlugin.d.ts +0 -37
- package/build/vite-plugin/esm/src/vite-plugin/mionVitePlugin.d.ts.map +0 -1
- package/build/vite-plugin/esm/src/vite-plugin/mionVitePlugin.js +0 -493
- package/build/vite-plugin/esm/src/vite-plugin/mionVitePlugin.js.map +0 -1
- package/build/vite-plugin/esm/src/vite-plugin/resolveModule.d.ts +0 -2
- package/build/vite-plugin/esm/src/vite-plugin/resolveModule.d.ts.map +0 -1
- package/build/vite-plugin/esm/src/vite-plugin/resolveModule.js +0 -33
- package/build/vite-plugin/esm/src/vite-plugin/resolveModule.js.map +0 -1
- package/build/vite-plugin/esm/src/vite-plugin/transformers.d.ts +0 -11
- package/build/vite-plugin/esm/src/vite-plugin/transformers.d.ts.map +0 -1
- package/build/vite-plugin/esm/src/vite-plugin/transformers.js +0 -149
- package/build/vite-plugin/esm/src/vite-plugin/transformers.js.map +0 -1
- package/build/vite-plugin/esm/src/vite-plugin/types.d.ts +0 -60
- package/build/vite-plugin/esm/src/vite-plugin/types.d.ts.map +0 -1
- package/build/vite-plugin/esm/src/vite-plugin/types.js +0 -2
- package/build/vite-plugin/esm/src/vite-plugin/types.js.map +0 -1
- package/build/vite-plugin/esm/src/vite-plugin/virtual-modules.d.js +0 -2
- package/build/vite-plugin/esm/src/vite-plugin/virtual-modules.d.js.map +0 -1
- package/build/vite-plugin/esm/src/vite-plugin/virtualModule.d.ts +0 -3
- package/build/vite-plugin/esm/src/vite-plugin/virtualModule.d.ts.map +0 -1
- package/build/vite-plugin/esm/src/vite-plugin/virtualModule.js +0 -69
- package/build/vite-plugin/esm/src/vite-plugin/virtualModule.js.map +0 -1
- package/src/eslint/index.ts +0 -53
- package/src/eslint/rules/enforce-type-imports.ts +0 -157
- package/src/eslint/rules/formatTypeNames.ts +0 -92
- package/src/eslint/rules/no-mixed-union-properties.ts +0 -276
- package/src/eslint/rules/no-type-imports.ts +0 -386
- package/src/eslint/rules/no-typeof-runtype.ts +0 -112
- package/src/eslint/rules/no-unreachable-union-types.ts +0 -357
- package/src/eslint/rules/no-vite-client.ts +0 -101
- package/src/eslint/rules/pure-functions.ts +0 -523
- package/src/eslint/rules/strong-typed-routes.ts +0 -537
- package/src/eslint/rules/type-formats-imports.ts +0 -73
- package/src/pureFns/purityRules.ts +0 -76
- package/src/vite-plugin/README.md +0 -399
- package/src/vite-plugin/aotCacheGenerator.ts +0 -397
- package/src/vite-plugin/aotDiskCache.ts +0 -193
- package/src/vite-plugin/cjsPackageJsonPlugin.ts +0 -21
- package/src/vite-plugin/constants.ts +0 -50
- package/src/vite-plugin/extractPureFn.ts +0 -845
- package/src/vite-plugin/index.ts +0 -27
- package/src/vite-plugin/mionVitePlugin.ts +0 -738
- package/src/vite-plugin/resolveModule.ts +0 -50
- package/src/vite-plugin/transformers.ts +0 -209
- package/src/vite-plugin/types.ts +0 -182
- package/src/vite-plugin/virtual-modules.d.ts +0 -48
- package/src/vite-plugin/virtualModule.ts +0 -94
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { DeepkitTypeOptions, ExtractedPureFn } from './types.ts';
|
|
2
|
-
import * as ts from 'typescript';
|
|
3
|
-
export interface DeepkitConfig {
|
|
4
|
-
filter: (fileName: string) => boolean;
|
|
5
|
-
compilerOptions: ts.CompilerOptions;
|
|
6
|
-
beforeTransformers: ts.CustomTransformerFactory[];
|
|
7
|
-
afterTransformers: ts.CustomTransformerFactory[];
|
|
8
|
-
}
|
|
9
|
-
export declare function createDeepkitConfig(options?: DeepkitTypeOptions): DeepkitConfig;
|
|
10
|
-
export declare function createPureFnTransformerFactory(originalSource: string, filePath: string, collector?: ExtractedPureFn[], noViteClient?: boolean): ts.CustomTransformerFactory;
|
|
11
|
-
//# sourceMappingURL=transformers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transformers.d.ts","sourceRoot":"","sources":["../../../../../src/vite-plugin/transformers.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAC,kBAAkB,EAAE,eAAe,EAAC,MAAM,YAAY,CAAC;AAM/D,MAAM,WAAW,aAAa;IAC1B,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;IACtC,eAAe,EAAE,EAAE,CAAC,eAAe,CAAC;IACpC,kBAAkB,EAAE,EAAE,CAAC,wBAAwB,EAAE,CAAC;IAClD,iBAAiB,EAAE,EAAE,CAAC,wBAAwB,EAAE,CAAC;CACpD;AAwED,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,kBAAuB,GAAG,aAAa,CAcnF;AAYD,wBAAgB,8BAA8B,CAC1C,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,eAAe,EAAE,EAC7B,YAAY,UAAQ,GACrB,EAAE,CAAC,wBAAwB,CAsE7B"}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { createFilter } from "@rollup/pluginutils";
|
|
2
|
-
import * as ts from "typescript";
|
|
3
|
-
import { declarationTransformer, transformer } from "@deepkit/type-compiler";
|
|
4
|
-
import { extractPureFnsFromSource } from "./extractPureFn.js";
|
|
5
|
-
const requireToImport = (context) => ({
|
|
6
|
-
transformSourceFile(sf) {
|
|
7
|
-
const newStatements = [];
|
|
8
|
-
let changed = false;
|
|
9
|
-
for (const stmt of sf.statements) {
|
|
10
|
-
const converted = tryConvertRequireToImport(context.factory, stmt);
|
|
11
|
-
if (converted) {
|
|
12
|
-
newStatements.push(converted);
|
|
13
|
-
changed = true;
|
|
14
|
-
} else {
|
|
15
|
-
newStatements.push(stmt);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return changed ? context.factory.updateSourceFile(sf, newStatements) : sf;
|
|
19
|
-
},
|
|
20
|
-
transformBundle(b) {
|
|
21
|
-
return b;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
function tryConvertRequireToImport(f, stmt) {
|
|
25
|
-
if (!ts.isVariableStatement(stmt)) return void 0;
|
|
26
|
-
const decls = stmt.declarationList.declarations;
|
|
27
|
-
if (decls.length !== 1) return void 0;
|
|
28
|
-
const decl = decls[0];
|
|
29
|
-
if (!decl.initializer || !ts.isCallExpression(decl.initializer)) return void 0;
|
|
30
|
-
const callee = decl.initializer.expression;
|
|
31
|
-
if (!ts.isIdentifier(callee) || callee.text !== "require") return void 0;
|
|
32
|
-
if (decl.initializer.arguments.length !== 1) return void 0;
|
|
33
|
-
const specArg = decl.initializer.arguments[0];
|
|
34
|
-
if (!ts.isStringLiteral(specArg)) return void 0;
|
|
35
|
-
if (ts.isObjectBindingPattern(decl.name)) {
|
|
36
|
-
const specifiers = decl.name.elements.map(
|
|
37
|
-
(el) => f.createImportSpecifier(false, void 0, f.createIdentifier(el.name.text))
|
|
38
|
-
);
|
|
39
|
-
return f.createImportDeclaration(
|
|
40
|
-
void 0,
|
|
41
|
-
f.createImportClause(false, void 0, f.createNamedImports(specifiers)),
|
|
42
|
-
f.createStringLiteral(specArg.text)
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
if (ts.isIdentifier(decl.name)) {
|
|
46
|
-
return f.createImportDeclaration(
|
|
47
|
-
void 0,
|
|
48
|
-
f.createImportClause(false, f.createIdentifier(decl.name.text), void 0),
|
|
49
|
-
f.createStringLiteral(specArg.text)
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
return void 0;
|
|
53
|
-
}
|
|
54
|
-
function createDeepkitConfig(options = {}) {
|
|
55
|
-
const filter = createFilter(options.include ?? ["**/*.tsx", "**/*.ts"], options.exclude ?? "node_modules/**");
|
|
56
|
-
return {
|
|
57
|
-
filter: (fileName) => filter(fileName),
|
|
58
|
-
compilerOptions: {
|
|
59
|
-
target: ts.ScriptTarget.ESNext,
|
|
60
|
-
module: ts.ModuleKind.ESNext,
|
|
61
|
-
sourceMap: true,
|
|
62
|
-
configFilePath: options.tsConfig || process.cwd() + "/tsconfig.json",
|
|
63
|
-
...options.compilerOptions || {}
|
|
64
|
-
},
|
|
65
|
-
beforeTransformers: [transformer],
|
|
66
|
-
afterTransformers: [declarationTransformer, requireToImport]
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
function createPureFnTransformerFactory(originalSource, filePath, collector, noViteClient = false) {
|
|
70
|
-
const hasPureServerFn = originalSource.includes("pureServerFn");
|
|
71
|
-
const hasFactory = originalSource.includes("registerPureFnFactory");
|
|
72
|
-
const hasMapFrom = originalSource.includes("mapFrom");
|
|
73
|
-
const pureServerFns = hasPureServerFn ? extractPureFnsFromSource(originalSource, filePath, "pureServerFn", noViteClient) : [];
|
|
74
|
-
const factoryFns = hasFactory ? extractPureFnsFromSource(originalSource, filePath, "registerPureFnFactory") : [];
|
|
75
|
-
const mapFromFns = hasMapFrom ? extractPureFnsFromSource(originalSource, filePath, "mapFrom", noViteClient) : [];
|
|
76
|
-
return (context) => {
|
|
77
|
-
let pureIdx = 0;
|
|
78
|
-
let factoryIdx = 0;
|
|
79
|
-
let mapFromIdx = 0;
|
|
80
|
-
function visitor(node) {
|
|
81
|
-
if (ts.isCallExpression(node)) {
|
|
82
|
-
const callee = node.expression;
|
|
83
|
-
if (ts.isIdentifier(callee)) {
|
|
84
|
-
if (callee.text === "pureServerFn" && pureIdx < pureServerFns.length) {
|
|
85
|
-
if (node.arguments.length >= 2) {
|
|
86
|
-
pureIdx++;
|
|
87
|
-
return ts.visitEachChild(node, visitor, context);
|
|
88
|
-
}
|
|
89
|
-
const data = pureServerFns[pureIdx++];
|
|
90
|
-
collector?.push(data);
|
|
91
|
-
return context.factory.updateCallExpression(node, node.expression, node.typeArguments, [
|
|
92
|
-
...node.arguments,
|
|
93
|
-
context.factory.createStringLiteral(data.bodyHash)
|
|
94
|
-
]);
|
|
95
|
-
}
|
|
96
|
-
if (callee.text === "registerPureFnFactory" && factoryIdx < factoryFns.length) {
|
|
97
|
-
if (node.arguments.length >= 4) {
|
|
98
|
-
factoryIdx++;
|
|
99
|
-
return ts.visitEachChild(node, visitor, context);
|
|
100
|
-
}
|
|
101
|
-
const data = factoryFns[factoryIdx++];
|
|
102
|
-
collector?.push(data);
|
|
103
|
-
return context.factory.updateCallExpression(node, node.expression, node.typeArguments, [
|
|
104
|
-
...node.arguments,
|
|
105
|
-
createParsedFactoryFnNode(context.factory, data)
|
|
106
|
-
]);
|
|
107
|
-
}
|
|
108
|
-
if (callee.text === "mapFrom" && mapFromIdx < mapFromFns.length) {
|
|
109
|
-
if (node.arguments.length >= 3) {
|
|
110
|
-
mapFromIdx++;
|
|
111
|
-
return ts.visitEachChild(node, visitor, context);
|
|
112
|
-
}
|
|
113
|
-
const data = mapFromFns[mapFromIdx++];
|
|
114
|
-
collector?.push(data);
|
|
115
|
-
return context.factory.updateCallExpression(node, node.expression, node.typeArguments, [
|
|
116
|
-
...node.arguments,
|
|
117
|
-
context.factory.createStringLiteral(data.bodyHash)
|
|
118
|
-
]);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
return ts.visitEachChild(node, visitor, context);
|
|
123
|
-
}
|
|
124
|
-
return {
|
|
125
|
-
transformSourceFile(sourceFile) {
|
|
126
|
-
if (pureServerFns.length === 0 && factoryFns.length === 0 && mapFromFns.length === 0) return sourceFile;
|
|
127
|
-
return ts.visitNode(sourceFile, visitor);
|
|
128
|
-
},
|
|
129
|
-
transformBundle(bundle) {
|
|
130
|
-
return bundle;
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
function createParsedFactoryFnNode(factory, data) {
|
|
136
|
-
return factory.createObjectLiteralExpression([
|
|
137
|
-
factory.createPropertyAssignment("bodyHash", factory.createStringLiteral(data.bodyHash)),
|
|
138
|
-
factory.createPropertyAssignment(
|
|
139
|
-
"paramNames",
|
|
140
|
-
factory.createArrayLiteralExpression(data.paramNames.map((n) => factory.createStringLiteral(n)))
|
|
141
|
-
),
|
|
142
|
-
factory.createPropertyAssignment("code", factory.createStringLiteral(data.fnBody))
|
|
143
|
-
]);
|
|
144
|
-
}
|
|
145
|
-
export {
|
|
146
|
-
createDeepkitConfig,
|
|
147
|
-
createPureFnTransformerFactory
|
|
148
|
-
};
|
|
149
|
-
//# sourceMappingURL=transformers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transformers.js","sources":["../../../../../src/vite-plugin/transformers.ts"],"sourcesContent":["/* ########\n * 2026 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\n// based on https://github.com/marcj/deepkit/blob/e7da3b48c50115d6e59e233eb9f018513d4d68ce/packages/vite/src/plugin.ts\n\nimport {createFilter} from '@rollup/pluginutils';\nimport * as ts from 'typescript';\nimport {transformer, declarationTransformer} from '@deepkit/type-compiler';\nimport {DeepkitTypeOptions, ExtractedPureFn} from './types.ts';\nimport {extractPureFnsFromSource} from './extractPureFn.ts';\n\n// ── Deepkit ─────────────────────────────────────────────────────────\n\n/** Deepkit configuration components for integration into the unified transform pipeline */\nexport interface DeepkitConfig {\n filter: (fileName: string) => boolean;\n compilerOptions: ts.CompilerOptions;\n beforeTransformers: ts.CustomTransformerFactory[];\n afterTransformers: ts.CustomTransformerFactory[];\n}\n\n/**\n * Post-deepkit transformer that converts require() calls back to import declarations.\n * Deepkit's getModuleType() reads tsconfig's module:NodeNext and falls back to 'cjs'\n * because ts.transpileModule doesn't set sourceFile.impliedNodeFormat. This causes\n * deepkit to emit `var {__ΩFoo} = require(\"./bar.ts\")` instead of ESM imports.\n * This transformer converts those back to `import {__ΩFoo} from \"./bar.ts\"` so Rollup\n * can properly resolve and rewrite the module specifiers.\n */\nconst requireToImport: ts.CustomTransformerFactory = (context: ts.TransformationContext): ts.CustomTransformer => ({\n transformSourceFile(sf: ts.SourceFile): ts.SourceFile {\n const newStatements: ts.Statement[] = [];\n let changed = false;\n for (const stmt of sf.statements) {\n const converted = tryConvertRequireToImport(context.factory, stmt);\n if (converted) {\n newStatements.push(converted);\n changed = true;\n } else {\n newStatements.push(stmt);\n }\n }\n return changed ? context.factory.updateSourceFile(sf, newStatements) : sf;\n },\n transformBundle(b: ts.Bundle): ts.Bundle {\n return b;\n },\n});\n\n/**\n * Converts CJS require patterns to ESM import declarations:\n * - `var {a, b} = require(\"./path\")` → `import {a, b} from \"./path\"`\n * - `var mod = require(\"./path\")` → `import mod from \"./path\"`\n */\nfunction tryConvertRequireToImport(f: ts.NodeFactory, stmt: ts.Statement): ts.ImportDeclaration | undefined {\n if (!ts.isVariableStatement(stmt)) return undefined;\n const decls = stmt.declarationList.declarations;\n if (decls.length !== 1) return undefined;\n const decl = decls[0];\n if (!decl.initializer || !ts.isCallExpression(decl.initializer)) return undefined;\n const callee = decl.initializer.expression;\n if (!ts.isIdentifier(callee) || callee.text !== 'require') return undefined;\n if (decl.initializer.arguments.length !== 1) return undefined;\n const specArg = decl.initializer.arguments[0];\n if (!ts.isStringLiteral(specArg)) return undefined;\n\n // var {a, b} = require(\"./path\") → import {a, b} from \"./path\"\n if (ts.isObjectBindingPattern(decl.name)) {\n const specifiers = decl.name.elements.map((el) =>\n f.createImportSpecifier(false, undefined, f.createIdentifier((el.name as ts.Identifier).text))\n );\n return f.createImportDeclaration(\n undefined,\n f.createImportClause(false, undefined, f.createNamedImports(specifiers)),\n f.createStringLiteral(specArg.text)\n );\n }\n\n // var mod = require(\"./path\") → import mod from \"./path\"\n if (ts.isIdentifier(decl.name)) {\n return f.createImportDeclaration(\n undefined,\n f.createImportClause(false, f.createIdentifier(decl.name.text), undefined),\n f.createStringLiteral(specArg.text)\n );\n }\n\n return undefined;\n}\n\n/** Creates deepkit config components that can be integrated into a unified ts.transpileModule call */\nexport function createDeepkitConfig(options: DeepkitTypeOptions = {}): DeepkitConfig {\n const filter = createFilter(options.include ?? ['**/*.tsx', '**/*.ts'], options.exclude ?? 'node_modules/**');\n return {\n filter: (fileName: string) => filter(fileName),\n compilerOptions: {\n target: ts.ScriptTarget.ESNext,\n module: ts.ModuleKind.ESNext,\n sourceMap: true,\n configFilePath: options.tsConfig || process.cwd() + '/tsconfig.json',\n ...(options.compilerOptions || {}),\n },\n beforeTransformers: [transformer],\n afterTransformers: [declarationTransformer, requireToImport],\n };\n}\n\n// ── Pure function transformer ───────────────────────────────────────\n\n/**\n * Creates a TypeScript CustomTransformerFactory that injects build-time data into pure function calls.\n * For pureServerFn(def): injects bodyHash as 2nd argument.\n * For registerPureFnFactory(ns, id, fn): injects ParsedFactoryFn as 4th argument.\n *\n * Pre-extracts data using existing extractPureFnsFromSource to ensure hash consistency\n * with the virtual module cache (same whole-file esbuild strip + JS AST path).\n */\nexport function createPureFnTransformerFactory(\n originalSource: string,\n filePath: string,\n collector?: ExtractedPureFn[],\n noViteClient = false\n): ts.CustomTransformerFactory {\n const hasPureServerFn = originalSource.includes('pureServerFn');\n const hasFactory = originalSource.includes('registerPureFnFactory');\n const hasMapFrom = originalSource.includes('mapFrom');\n\n const pureServerFns = hasPureServerFn ? extractPureFnsFromSource(originalSource, filePath, 'pureServerFn', noViteClient) : [];\n const factoryFns = hasFactory ? extractPureFnsFromSource(originalSource, filePath, 'registerPureFnFactory') : [];\n const mapFromFns = hasMapFrom ? extractPureFnsFromSource(originalSource, filePath, 'mapFrom', noViteClient) : [];\n\n return (context: ts.TransformationContext): ts.CustomTransformer => {\n let pureIdx = 0;\n let factoryIdx = 0;\n let mapFromIdx = 0;\n\n function visitor(node: ts.Node): ts.Node {\n if (ts.isCallExpression(node)) {\n const callee = node.expression;\n if (ts.isIdentifier(callee)) {\n if (callee.text === 'pureServerFn' && pureIdx < pureServerFns.length) {\n if (node.arguments.length >= 2) {\n pureIdx++;\n return ts.visitEachChild(node, visitor, context);\n }\n const data = pureServerFns[pureIdx++];\n collector?.push(data);\n return context.factory.updateCallExpression(node, node.expression, node.typeArguments, [\n ...node.arguments,\n context.factory.createStringLiteral(data.bodyHash),\n ]);\n }\n if (callee.text === 'registerPureFnFactory' && factoryIdx < factoryFns.length) {\n if (node.arguments.length >= 4) {\n factoryIdx++;\n return ts.visitEachChild(node, visitor, context);\n }\n const data = factoryFns[factoryIdx++];\n collector?.push(data);\n return context.factory.updateCallExpression(node, node.expression, node.typeArguments, [\n ...node.arguments,\n createParsedFactoryFnNode(context.factory, data),\n ]);\n }\n if (callee.text === 'mapFrom' && mapFromIdx < mapFromFns.length) {\n // mapFrom(source, mapper) -> mapFrom(source, mapper, 'bodyHash')\n if (node.arguments.length >= 3) {\n mapFromIdx++;\n return ts.visitEachChild(node, visitor, context);\n }\n const data = mapFromFns[mapFromIdx++];\n collector?.push(data);\n return context.factory.updateCallExpression(node, node.expression, node.typeArguments, [\n ...node.arguments,\n context.factory.createStringLiteral(data.bodyHash),\n ]);\n }\n }\n }\n return ts.visitEachChild(node, visitor, context);\n }\n\n return {\n transformSourceFile(sourceFile: ts.SourceFile): ts.SourceFile {\n if (pureServerFns.length === 0 && factoryFns.length === 0 && mapFromFns.length === 0) return sourceFile;\n return ts.visitNode(sourceFile, visitor) as ts.SourceFile;\n },\n transformBundle(bundle: ts.Bundle): ts.Bundle {\n return bundle;\n },\n };\n };\n}\n\n/** Creates an AST node for {bodyHash: '...', paramNames: [...], code: '...'} */\nfunction createParsedFactoryFnNode(factory: ts.NodeFactory, data: ExtractedPureFn): ts.ObjectLiteralExpression {\n return factory.createObjectLiteralExpression([\n factory.createPropertyAssignment('bodyHash', factory.createStringLiteral(data.bodyHash)),\n factory.createPropertyAssignment(\n 'paramNames',\n factory.createArrayLiteralExpression(data.paramNames.map((n) => factory.createStringLiteral(n)))\n ),\n factory.createPropertyAssignment('code', factory.createStringLiteral(data.fnBody)),\n ]);\n}\n"],"names":[],"mappings":";;;;AAiCA,MAAM,kBAA+C,CAAC,aAA6D;AAAA,EAC/G,oBAAoB,IAAkC;AAClD,UAAM,gBAAgC,CAAA;AACtC,QAAI,UAAU;AACd,eAAW,QAAQ,GAAG,YAAY;AAC9B,YAAM,YAAY,0BAA0B,QAAQ,SAAS,IAAI;AACjE,UAAI,WAAW;AACX,sBAAc,KAAK,SAAS;AAC5B,kBAAU;AAAA,MACd,OAAO;AACH,sBAAc,KAAK,IAAI;AAAA,MAC3B;AAAA,IACJ;AACA,WAAO,UAAU,QAAQ,QAAQ,iBAAiB,IAAI,aAAa,IAAI;AAAA,EAC3E;AAAA,EACA,gBAAgB,GAAyB;AACrC,WAAO;AAAA,EACX;AACJ;AAOA,SAAS,0BAA0B,GAAmB,MAAsD;AACxG,MAAI,CAAC,GAAG,oBAAoB,IAAI,EAAG,QAA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,oBAAoB,CAAC,CAAC,CAAC;AAAA,IAAA;AAAA,IAEnG,QAAQ,yBAAyB,QAAQ,QAAQ,oBAAoB,KAAK,MAAM,CAAC;AAAA,EAAA,CACpF;AACL;"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { CompilerOptions } from 'typescript';
|
|
2
|
-
export interface AOTCacheOptions {
|
|
3
|
-
excludedFns?: string[];
|
|
4
|
-
excludedPureFns?: string[];
|
|
5
|
-
cache?: boolean | string;
|
|
6
|
-
excludeReflection?: boolean;
|
|
7
|
-
customVirtualModuleId?: string;
|
|
8
|
-
isClient?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export interface MionServerConfig {
|
|
11
|
-
startScript: string;
|
|
12
|
-
viteConfig?: string;
|
|
13
|
-
runMode: 'buildOnly' | 'childProcess' | 'middleware';
|
|
14
|
-
waitTimeout?: number;
|
|
15
|
-
env?: Record<string, string>;
|
|
16
|
-
args?: string[];
|
|
17
|
-
}
|
|
18
|
-
export interface PureServerFnRegistryEntry {
|
|
19
|
-
readonly namespace: string;
|
|
20
|
-
readonly fnName: string;
|
|
21
|
-
readonly paramNames: string[];
|
|
22
|
-
readonly code: string;
|
|
23
|
-
readonly bodyHash: string;
|
|
24
|
-
readonly dependencies: Set<string>;
|
|
25
|
-
readonly isFactory: boolean;
|
|
26
|
-
}
|
|
27
|
-
export interface PureServerFnRegistry {
|
|
28
|
-
readonly version: string;
|
|
29
|
-
readonly entries: Record<string, PureServerFnRegistryEntry>;
|
|
30
|
-
}
|
|
31
|
-
export interface ServerPureFunctionsOptions {
|
|
32
|
-
clientSrcPath: string;
|
|
33
|
-
include?: string[];
|
|
34
|
-
exclude?: string[];
|
|
35
|
-
noViteClient?: boolean;
|
|
36
|
-
}
|
|
37
|
-
export interface ExtractedPureFn {
|
|
38
|
-
namespace: string;
|
|
39
|
-
fnName: string;
|
|
40
|
-
paramNames: string[];
|
|
41
|
-
fnBody: string;
|
|
42
|
-
bodyHash: string;
|
|
43
|
-
dependencies: Set<string>;
|
|
44
|
-
sourceFile: string;
|
|
45
|
-
isFactory: boolean;
|
|
46
|
-
}
|
|
47
|
-
export interface ParsedFactoryFn {
|
|
48
|
-
readonly bodyHash: string;
|
|
49
|
-
readonly paramNames: string[];
|
|
50
|
-
readonly code: string;
|
|
51
|
-
}
|
|
52
|
-
export type ReflectionMode = 'default' | 'explicit' | 'never';
|
|
53
|
-
export interface DeepkitTypeOptions {
|
|
54
|
-
include?: string | string[];
|
|
55
|
-
exclude?: string | string[];
|
|
56
|
-
tsConfig?: string;
|
|
57
|
-
reflection?: ReflectionMode;
|
|
58
|
-
compilerOptions?: CompilerOptions;
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/vite-plugin/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;AAG3C,MAAM,WAAW,eAAe;IAE5B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IAGvB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAY3B,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAWzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAa5B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAO/B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAGD,MAAM,WAAW,gBAAgB;IAW7B,WAAW,EAAE,MAAM,CAAC;IAQpB,UAAU,CAAC,EAAE,MAAM,CAAC;IAQpB,OAAO,EAAE,WAAW,GAAG,cAAc,GAAG,YAAY,CAAC;IAKrD,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAG7B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAGD,MAAM,WAAW,yBAAyB;I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,WAAW,kBAAkB;IAE/B,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAG5B,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAMlB,UAAU,CAAC,EAAE,cAAc,CAAC;IAE5B,eAAe,CAAC,EAAE,eAAe,CAAC;CACrC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-modules.d.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"virtualModule.d.ts","sourceRoot":"","sources":["../../../../../src/vite-plugin/virtualModule.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;AAG3C,wBAAgB,kCAAkC,CAAC,YAAY,EAAE,eAAe,EAAE,GAAG,MAAM,CAuB1F"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
function generateServerPureFnsVirtualModule(extractedFns) {
|
|
2
|
-
const byNamespace = /* @__PURE__ */ new Map();
|
|
3
|
-
for (const fn of extractedFns) {
|
|
4
|
-
const list = byNamespace.get(fn.namespace) || [];
|
|
5
|
-
list.push(fn);
|
|
6
|
-
byNamespace.set(fn.namespace, list);
|
|
7
|
-
}
|
|
8
|
-
const namespaceEntries = [];
|
|
9
|
-
for (const [namespace, fns] of byNamespace) {
|
|
10
|
-
const fnEntries = fns.map((fn) => generateEntryCode(fn));
|
|
11
|
-
namespaceEntries.push(` ${JSON.stringify(namespace)}: {
|
|
12
|
-
${fnEntries.join(",\n")}
|
|
13
|
-
}`);
|
|
14
|
-
}
|
|
15
|
-
return `// Auto-generated by @mionjs/server-pure-functions
|
|
16
|
-
// Do not edit manually
|
|
17
|
-
|
|
18
|
-
export const serverPureFnsCache = {
|
|
19
|
-
${namespaceEntries.join(",\n")}
|
|
20
|
-
};
|
|
21
|
-
`;
|
|
22
|
-
}
|
|
23
|
-
function generateEntryCode(fn) {
|
|
24
|
-
const paramsArray = fn.paramNames.map((p) => JSON.stringify(p)).join(", ");
|
|
25
|
-
const depsArray = [...fn.dependencies].map((d) => {
|
|
26
|
-
const parts = d.split("::");
|
|
27
|
-
return JSON.stringify(parts.length === 2 ? parts[1] : d);
|
|
28
|
-
});
|
|
29
|
-
const fnCode = fn.isFactory ? generateFactoryFn(fn) : generateDirectFn(fn);
|
|
30
|
-
const depsLine = depsArray.length > 0 ? `
|
|
31
|
-
pureFnDependencies: [${depsArray.join(", ")}],` : "";
|
|
32
|
-
return ` ${JSON.stringify(fn.fnName)}: {
|
|
33
|
-
namespace: ${JSON.stringify(fn.namespace)},
|
|
34
|
-
fnName: ${JSON.stringify(fn.fnName)},
|
|
35
|
-
paramNames: [${paramsArray}],
|
|
36
|
-
code: ${JSON.stringify(fn.fnBody)},
|
|
37
|
-
bodyHash: ${JSON.stringify(fn.bodyHash)},${depsLine}
|
|
38
|
-
isFactory: ${fn.isFactory},
|
|
39
|
-
${fnCode}
|
|
40
|
-
}`;
|
|
41
|
-
}
|
|
42
|
-
function generateDirectFn(fn) {
|
|
43
|
-
const params = fn.paramNames.join(", ");
|
|
44
|
-
const safeName = makeSafeFunctionName(fn.fnName);
|
|
45
|
-
return ` fn: function ${safeName}(${params}) {
|
|
46
|
-
${fn.fnBody}
|
|
47
|
-
},`;
|
|
48
|
-
}
|
|
49
|
-
function generateFactoryFn(fn) {
|
|
50
|
-
const params = fn.paramNames.join(", ");
|
|
51
|
-
const safeName = makeSafeFunctionName(fn.fnName);
|
|
52
|
-
return ` fn: undefined,
|
|
53
|
-
createFn: function ${safeName}(jitUtils) {
|
|
54
|
-
return (function factory(${params}) {
|
|
55
|
-
${fn.fnBody}
|
|
56
|
-
})(jitUtils);
|
|
57
|
-
},`;
|
|
58
|
-
}
|
|
59
|
-
function makeSafeFunctionName(name) {
|
|
60
|
-
const safe = name.replace(/[^a-zA-Z0-9_$]/g, "_");
|
|
61
|
-
if (/^[0-9]/.test(safe)) {
|
|
62
|
-
return "_" + safe;
|
|
63
|
-
}
|
|
64
|
-
return safe || "anonymous";
|
|
65
|
-
}
|
|
66
|
-
export {
|
|
67
|
-
generateServerPureFnsVirtualModule
|
|
68
|
-
};
|
|
69
|
-
//# sourceMappingURL=virtualModule.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"virtualModule.js","sources":["../../../../../src/vite-plugin/virtualModule.ts"],"sourcesContent":["/* ########\n * 2026 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport {ExtractedPureFn} from './types.ts';\n\n/** Generates the virtual module source code from extracted server pure functions */\nexport function generateServerPureFnsVirtualModule(extractedFns: ExtractedPureFn[]): string {\n // Group functions by namespace\n const byNamespace = new Map<string, ExtractedPureFn[]>();\n for (const fn of extractedFns) {\n const list = byNamespace.get(fn.namespace) || [];\n list.push(fn);\n byNamespace.set(fn.namespace, list);\n }\n\n // Generate nested namespace entries\n const namespaceEntries: string[] = [];\n for (const [namespace, fns] of byNamespace) {\n const fnEntries = fns.map((fn) => generateEntryCode(fn));\n namespaceEntries.push(` ${JSON.stringify(namespace)}: {\\n${fnEntries.join(',\\n')}\\n }`);\n }\n\n return `// Auto-generated by @mionjs/server-pure-functions\n// Do not edit manually\n\nexport const serverPureFnsCache = {\n${namespaceEntries.join(',\\n')}\n};\n`;\n}\n\n/** Generates the code for a single server pure function entry */\nfunction generateEntryCode(fn: ExtractedPureFn): string {\n const paramsArray = fn.paramNames.map((p) => JSON.stringify(p)).join(', ');\n\n // Convert dependencies from \"namespace::fnName\" to just \"fnName\" (same-namespace resolution)\n const depsArray = [...fn.dependencies].map((d) => {\n const parts = d.split('::');\n return JSON.stringify(parts.length === 2 ? parts[1] : d);\n });\n\n // Generate the function code\n const fnCode = fn.isFactory ? generateFactoryFn(fn) : generateDirectFn(fn);\n\n const depsLine = depsArray.length > 0 ? `\\n pureFnDependencies: [${depsArray.join(', ')}],` : '';\n\n return ` ${JSON.stringify(fn.fnName)}: {\n namespace: ${JSON.stringify(fn.namespace)},\n fnName: ${JSON.stringify(fn.fnName)},\n paramNames: [${paramsArray}],\n code: ${JSON.stringify(fn.fnBody)},\n bodyHash: ${JSON.stringify(fn.bodyHash)},${depsLine}\n isFactory: ${fn.isFactory},\n${fnCode}\n }`;\n}\n\n/** Generates a direct fn property for a regular pure function */\nfunction generateDirectFn(fn: ExtractedPureFn): string {\n const params = fn.paramNames.join(', ');\n const safeName = makeSafeFunctionName(fn.fnName);\n\n return ` fn: function ${safeName}(${params}) {\n ${fn.fnBody}\n },`;\n}\n\n/** Generates createFn + fn: undefined for a factory function */\nfunction generateFactoryFn(fn: ExtractedPureFn): string {\n const params = fn.paramNames.join(', ');\n const safeName = makeSafeFunctionName(fn.fnName);\n\n return ` fn: undefined,\n createFn: function ${safeName}(jitUtils) {\n return (function factory(${params}) {\n ${fn.fnBody}\n })(jitUtils);\n },`;\n}\n\n/** Makes a function name safe for use as a JavaScript identifier */\nfunction makeSafeFunctionName(name: string): string {\n // Replace any non-alphanumeric characters with underscores\n const safe = name.replace(/[^a-zA-Z0-9_$]/g, '_');\n // Ensure it starts with a letter or underscore\n if (/^[0-9]/.test(safe)) {\n return '_' + safe;\n }\n return safe || 'anonymous';\n}\n"],"names":[],"mappings":"AAUO,SAAS,mCAAmC,cAAyC;AAExF,QAAM,kCAAkB,IAAA;AACxB,aAAW,MAAM,cAAc;AAC3B,UAAM,OAAO,YAAY,IAAI,GAAG,SAAS,KAAK,CAAA;AAC9C,SAAK,KAAK,EAAE;AACZ,gBAAY,IAAI,GAAG,WAAW,IAAI;AAAA,EACtC;AAGA,QAAM,mBAA6B,CAAA;AACnC,aAAW,CAAC,WAAW,GAAG,KAAK,aAAa;AACxC,UAAM,YAAY,IAAI,IAAI,CAAC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AG,WAAW,KAAK,IAAI;AACtC,QAAM,WAAW,qBAAqB,GAAG,MAAM;AAE/C,SAAO;AAAA,iCACsB,QAAQ;AAAA,2CACE,MAAM;AAAA,sBAC3B,GAAG,MAAM;AAAA;AAAA;AAG/B;AAGA,SAAS,qBAAqB,MAAsB;AAEhD,QAAM,OAAO,KAAK,QAAQ,mBAAmB,GAAG;AAEhD,MAAI,SAAS,KAAK,IAAI,GAAG;AACrB,WAAO,MAAM;AAAA,EACjB;AACA,SAAO,QAAQ;AACnB;"}
|
package/src/eslint/index.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/* ########
|
|
2
|
-
* 2024 mion
|
|
3
|
-
* Author: Ma-jerez
|
|
4
|
-
* License: MIT
|
|
5
|
-
* The software is provided "as is", without warranty of any kind.
|
|
6
|
-
* ######## */
|
|
7
|
-
|
|
8
|
-
import type {ESLint, Linter} from 'eslint';
|
|
9
|
-
import noTypeofRunType from './rules/no-typeof-runtype.ts';
|
|
10
|
-
import strongTypedRoutes from './rules/strong-typed-routes.ts';
|
|
11
|
-
import noUnreachableUnionTypes from './rules/no-unreachable-union-types.ts';
|
|
12
|
-
import noMixedUnionProperties from './rules/no-mixed-union-properties.ts';
|
|
13
|
-
import noTypeImports from './rules/no-type-imports.ts';
|
|
14
|
-
import pureFunctions from './rules/pure-functions.ts';
|
|
15
|
-
import noViteClient from './rules/no-vite-client.ts';
|
|
16
|
-
import typeFormatsImports from './rules/type-formats-imports.ts';
|
|
17
|
-
import enforceTypeImports from './rules/enforce-type-imports.ts';
|
|
18
|
-
|
|
19
|
-
// configs is set outside the initial object due to circular reference: recommended config references the plugin itself.
|
|
20
|
-
const plugin: ESLint.Plugin = {
|
|
21
|
-
rules: {
|
|
22
|
-
'no-typeof-runtype': noTypeofRunType,
|
|
23
|
-
'strong-typed-routes': strongTypedRoutes,
|
|
24
|
-
'no-unreachable-union-types': noUnreachableUnionTypes,
|
|
25
|
-
'no-mixed-union-properties': noMixedUnionProperties,
|
|
26
|
-
'no-type-imports': noTypeImports,
|
|
27
|
-
'pure-functions': pureFunctions,
|
|
28
|
-
'no-vite-client': noViteClient,
|
|
29
|
-
'type-formats-imports': typeFormatsImports,
|
|
30
|
-
'enforce-type-imports': enforceTypeImports,
|
|
31
|
-
} as unknown as ESLint.Plugin['rules'],
|
|
32
|
-
configs: {},
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
// Flat config preset: self-contained with plugin registration and recommended rules.
|
|
36
|
-
// Usage: import mionESLintPlugin from '@mionjs/devtools/eslint'; ... mionESLintPlugin.configs.recommended
|
|
37
|
-
plugin.configs!.recommended = {
|
|
38
|
-
plugins: {
|
|
39
|
-
'@mionjs': plugin,
|
|
40
|
-
},
|
|
41
|
-
rules: {
|
|
42
|
-
'@mionjs/no-typeof-runtype': 'error',
|
|
43
|
-
'@mionjs/strong-typed-routes': 'error',
|
|
44
|
-
'@mionjs/no-unreachable-union-types': 'error',
|
|
45
|
-
'@mionjs/no-type-imports': 'error',
|
|
46
|
-
'@mionjs/pure-functions': 'error',
|
|
47
|
-
'@mionjs/type-formats-imports': 'error',
|
|
48
|
-
// disabled as seems is not too useful and overlaps with some ts rules
|
|
49
|
-
// '@mionjs/no-mixed-union-properties': 'warn',
|
|
50
|
-
},
|
|
51
|
-
} satisfies Linter.Config;
|
|
52
|
-
|
|
53
|
-
export default plugin;
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
/* ########
|
|
2
|
-
* 2026 mion
|
|
3
|
-
* Author: Ma-jerez
|
|
4
|
-
* License: MIT
|
|
5
|
-
* The software is provided "as is", without warranty of any kind.
|
|
6
|
-
* ######## */
|
|
7
|
-
|
|
8
|
-
import {TSESTree, TSESLint, AST_NODE_TYPES} from '@typescript-eslint/utils';
|
|
9
|
-
|
|
10
|
-
export interface Options {
|
|
11
|
-
backendSources: string[];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
type MessageIds = 'enforceTypeImport' | 'enforceTypeExport' | 'sideEffectImport';
|
|
15
|
-
|
|
16
|
-
/** Enforce type-only imports from backend code to prevent bundling server code into the frontend. */
|
|
17
|
-
const rule: TSESLint.RuleModule<MessageIds, [Options]> = {
|
|
18
|
-
meta: {
|
|
19
|
-
type: 'suggestion',
|
|
20
|
-
fixable: 'code',
|
|
21
|
-
docs: {
|
|
22
|
-
description: 'Enforce type-only imports from backend code paths to prevent bundling server code into the frontend.',
|
|
23
|
-
},
|
|
24
|
-
messages: {
|
|
25
|
-
enforceTypeImport:
|
|
26
|
-
'Import from "{{source}}" must use "import type" to avoid importing backend code into the frontend bundle.',
|
|
27
|
-
enforceTypeExport:
|
|
28
|
-
'Re-export from "{{source}}" must use "export type" to avoid importing backend code into the frontend bundle.',
|
|
29
|
-
sideEffectImport:
|
|
30
|
-
'Side-effect import from "{{source}}" imports backend code into the frontend bundle. Remove this import or use "import type".',
|
|
31
|
-
},
|
|
32
|
-
schema: [
|
|
33
|
-
{
|
|
34
|
-
type: 'object',
|
|
35
|
-
properties: {
|
|
36
|
-
backendSources: {
|
|
37
|
-
type: 'array',
|
|
38
|
-
items: {type: 'string'},
|
|
39
|
-
minItems: 1,
|
|
40
|
-
description: 'Array of regex patterns matching import sources that should use type-only imports.',
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
required: ['backendSources'],
|
|
44
|
-
additionalProperties: false,
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
},
|
|
48
|
-
defaultOptions: [{backendSources: []}],
|
|
49
|
-
create(context) {
|
|
50
|
-
const options = context.options[0];
|
|
51
|
-
if (!options || !options.backendSources.length) return {};
|
|
52
|
-
|
|
53
|
-
const patterns = options.backendSources.map((p) => new RegExp(p));
|
|
54
|
-
|
|
55
|
-
function matchesBackend(source: string): boolean {
|
|
56
|
-
return patterns.some((p) => p.test(source));
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function hasAllValueSpecifiers(specifiers: TSESTree.ImportClause[]): boolean {
|
|
60
|
-
return specifiers.every((s) => {
|
|
61
|
-
if (s.type === AST_NODE_TYPES.ImportSpecifier) return s.importKind !== 'type';
|
|
62
|
-
return true; // default and namespace imports are always value
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function fixImport(fixer: TSESLint.RuleFixer, node: TSESTree.ImportDeclaration): TSESLint.RuleFix | TSESLint.RuleFix[] {
|
|
67
|
-
const sourceCode = context.sourceCode;
|
|
68
|
-
if (hasAllValueSpecifiers(node.specifiers)) {
|
|
69
|
-
// convert entire declaration: insert 'type ' after 'import'
|
|
70
|
-
const importToken = sourceCode.getFirstToken(node)!;
|
|
71
|
-
return fixer.insertTextAfter(importToken, ' type');
|
|
72
|
-
}
|
|
73
|
-
// mixed: add 'type' to each value specifier
|
|
74
|
-
const fixes: TSESLint.RuleFix[] = [];
|
|
75
|
-
for (const specifier of node.specifiers) {
|
|
76
|
-
if (specifier.type === AST_NODE_TYPES.ImportSpecifier && specifier.importKind !== 'type') {
|
|
77
|
-
fixes.push(fixer.insertTextBefore(specifier, 'type '));
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return fixes;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function fixExport(
|
|
84
|
-
fixer: TSESLint.RuleFixer,
|
|
85
|
-
node: TSESTree.ExportNamedDeclaration
|
|
86
|
-
): TSESLint.RuleFix | TSESLint.RuleFix[] {
|
|
87
|
-
const sourceCode = context.sourceCode;
|
|
88
|
-
const allValue = node.specifiers.every((s) => s.exportKind !== 'type');
|
|
89
|
-
if (allValue) {
|
|
90
|
-
const exportToken = sourceCode.getFirstToken(node)!;
|
|
91
|
-
return fixer.insertTextAfter(exportToken, ' type');
|
|
92
|
-
}
|
|
93
|
-
const fixes: TSESLint.RuleFix[] = [];
|
|
94
|
-
for (const specifier of node.specifiers) {
|
|
95
|
-
if (specifier.exportKind !== 'type') {
|
|
96
|
-
fixes.push(fixer.insertTextBefore(specifier, 'type '));
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return fixes;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return {
|
|
103
|
-
ImportDeclaration(node: TSESTree.ImportDeclaration) {
|
|
104
|
-
const source = node.source.value;
|
|
105
|
-
if (!matchesBackend(source)) return;
|
|
106
|
-
if (node.importKind === 'type') return;
|
|
107
|
-
|
|
108
|
-
// side-effect import (no specifiers)
|
|
109
|
-
if (node.specifiers.length === 0) {
|
|
110
|
-
context.report({
|
|
111
|
-
node,
|
|
112
|
-
messageId: 'sideEffectImport',
|
|
113
|
-
data: {source},
|
|
114
|
-
});
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// check if all specifiers are already type-only
|
|
119
|
-
const hasValueSpecifier = node.specifiers.some((s) => {
|
|
120
|
-
if (s.type === AST_NODE_TYPES.ImportSpecifier) return s.importKind !== 'type';
|
|
121
|
-
return true;
|
|
122
|
-
});
|
|
123
|
-
if (!hasValueSpecifier) return;
|
|
124
|
-
|
|
125
|
-
context.report({
|
|
126
|
-
node,
|
|
127
|
-
messageId: 'enforceTypeImport',
|
|
128
|
-
data: {source},
|
|
129
|
-
fix(fixer) {
|
|
130
|
-
return fixImport(fixer, node);
|
|
131
|
-
},
|
|
132
|
-
});
|
|
133
|
-
},
|
|
134
|
-
|
|
135
|
-
ExportNamedDeclaration(node: TSESTree.ExportNamedDeclaration) {
|
|
136
|
-
if (!node.source) return;
|
|
137
|
-
const source = node.source.value;
|
|
138
|
-
if (!matchesBackend(source)) return;
|
|
139
|
-
if (node.exportKind === 'type') return;
|
|
140
|
-
|
|
141
|
-
const hasValueSpecifier = node.specifiers.some((s) => s.exportKind !== 'type');
|
|
142
|
-
if (!hasValueSpecifier) return;
|
|
143
|
-
|
|
144
|
-
context.report({
|
|
145
|
-
node,
|
|
146
|
-
messageId: 'enforceTypeExport',
|
|
147
|
-
data: {source},
|
|
148
|
-
fix(fixer) {
|
|
149
|
-
return fixExport(fixer, node);
|
|
150
|
-
},
|
|
151
|
-
});
|
|
152
|
-
},
|
|
153
|
-
};
|
|
154
|
-
},
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
export default rule;
|