svelte-origin 0.0.0 → 1.0.0-next.15
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.
Potentially problematic release.
This version of svelte-origin might be problematic. Click here for more details.
- package/LLM.md +754 -0
- package/README.md +412 -1
- package/dist/aliases.d.ts +44 -0
- package/dist/cli.d.ts +19 -0
- package/dist/cli.js +3440 -0
- package/dist/generate-dts.d.ts +31 -0
- package/dist/globals.d.ts +576 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +6685 -0
- package/dist/plugin.d.ts +143 -0
- package/dist/plugin.js +3467 -0
- package/dist/post-process.d.ts +27 -0
- package/dist/post-process.js +3071 -0
- package/dist/preprocess.d.ts +73 -0
- package/dist/preprocess.js +3360 -0
- package/dist/runtime/attrs.d.ts +52 -0
- package/dist/runtime/index.d.ts +8 -0
- package/dist/runtime/index.js +3665 -0
- package/dist/runtime/origin.d.ts +144 -0
- package/dist/runtime/types.d.ts +173 -0
- package/dist/transform/attrs-for-transform.d.ts +24 -0
- package/dist/transform/attrs-origin-transform.d.ts +62 -0
- package/dist/transform/attrs-schema.d.ts +52 -0
- package/dist/transform/codegen.d.ts +15 -0
- package/dist/transform/core.d.ts +62 -0
- package/dist/transform/declaration-parser.d.ts +77 -0
- package/dist/transform/element-types.d.ts +10 -0
- package/dist/transform/origin-transform.d.ts +51 -0
- package/dist/transform/patterns.d.ts +82 -0
- package/dist/transform/schema.d.ts +116 -0
- package/dist/transform/standalone-attrs-transform.d.ts +36 -0
- package/dist/vite-dts.d.ts +17 -0
- package/dist/vite-dts.js +606 -0
- package/package.json +73 -3
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Svelte preprocessor for svelte-origin
|
|
3
|
+
*
|
|
4
|
+
* This preprocessor transforms $attrs.* and $origin macros before
|
|
5
|
+
* Svelte compiles the code. It runs as part of the Svelte compilation
|
|
6
|
+
* pipeline, guaranteeing it executes before the Svelte compiler sees the code.
|
|
7
|
+
*
|
|
8
|
+
* This is the PRIMARY and RECOMMENDED way to use svelte-origin.
|
|
9
|
+
* The Vite plugin is a secondary option for advanced use cases.
|
|
10
|
+
*/
|
|
11
|
+
export interface SvelteOriginPreprocessOptions {
|
|
12
|
+
/** Enable debug logging */
|
|
13
|
+
debug?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Manual path aliases for resolving imports.
|
|
16
|
+
* These have the highest priority and override auto-detected aliases.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```js
|
|
20
|
+
* svelteOriginPreprocess({
|
|
21
|
+
* aliases: {
|
|
22
|
+
* '$lib': 'src/lib',
|
|
23
|
+
* '$components': 'src/lib/components'
|
|
24
|
+
* }
|
|
25
|
+
* })
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
aliases?: Record<string, string>;
|
|
29
|
+
/**
|
|
30
|
+
* Project root directory for resolving paths.
|
|
31
|
+
* Defaults to process.cwd()
|
|
32
|
+
*/
|
|
33
|
+
root?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Whether to auto-detect aliases from tsconfig.json and svelte.config.js
|
|
36
|
+
*
|
|
37
|
+
* When enabled (default), the preprocessor will:
|
|
38
|
+
* 1. Read tsconfig.json (and any configs it extends) for compilerOptions.paths
|
|
39
|
+
* 2. Read .svelte-kit/tsconfig.json for SvelteKit-generated paths
|
|
40
|
+
* 3. Read svelte.config.js for kit.alias configuration
|
|
41
|
+
*
|
|
42
|
+
* Manual aliases always take priority over auto-detected ones.
|
|
43
|
+
*
|
|
44
|
+
* @default true
|
|
45
|
+
*/
|
|
46
|
+
autoDetectAliases?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Path to tsconfig.json (relative to root or absolute).
|
|
49
|
+
* Only used when autoDetectAliases is true.
|
|
50
|
+
* If not specified, will search for tsconfig.json and .svelte-kit/tsconfig.json
|
|
51
|
+
*/
|
|
52
|
+
tsconfig?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Path to svelte.config.js (relative to root or absolute).
|
|
55
|
+
* Only used when autoDetectAliases is true.
|
|
56
|
+
* If not specified, will search for svelte.config.js in the root.
|
|
57
|
+
*/
|
|
58
|
+
svelteConfig?: string;
|
|
59
|
+
}
|
|
60
|
+
type PreprocessorMarkup = {
|
|
61
|
+
content: string;
|
|
62
|
+
filename?: string;
|
|
63
|
+
attributes?: Record<string, string | boolean>;
|
|
64
|
+
};
|
|
65
|
+
type PreprocessorResult = {
|
|
66
|
+
code: string;
|
|
67
|
+
map?: object;
|
|
68
|
+
} | undefined;
|
|
69
|
+
export declare function svelteOriginPreprocess(options?: SvelteOriginPreprocessOptions): {
|
|
70
|
+
name: string;
|
|
71
|
+
script(params: PreprocessorMarkup): Promise<PreprocessorResult>;
|
|
72
|
+
};
|
|
73
|
+
export default svelteOriginPreprocess;
|