@fluixi/compiler 1.0.0-alpha.82 → 1.0.0-alpha.84
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/analyze/expr-shape.cjs +62 -1
- package/dist/analyze/expr-shape.d.cts +14 -0
- package/dist/analyze/expr-shape.mjs +41 -1
- package/dist/analyze/intrinsics.cjs +80 -1
- package/dist/analyze/intrinsics.d.cts +66 -0
- package/dist/analyze/intrinsics.mjs +59 -1
- package/dist/analyze/paren.cjs +134 -0
- package/dist/analyze/paren.d.cts +23 -0
- package/dist/analyze/paren.d.ts +24 -0
- package/dist/analyze/paren.d.ts.map +1 -0
- package/dist/analyze/paren.js +168 -0
- package/dist/analyze/paren.mjs +113 -0
- package/dist/analyze/props-destructure.cjs +226 -1
- package/dist/analyze/props-destructure.d.cts +83 -0
- package/dist/analyze/props-destructure.mjs +205 -1
- package/dist/analyze/reactive-bindings.cjs +190 -1
- package/dist/analyze/reactive-bindings.d.cts +42 -0
- package/dist/analyze/reactive-bindings.mjs +167 -1
- package/dist/analyze/reactive-expr.cjs +38 -1
- package/dist/analyze/reactive-expr.d.cts +38 -0
- package/dist/analyze/reactive-expr.mjs +17 -1
- package/dist/analyze/static-graph.cjs +811 -0
- package/dist/analyze/static-graph.d.cts +102 -0
- package/dist/analyze/static-graph.d.ts +103 -0
- package/dist/analyze/static-graph.d.ts.map +1 -0
- package/dist/analyze/static-graph.js +869 -0
- package/dist/analyze/static-graph.mjs +793 -0
- package/dist/babel-NRW4EFTG.mjs +636 -0
- package/dist/chunk-3YKZ4GNH.mjs +11 -0
- package/dist/chunk-EZR7NZOY.mjs +1718 -0
- package/dist/chunk-FSSWUXUR.mjs +16 -0
- package/dist/chunk-MJV3UXIL.mjs +158 -0
- package/dist/chunk-R2VHAZAX.mjs +1078 -0
- package/dist/codegen/backend.cjs +18 -1
- package/dist/codegen/backend.d.cts +35 -0
- package/dist/codegen/backends/imperative.cjs +542 -1
- package/dist/codegen/backends/imperative.d.cts +11 -0
- package/dist/codegen/backends/imperative.d.ts.map +1 -1
- package/dist/codegen/backends/imperative.js +68 -13
- package/dist/codegen/backends/imperative.mjs +519 -1
- package/dist/codegen/contract.cjs +52 -1
- package/dist/codegen/contract.d.cts +24 -0
- package/dist/codegen/contract.mjs +31 -1
- package/dist/codegen/partial-template.cjs +176 -1
- package/dist/codegen/partial-template.d.cts +61 -0
- package/dist/codegen/partial-template.mjs +153 -1
- package/dist/codegen/serialize-static.cjs +125 -1
- package/dist/codegen/serialize-static.d.cts +38 -0
- package/dist/codegen/serialize-static.d.ts +16 -0
- package/dist/codegen/serialize-static.d.ts.map +1 -1
- package/dist/codegen/serialize-static.js +25 -0
- package/dist/codegen/serialize-static.mjs +104 -1
- package/dist/frontend/babel/build-ir-lit.cjs +1509 -1
- package/dist/frontend/babel/build-ir-lit.d.cts +26 -0
- package/dist/frontend/babel/build-ir-lit.mjs +1478 -1
- package/dist/frontend/babel/build-ir.cjs +1524 -1
- package/dist/frontend/babel/build-ir.d.cts +35 -0
- package/dist/frontend/babel/build-ir.mjs +1495 -1
- package/dist/frontend/babel/index.cjs +2186 -1
- package/dist/frontend/babel/index.d.cts +33 -0
- package/dist/frontend/babel/index.mjs +2156 -1
- package/dist/frontend/babel/lower-template.cjs +1507 -1
- package/dist/frontend/babel/lower-template.d.cts +23 -0
- package/dist/frontend/babel/lower-template.mjs +1478 -1
- package/dist/frontend/babel/plugin.cjs +2132 -1
- package/dist/frontend/babel/plugin.d.cts +95 -0
- package/dist/frontend/babel/plugin.mjs +2103 -1
- package/dist/frontend/babel/server-functions.cjs +110 -1
- package/dist/frontend/babel/server-functions.d.cts +10 -0
- package/dist/frontend/babel/server-functions.mjs +89 -1
- package/dist/frontend/babel/types.cjs +18 -1
- package/dist/frontend/babel/types.d.cts +33 -0
- package/dist/frontend/types.cjs +18 -1
- package/dist/frontend/types.d.cts +25 -0
- package/dist/frontend/vocabulary.cjs +98 -0
- package/dist/frontend/vocabulary.d.cts +79 -0
- package/dist/frontend/vocabulary.d.ts +80 -0
- package/dist/frontend/vocabulary.d.ts.map +1 -0
- package/dist/frontend/vocabulary.js +124 -0
- package/dist/frontend/vocabulary.mjs +77 -0
- package/dist/index.cjs +1594 -13
- package/dist/index.d.cts +27 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.mjs +1574 -13
- package/dist/integrations.cjs +4307 -25
- package/dist/integrations.d.cts +215 -0
- package/dist/integrations.d.ts +16 -0
- package/dist/integrations.d.ts.map +1 -1
- package/dist/integrations.js +21 -2
- package/dist/integrations.mjs +531 -17
- package/dist/ir/nodes.cjs +18 -1
- package/dist/ir/nodes.d.cts +168 -0
- package/dist/ir/nodes.d.ts +46 -0
- package/dist/ir/nodes.d.ts.map +1 -1
- package/dist/lower/compile-template.cjs +1356 -1
- package/dist/lower/compile-template.d.cts +69 -0
- package/dist/lower/compile-template.d.ts +12 -0
- package/dist/lower/compile-template.d.ts.map +1 -1
- package/dist/lower/compile-template.js +5 -1
- package/dist/lower/compile-template.mjs +1336 -1
- package/dist/lower/jsx.cjs +529 -1
- package/dist/lower/jsx.d.cts +25 -0
- package/dist/lower/jsx.d.ts +2 -0
- package/dist/lower/jsx.d.ts.map +1 -1
- package/dist/lower/jsx.js +27 -4
- package/dist/lower/jsx.mjs +506 -1
- package/dist/lower/template.cjs +1061 -1
- package/dist/lower/template.d.cts +53 -0
- package/dist/lower/template.d.ts +14 -1
- package/dist/lower/template.d.ts.map +1 -1
- package/dist/lower/template.js +106 -19
- package/dist/lower/template.mjs +1042 -1
- package/dist/lower/text.cjs +42 -1
- package/dist/lower/text.d.cts +10 -0
- package/dist/lower/text.mjs +21 -1
- package/dist/optimize/analyze-static.cjs +112 -1
- package/dist/optimize/analyze-static.d.cts +39 -0
- package/dist/optimize/analyze-static.mjs +91 -1
- package/dist/optimize/collapse-strategies.cjs +90 -1
- package/dist/optimize/collapse-strategies.d.cts +30 -0
- package/dist/optimize/collapse-strategies.mjs +67 -1
- package/dist/options.cjs +33 -1
- package/dist/options.d.cts +39 -0
- package/dist/options.mjs +12 -1
- package/dist/resolve/builtins.cjs +73 -1
- package/dist/resolve/builtins.d.cts +68 -0
- package/dist/resolve/builtins.mjs +53 -1
- package/dist/resolve/component-globals.cjs +233 -13
- package/dist/resolve/component-globals.d.cts +80 -0
- package/dist/resolve/component-globals.mjs +210 -13
- package/dist/resolve/component-resolver.cjs +80 -1
- package/dist/resolve/component-resolver.d.cts +68 -0
- package/dist/resolve/component-resolver.mjs +59 -1
- package/dist/resolve/load-directive.cjs +93 -1
- package/dist/resolve/load-directive.d.cts +53 -0
- package/dist/resolve/load-directive.mjs +72 -1
- package/dist/resolve/resolve-ir.cjs +108 -1
- package/dist/resolve/resolve-ir.d.cts +53 -0
- package/dist/resolve/resolve-ir.mjs +85 -1
- package/dist/resolve/write-globals.cjs +318 -13
- package/dist/resolve/write-globals.d.cts +30 -0
- package/dist/resolve/write-globals.mjs +297 -13
- package/dist/server-fns-4ZXN6DYU.mjs +78 -0
- package/dist/server-functions-V6D6DRIA.mjs +82 -0
- package/dist/transform/bindings.cjs +71 -1
- package/dist/transform/bindings.d.cts +16 -0
- package/dist/transform/bindings.mjs +50 -1
- package/dist/transform/index.cjs +2732 -8
- package/dist/transform/index.d.cts +15 -0
- package/dist/transform/index.mjs +3773 -17
- package/dist/transform/intrinsics.cjs +216 -3
- package/dist/transform/intrinsics.d.cts +21 -0
- package/dist/transform/intrinsics.mjs +193 -3
- package/dist/transform/props.cjs +441 -3
- package/dist/transform/props.d.cts +45 -0
- package/dist/transform/props.mjs +1482 -12
- package/dist/transform/server-fn-id.cjs +35 -1
- package/dist/transform/server-fn-id.d.cts +9 -0
- package/dist/transform/server-fn-id.mjs +14 -1
- package/dist/transform/server-fns.cjs +114 -2
- package/dist/transform/server-fns.d.cts +12 -0
- package/dist/transform/server-fns.mjs +1155 -11
- package/dist/transform/source-locations.cjs +330 -0
- package/dist/transform/source-locations.d.cts +43 -0
- package/dist/transform/source-locations.d.ts +44 -0
- package/dist/transform/source-locations.d.ts.map +1 -0
- package/dist/transform/source-locations.js +238 -0
- package/dist/transform/source-locations.mjs +307 -0
- package/dist/transform/templates.cjs +2701 -7
- package/dist/transform/templates.d.cts +69 -0
- package/dist/transform/templates.d.ts +12 -4
- package/dist/transform/templates.d.ts.map +1 -1
- package/dist/transform/templates.js +72 -7
- package/dist/transform/templates.mjs +3743 -16
- package/dist/transform-BT4MMASR.mjs +893 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +6 -5
- package/dist/babel-4JUDAR2G.mjs +0 -1
- package/dist/chunk-3SAEGOMQ.mjs +0 -1
- package/dist/chunk-IBRM4W7I.mjs +0 -10
- package/dist/chunk-OHHZCYIQ.mjs +0 -1
- package/dist/chunk-PVR2SN3B.mjs +0 -1
- package/dist/chunk-QUIYULS2.mjs +0 -1
- package/dist/chunk-YR3SAEO7.mjs +0 -1
- package/dist/server-fns-6QM243HC.mjs +0 -2
- package/dist/server-functions-E3LKCZ4R.mjs +0 -1
- package/dist/transform-5WC4FWJE.mjs +0 -8
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Bundler integrations for the Fluixi compiler.
|
|
3
|
+
* @module @fluixi/compiler/integrations
|
|
4
|
+
*
|
|
5
|
+
* vite, webpack, rollup and esbuild adapters. Each is a few lines around
|
|
6
|
+
* `compileModule`, which rewrites the source in place — JSX and `` html`` `` both
|
|
7
|
+
* lower to the shared IR and the imperative backend. fluixi re-exports
|
|
8
|
+
* createVitePlugin from here.
|
|
9
|
+
*
|
|
10
|
+
* `babel: true` routes through the babel front-end instead, for a project whose
|
|
11
|
+
* own babel plugins have to see the output. It is the only thing that needs
|
|
12
|
+
* @babel/core, and it says so rather than degrading: source that was not compiled
|
|
13
|
+
* is source whose templates never became DOM calls, and a build that ships it
|
|
14
|
+
* looks successful until the page is opened.
|
|
15
|
+
*/
|
|
16
|
+
export interface CompilerOptions {
|
|
17
|
+
/**
|
|
18
|
+
* Rules that resolve an unbound capitalised tag to a module, so a component can be
|
|
19
|
+
* used in a template without an import. See `createComponentResolver`.
|
|
20
|
+
*/
|
|
21
|
+
resolve?: readonly ComponentResolverRule[];
|
|
22
|
+
/**
|
|
23
|
+
* Where to write the ambient declarations for the components `resolve` supplies.
|
|
24
|
+
*
|
|
25
|
+
* Relative to the project root; `false` turns generation off. Without this file every
|
|
26
|
+
* resolved tag is a `Cannot find name` error in the editor and in `tsc`, because the
|
|
27
|
+
* import only exists after compilation. Committing it is intended — it is what makes a
|
|
28
|
+
* fresh clone type-check before anyone runs the dev server.
|
|
29
|
+
*
|
|
30
|
+
* It must be covered by `include` in tsconfig.json, which for the default means adding
|
|
31
|
+
* `"fluixi.d.ts"` alongside `"src"`. A file TypeScript does not read looks exactly like
|
|
32
|
+
* one that was never generated, so a mismatch is reported rather than left to puzzle
|
|
33
|
+
* over.
|
|
34
|
+
*
|
|
35
|
+
* @default 'fluixi.d.ts'
|
|
36
|
+
*/
|
|
37
|
+
globals?: string | false;
|
|
38
|
+
/** Clone static subtrees from a `<template>` instead of building them element by element. */
|
|
39
|
+
templateClone?: boolean;
|
|
40
|
+
/** Also clone subtrees whose structure is static but which contain dynamic holes. */
|
|
41
|
+
partialTemplates?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Whether to generate source maps
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
sourceMaps?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Whether to delegate events
|
|
49
|
+
* @default true
|
|
50
|
+
*/
|
|
51
|
+
delegateEvents?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Whether to generate dev-mode code with additional checks
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
56
|
+
development?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Where the JSX *types* come from, and the `jsxImportSource` handed to esbuild
|
|
59
|
+
* and TypeScript. The compiler never emits `jsx()` calls itself — this is for
|
|
60
|
+
* type resolution and for any JSX the Fluixi transform does not consume.
|
|
61
|
+
* @default '@fluixi/jsx'
|
|
62
|
+
*/
|
|
63
|
+
importSource?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Authoring syntaxes to compile: 'jsx', 'lit' (only `` html`...` `` templates),
|
|
66
|
+
* or 'both' (default). Both lower to the same IR and the same backend.
|
|
67
|
+
* @default 'both'
|
|
68
|
+
*/
|
|
69
|
+
format?: 'jsx' | 'lit' | 'both';
|
|
70
|
+
/**
|
|
71
|
+
* Record where each reactive node is created, and serve the running app's graph to a tool
|
|
72
|
+
* that asks for it. Development only — a build never carries either.
|
|
73
|
+
*
|
|
74
|
+
* On by default when the dev server is running and @fluixi/devtools is installed. The
|
|
75
|
+
* marks are what turn `m5` into `double @ src/app.tsx:6`, and the endpoint is what an
|
|
76
|
+
* editor or a graph panel reads.
|
|
77
|
+
*
|
|
78
|
+
* `{ external: true }` marks dependencies too — node_modules and anything outside the
|
|
79
|
+
* project. That is for working on the framework itself: the graph then shows which nodes
|
|
80
|
+
* a library created and which the application did, at the cost of a mark per node in code
|
|
81
|
+
* you are not editing.
|
|
82
|
+
*/
|
|
83
|
+
devtools?: boolean | {
|
|
84
|
+
external?: boolean;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Compile through babel instead of rewriting the source directly.
|
|
88
|
+
*
|
|
89
|
+
* The default path parses once and splices the emitted code over the spans it
|
|
90
|
+
* replaces: nothing is reprinted, edits carry a source map, and types are left
|
|
91
|
+
* for esbuild to strip. Babel is kept for the cases that need to sit inside its
|
|
92
|
+
* pipeline — a `babel.config.js` with other plugins that have to see the
|
|
93
|
+
* output. It needs `@babel/core` and friends installed; they are optional peers.
|
|
94
|
+
* @default false
|
|
95
|
+
*/
|
|
96
|
+
babel?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Tag name marking a lit template for compilation (when `format` includes lit).
|
|
99
|
+
* @default 'html'
|
|
100
|
+
*/
|
|
101
|
+
litTag?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Rewrite a component's destructured props into property reads, so
|
|
104
|
+
* `function Card({ title })` keeps updating instead of reading `title` once.
|
|
105
|
+
* Applies to JSX and html`` alike — it rewrites the function body before either is
|
|
106
|
+
* compiled. A pattern it can't prove is left as written, so `splitProps` keeps
|
|
107
|
+
* working wherever it's still needed.
|
|
108
|
+
*
|
|
109
|
+
* Turn it off for a package that ships its source to be compiled by the consumer —
|
|
110
|
+
* rewriting there would bake property reads into what you publish.
|
|
111
|
+
*
|
|
112
|
+
* @default true
|
|
113
|
+
*/
|
|
114
|
+
propsDestructure?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Module emitted runtime symbols are imported from in 'imperative' mode.
|
|
117
|
+
* @default '@fluixi/dom'
|
|
118
|
+
*/
|
|
119
|
+
signalModule?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Module control-flow components are imported from in 'imperative' mode.
|
|
122
|
+
* @default '@fluixi/dom'
|
|
123
|
+
*/
|
|
124
|
+
controlFlowModule?: string;
|
|
125
|
+
/**
|
|
126
|
+
* Module the router components (Router/Outlet/…) are auto-imported from.
|
|
127
|
+
* @default '@fluixi/core/router'
|
|
128
|
+
*/
|
|
129
|
+
routerModule?: string;
|
|
130
|
+
/**
|
|
131
|
+
* Where reactive primitives (createMemo) are imported from in 'imperative' mode.
|
|
132
|
+
* @default '@fluixi/reactive/signal'
|
|
133
|
+
*/
|
|
134
|
+
reactiveModule?: string;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Helper for creating a Babel plugin
|
|
138
|
+
*/
|
|
139
|
+
export declare function createBabelPlugin(options?: CompilerOptions): Promise<{
|
|
140
|
+
name: string;
|
|
141
|
+
plugin: ((api: object, options: import("./frontend/babel/plugin.cjs").PluginOptions | null | undefined, dirname: string) => import("@babel/core").PluginObj<import("@babel/core").PluginPass>) | null;
|
|
142
|
+
getOptions(): {
|
|
143
|
+
reactiveModule?: string | undefined;
|
|
144
|
+
routerModule?: string | undefined;
|
|
145
|
+
controlFlowModule?: string | undefined;
|
|
146
|
+
signalModule?: string | undefined;
|
|
147
|
+
litTag?: string | undefined;
|
|
148
|
+
partialTemplates?: boolean | undefined;
|
|
149
|
+
templateClone?: boolean | undefined;
|
|
150
|
+
resolve?: readonly ComponentResolverRule[] | undefined;
|
|
151
|
+
format?: "both" | "jsx" | "lit" | undefined;
|
|
152
|
+
importSource: string;
|
|
153
|
+
development: boolean;
|
|
154
|
+
delegateEvents: boolean;
|
|
155
|
+
};
|
|
156
|
+
}>;
|
|
157
|
+
/**
|
|
158
|
+
* Helper for creating a TypeScript transformer
|
|
159
|
+
*/
|
|
160
|
+
export declare function createTypeScriptTransformer(options?: CompilerOptions): (context: any) => (sourceFile: any) => any;
|
|
161
|
+
/**
|
|
162
|
+
* Create a Vite plugin for JSX transformation
|
|
163
|
+
*/
|
|
164
|
+
export declare function createVitePlugin<T>(options?: CompilerOptions): T;
|
|
165
|
+
/**
|
|
166
|
+
* Create a Webpack loader for JSX transformation
|
|
167
|
+
*/
|
|
168
|
+
export declare function createWebpackLoader(options?: CompilerOptions): (this: any, source: string) => Promise<void>;
|
|
169
|
+
/**
|
|
170
|
+
* Create a Rollup plugin for JSX transformation
|
|
171
|
+
*/
|
|
172
|
+
export declare function createRollupPlugin(options?: CompilerOptions): {
|
|
173
|
+
name: string;
|
|
174
|
+
transform(code: string, id: string): Promise<import("./transform/templates.cjs").TransformResult | {
|
|
175
|
+
code: string;
|
|
176
|
+
map: {
|
|
177
|
+
version: number;
|
|
178
|
+
sources: string[];
|
|
179
|
+
names: string[];
|
|
180
|
+
sourceRoot?: string | undefined;
|
|
181
|
+
sourcesContent?: string[] | undefined;
|
|
182
|
+
mappings: string;
|
|
183
|
+
file: string;
|
|
184
|
+
} | null | undefined;
|
|
185
|
+
} | null>;
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* Create an ESBuild plugin for JSX transformation
|
|
189
|
+
*/
|
|
190
|
+
export declare function createESBuildPlugin(options?: CompilerOptions): {
|
|
191
|
+
name: string;
|
|
192
|
+
setup(build: any): void;
|
|
193
|
+
};
|
|
194
|
+
export type { ServerFnTransformOptions } from './frontend/babel/server-functions.cjs';
|
|
195
|
+
import type { ComponentResolverRule } from './resolve/component-resolver.cjs';
|
|
196
|
+
/**
|
|
197
|
+
* Vite plugin for `"use server"`: applies the transform (client→RPC stub, server→register
|
|
198
|
+
* the body), and provides `virtual:fluixi-server-fns` — side-effect imports of every
|
|
199
|
+
* module that defines a server function. The server entry imports it so ALL server
|
|
200
|
+
* functions register at startup (including those in lazy routes, which would otherwise
|
|
201
|
+
* register only when their chunk loads → an RPC registry miss). The client never imports
|
|
202
|
+
* it. `enforce:'pre'` so it runs on the raw source before other transforms.
|
|
203
|
+
*/
|
|
204
|
+
export declare function serverFunctionsVitePlugin<T = any>(options?: {
|
|
205
|
+
babel?: boolean;
|
|
206
|
+
}): T;
|
|
207
|
+
declare const _default: {
|
|
208
|
+
createBabelPlugin: typeof createBabelPlugin;
|
|
209
|
+
createTypeScriptTransformer: typeof createTypeScriptTransformer;
|
|
210
|
+
createVitePlugin: typeof createVitePlugin;
|
|
211
|
+
createWebpackLoader: typeof createWebpackLoader;
|
|
212
|
+
createRollupPlugin: typeof createRollupPlugin;
|
|
213
|
+
createESBuildPlugin: typeof createESBuildPlugin;
|
|
214
|
+
};
|
|
215
|
+
export default _default;
|
package/dist/integrations.d.ts
CHANGED
|
@@ -67,6 +67,22 @@ export interface CompilerOptions {
|
|
|
67
67
|
* @default 'both'
|
|
68
68
|
*/
|
|
69
69
|
format?: 'jsx' | 'lit' | 'both';
|
|
70
|
+
/**
|
|
71
|
+
* Record where each reactive node is created, and serve the running app's graph to a tool
|
|
72
|
+
* that asks for it. Development only — a build never carries either.
|
|
73
|
+
*
|
|
74
|
+
* On by default when the dev server is running and @fluixi/devtools is installed. The
|
|
75
|
+
* marks are what turn `m5` into `double @ src/app.tsx:6`, and the endpoint is what an
|
|
76
|
+
* editor or a graph panel reads.
|
|
77
|
+
*
|
|
78
|
+
* `{ external: true }` marks dependencies too — node_modules and anything outside the
|
|
79
|
+
* project. That is for working on the framework itself: the graph then shows which nodes
|
|
80
|
+
* a library created and which the application did, at the cost of a mark per node in code
|
|
81
|
+
* you are not editing.
|
|
82
|
+
*/
|
|
83
|
+
devtools?: boolean | {
|
|
84
|
+
external?: boolean;
|
|
85
|
+
};
|
|
70
86
|
/**
|
|
71
87
|
* Compile through babel instead of rewriting the source directly.
|
|
72
88
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../src/integrations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAC3C;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACzB,6FAA6F;IAC7F,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,qFAAqF;IACrF,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;IAEhC;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;;;;;;;OAWG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,iBAAiB,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@ export function createVitePlugin(options = {}) {
|
|
|
225
225
|
};
|
|
226
226
|
}
|
|
227
227
|
/** CompilerOptions as the transform wants them. Shared by every adapter. */
|
|
228
|
-
|
|
228
|
+
/**
|
|
229
|
+
* A dependency's own signals are not the author's, and marking them costs a call per node in
|
|
230
|
+
* code nobody is going to open. Source marks stop at the project boundary.
|
|
231
|
+
*/
|
|
232
|
+
function marks(options, id) {
|
|
233
|
+
if (options.sourceLocations !== true)
|
|
234
|
+
return false;
|
|
235
|
+
if (options.sourceLocationsExternal)
|
|
236
|
+
return true;
|
|
237
|
+
if (!id || id.includes('/node_modules/'))
|
|
238
|
+
return false;
|
|
239
|
+
const root = options.sourceRoot;
|
|
240
|
+
if (!root)
|
|
241
|
+
return true;
|
|
242
|
+
const base = root.endsWith('/') ? root : `${root}/`;
|
|
243
|
+
return id.startsWith(base);
|
|
244
|
+
}
|
|
245
|
+
function transformOptions(options, id) {
|
|
229
246
|
return {
|
|
230
247
|
resolve: options.resolve,
|
|
231
248
|
litTag: options.litTag,
|
|
249
|
+
sourceLocations: marks(options, id),
|
|
250
|
+
sourceRoot: options.sourceRoot,
|
|
232
251
|
templateClone: options.templateClone,
|
|
233
252
|
partialTemplates: options.partialTemplates,
|
|
234
253
|
runtimeModule: options.signalModule,
|
|
@@ -295,7 +314,7 @@ function reportDiagnostics(result, id) {
|
|
|
295
314
|
async function compileModule(code, id, options) {
|
|
296
315
|
if (!options.babel) {
|
|
297
316
|
const { transformTemplates } = await import('./transform/index.js');
|
|
298
|
-
const result = transformTemplates(code, id, transformOptions(options));
|
|
317
|
+
const result = transformTemplates(code, id, transformOptions(options, id));
|
|
299
318
|
reportDiagnostics(result, id);
|
|
300
319
|
return result;
|
|
301
320
|
}
|