@tanstack/start-plugin-core 1.169.11 → 1.169.13
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/dist/esm/index.d.ts +1 -1
- package/dist/esm/rsbuild/index.d.ts +1 -0
- package/dist/esm/rsbuild/plugin.js +2 -0
- package/dist/esm/rsbuild/plugin.js.map +1 -1
- package/dist/esm/rsbuild/schema.d.ts +27 -27
- package/dist/esm/rsbuild/start-compiler-host.d.ts +3 -1
- package/dist/esm/rsbuild/start-compiler-host.js +6 -2
- package/dist/esm/rsbuild/start-compiler-host.js.map +1 -1
- package/dist/esm/schema.d.ts +51 -51
- package/dist/esm/start-compiler/compiler.d.ts +21 -5
- package/dist/esm/start-compiler/compiler.js +197 -48
- package/dist/esm/start-compiler/compiler.js.map +1 -1
- package/dist/esm/start-compiler/config.d.ts +7 -3
- package/dist/esm/start-compiler/config.js +19 -7
- package/dist/esm/start-compiler/config.js.map +1 -1
- package/dist/esm/start-compiler/handleCreateServerFn.js +12 -0
- package/dist/esm/start-compiler/handleCreateServerFn.js.map +1 -1
- package/dist/esm/start-compiler/host.d.ts +3 -1
- package/dist/esm/start-compiler/host.js +5 -3
- package/dist/esm/start-compiler/host.js.map +1 -1
- package/dist/esm/start-compiler/types.d.ts +4 -13
- package/dist/esm/types.d.ts +33 -0
- package/dist/esm/vite/index.d.ts +1 -0
- package/dist/esm/vite/plugin.js +2 -0
- package/dist/esm/vite/plugin.js.map +1 -1
- package/dist/esm/vite/schema.d.ts +27 -27
- package/dist/esm/vite/start-compiler-plugin/plugin.d.ts +3 -1
- package/dist/esm/vite/start-compiler-plugin/plugin.js +6 -2
- package/dist/esm/vite/start-compiler-plugin/plugin.js.map +1 -1
- package/package.json +6 -6
- package/src/index.ts +6 -1
- package/src/rsbuild/index.ts +5 -0
- package/src/rsbuild/plugin.ts +3 -0
- package/src/rsbuild/start-compiler-host.ts +22 -3
- package/src/start-compiler/compiler.ts +389 -70
- package/src/start-compiler/config.ts +43 -6
- package/src/start-compiler/handleCreateServerFn.ts +29 -0
- package/src/start-compiler/host.ts +13 -3
- package/src/start-compiler/types.ts +5 -14
- package/src/types.ts +44 -0
- package/src/vite/index.ts +5 -0
- package/src/vite/plugin.ts +3 -0
- package/src/vite/start-compiler-plugin/plugin.ts +22 -3
|
@@ -11,7 +11,10 @@ import {
|
|
|
11
11
|
import { cleanId } from '../start-compiler/utils'
|
|
12
12
|
import { RSBUILD_ENVIRONMENT_NAMES } from './planning'
|
|
13
13
|
import type { RsbuildPluginAPI, Rspack } from '@rsbuild/core'
|
|
14
|
-
import type {
|
|
14
|
+
import type {
|
|
15
|
+
CompileStartFrameworkOptions,
|
|
16
|
+
StartCompilerImportTransform,
|
|
17
|
+
} from '../types'
|
|
15
18
|
import type {
|
|
16
19
|
DevServerFnModuleSpecifierEncoder,
|
|
17
20
|
GenerateFunctionIdFnOptional,
|
|
@@ -36,6 +39,8 @@ export interface StartCompilerHostOptions {
|
|
|
36
39
|
root: string | (() => string)
|
|
37
40
|
providerEnvName: string
|
|
38
41
|
generateFunctionId?: GenerateFunctionIdFnOptional
|
|
42
|
+
compilerTransforms?: Array<StartCompilerImportTransform> | undefined
|
|
43
|
+
serverFnProviderModuleDirectives?: ReadonlyArray<string> | undefined
|
|
39
44
|
serverFnsById?: Record<string, ServerFn>
|
|
40
45
|
onServerFnsByIdChange?: () => void
|
|
41
46
|
}
|
|
@@ -79,11 +84,21 @@ export function registerStartCompilerTransforms(
|
|
|
79
84
|
// Pre-compute code filter patterns per environment type
|
|
80
85
|
const codeFilters: Record<'client' | 'server', Array<RegExp>> = {
|
|
81
86
|
client: getTransformCodeFilterForEnv('client'),
|
|
82
|
-
server: getTransformCodeFilterForEnv('server'
|
|
87
|
+
server: getTransformCodeFilterForEnv('server', {
|
|
88
|
+
compilerTransforms: opts.compilerTransforms,
|
|
89
|
+
}),
|
|
83
90
|
}
|
|
84
91
|
|
|
85
92
|
for (const env of environments) {
|
|
86
93
|
const envCodeFilters = codeFilters[env.type]
|
|
94
|
+
const compilerTransforms =
|
|
95
|
+
env.name === RSBUILD_ENVIRONMENT_NAMES.server
|
|
96
|
+
? opts.compilerTransforms
|
|
97
|
+
: undefined
|
|
98
|
+
const serverFnProviderModuleDirectives =
|
|
99
|
+
env.name === opts.providerEnvName
|
|
100
|
+
? opts.serverFnProviderModuleDirectives
|
|
101
|
+
: undefined
|
|
87
102
|
|
|
88
103
|
api.transform(
|
|
89
104
|
{
|
|
@@ -113,6 +128,8 @@ export function registerStartCompilerTransforms(
|
|
|
113
128
|
framework: opts.framework,
|
|
114
129
|
providerEnvName: opts.providerEnvName,
|
|
115
130
|
generateFunctionId: opts.generateFunctionId,
|
|
131
|
+
compilerTransforms,
|
|
132
|
+
serverFnProviderModuleDirectives,
|
|
116
133
|
onServerFnsById,
|
|
117
134
|
getKnownServerFns: () => serverFnsById,
|
|
118
135
|
encodeModuleSpecifierInDev: isDev
|
|
@@ -180,7 +197,9 @@ export function registerStartCompilerTransforms(
|
|
|
180
197
|
compilers.set(env.name, compiler)
|
|
181
198
|
}
|
|
182
199
|
|
|
183
|
-
const detectedKinds = detectKindsInCode(code, env.type
|
|
200
|
+
const detectedKinds = detectKindsInCode(code, env.type, {
|
|
201
|
+
compilerTransforms,
|
|
202
|
+
})
|
|
184
203
|
const result = await compiler.compile({ id, code, detectedKinds })
|
|
185
204
|
|
|
186
205
|
if (!result) {
|