@kdujs/compiler-sfc-canary
Advanced tools
Comparing version 3.20250113.0-minor.0 to 3.20250113.0
@@ -1,7 +0,5 @@ | ||
import * as lru_cache_min from 'lru-cache/min'; | ||
import * as _babel_types from '@babel/types'; | ||
import { Statement, Expression, TSType, Program, CallExpression, Node, ObjectPattern, TSModuleDeclaration, TSPropertySignature, TSMethodSignature, TSCallSignatureDeclaration, TSFunctionType } from '@babel/types'; | ||
import { CompilerOptions, CodegenResult, ParserOptions, RootNode, CompilerError, SourceLocation, ElementNode, BindingMetadata as BindingMetadata$1 } from '@kdujs/compiler-core'; | ||
import { Statement, Expression, TSType, Node, Program, CallExpression, ObjectPattern, TSModuleDeclaration, TSPropertySignature, TSMethodSignature, TSCallSignatureDeclaration, TSFunctionType } from '@babel/types'; | ||
import { RootNode, CompilerOptions, CodegenResult, ParserOptions, CompilerError, RawSourceMap, SourceLocation, BindingMetadata as BindingMetadata$1 } from '@kdujs/compiler-core'; | ||
export { BindingMetadata, CompilerError, CompilerOptions, extractIdentifiers, generateCodeFrame, isInDestructureAssignment, isStaticProperty, walkIdentifiers } from '@kdujs/compiler-core'; | ||
import { RawSourceMap } from 'source-map-js'; | ||
import { ParserPlugin } from '@babel/parser'; | ||
@@ -13,3 +11,2 @@ export { parse as babelParse } from '@babel/parser'; | ||
import TS from 'typescript'; | ||
export { shouldTransform as shouldTransformRef, transform as transformRef, transformAST as transformRefAST } from '@kdujs/reactivity-transform'; | ||
@@ -33,3 +30,3 @@ export interface AssetURLTagConfig { | ||
export interface TemplateCompiler { | ||
compile(template: string, options: CompilerOptions): CodegenResult; | ||
compile(source: string | RootNode, options: CompilerOptions): CodegenResult; | ||
parse(template: string, options: ParserOptions): RootNode; | ||
@@ -48,2 +45,3 @@ } | ||
source: string; | ||
ast?: RootNode; | ||
filename: string; | ||
@@ -108,3 +106,3 @@ id: string; | ||
* Generate the final component as a variable instead of default export. | ||
* This is useful in e.g. @witejs/plugin-kdu where the script needs to be | ||
* This is useful in e.g. @lahmjs/plugin-kdu where the script needs to be | ||
* placed inside the main module. | ||
@@ -126,7 +124,2 @@ */ | ||
/** | ||
* (**Experimental**) Enable macro `defineModel` | ||
* @default false | ||
*/ | ||
defineModel?: boolean; | ||
/** | ||
* (**Experimental**) Enable reactive destructure for `defineProps` | ||
@@ -144,10 +137,8 @@ * @default false | ||
readFile(file: string): string | undefined; | ||
realpath?(file: string): string; | ||
}; | ||
/** | ||
* (Experimental) Enable syntax transform for using refs without `.value` and | ||
* using destructured props with reactivity | ||
* @deprecated the Reactivity Transform proposal has been dropped. This | ||
* feature will be removed from Kdu core in 3.4. | ||
* Transform Kdu SFCs into custom elements. | ||
*/ | ||
reactivityTransform?: boolean; | ||
customElement?: boolean | ((filename: string) => boolean); | ||
} | ||
@@ -176,2 +167,8 @@ interface ImportBinding { | ||
compiler?: TemplateCompiler; | ||
templateParseOptions?: ParserOptions; | ||
/** | ||
* TODO remove in 3.5 | ||
* @deprecated use `templateParseOptions: { prefixIdentifiers: false }` instead | ||
*/ | ||
parseExpressions?: boolean; | ||
} | ||
@@ -189,3 +186,3 @@ export interface SFCBlock { | ||
type: 'template'; | ||
ast: ElementNode; | ||
ast?: RootNode; | ||
} | ||
@@ -202,3 +199,3 @@ export interface SFCScriptBlock extends SFCBlock { | ||
* Fully resolved dependency file paths (unix slashes) with imported types | ||
* used in macros, used for HMR cache busting in @witejs/plugin-kdu and | ||
* used in macros, used for HMR cache busting in @lahmjs/plugin-kdu and | ||
* kdu-loader. | ||
@@ -241,4 +238,3 @@ */ | ||
} | ||
export declare const parseCache: Map<string, SFCParseResult> | lru_cache_min.LRUCache<string, SFCParseResult, unknown>; | ||
export declare function parse(source: string, { sourceMap, filename, sourceRoot, pad, ignoreEmpty, compiler }?: SFCParseOptions): SFCParseResult; | ||
export declare function parse(source: string, options?: SFCParseOptions): SFCParseResult; | ||
@@ -305,2 +301,3 @@ type PreprocessLang = 'less' | 'sass' | 'scss' | 'styl' | 'stylus'; | ||
}>; | ||
export declare function extractRuntimeProps(ctx: TypeResolveContext): string | undefined; | ||
@@ -311,5 +308,6 @@ interface ModelDecl { | ||
identifier: string | undefined; | ||
runtimeOptionNodes: Node[]; | ||
} | ||
declare const enum BindingTypes { | ||
declare enum BindingTypes { | ||
/** | ||
@@ -371,2 +369,3 @@ * returned from data() | ||
isTS: boolean; | ||
isCE: boolean; | ||
scriptAst: Program | null; | ||
@@ -419,2 +418,3 @@ scriptSetupAst: Program | null; | ||
export type SimpleTypeResolveOptions = Partial<Pick<SFCScriptCompileOptions, 'globalTypeFiles' | 'fs' | 'babelParserPlugins' | 'isProd'>>; | ||
/** | ||
@@ -435,4 +435,5 @@ * TypeResolveContext is compatible with ScriptCompileContext | ||
*/ | ||
export type SimpleTypeResolveContext = Pick<ScriptCompileContext, 'source' | 'filename' | 'error' | 'options'> & Partial<Pick<ScriptCompileContext, 'scope' | 'globalScopes' | 'deps' | 'fs'>> & { | ||
export type SimpleTypeResolveContext = Pick<ScriptCompileContext, 'source' | 'filename' | 'error' | 'helper' | 'getString' | 'propsTypeDecl' | 'propsRuntimeDefaults' | 'propsDestructuredBindings' | 'emitsTypeDecl' | 'isCE'> & Partial<Pick<ScriptCompileContext, 'scope' | 'globalScopes' | 'deps' | 'fs'>> & { | ||
ast: Statement[]; | ||
options: SimpleTypeResolveOptions; | ||
}; | ||
@@ -455,2 +456,3 @@ export type TypeResolveContext = ScriptCompileContext | SimpleTypeResolveContext; | ||
constructor(filename: string, source: string, offset?: number, imports?: Record<string, Import>, types?: Record<string, ScopeTypeNode>, declares?: Record<string, ScopeTypeNode>); | ||
isGenericScope: boolean; | ||
resolvedImportSources: Record<string, string>; | ||
@@ -475,3 +477,3 @@ exportedTypes: Record<string, ScopeTypeNode>; | ||
_resolvedElements?: ResolvedElements; | ||
}, scope?: TypeScope): ResolvedElements; | ||
}, scope?: TypeScope, typeParameters?: Record<string, Node>): ResolvedElements; | ||
/** | ||
@@ -485,7 +487,74 @@ * @private | ||
export declare function invalidateTypeCache(filename: string): void; | ||
export declare function inferRuntimeType(ctx: TypeResolveContext, node: Node & MaybeWithScope, scope?: TypeScope): string[]; | ||
export declare function inferRuntimeType(ctx: TypeResolveContext, node: Node & MaybeWithScope, scope?: TypeScope, isKeyOf?: boolean): string[]; | ||
export declare function extractRuntimeEmits(ctx: TypeResolveContext): Set<string>; | ||
export declare const version: string; | ||
export declare const parseCache: Map<string, SFCParseResult>; | ||
export declare const errorMessages: { | ||
0: string; | ||
1: string; | ||
2: string; | ||
3: string; | ||
4: string; | ||
5: string; | ||
6: string; | ||
7: string; | ||
8: string; | ||
9: string; | ||
10: string; | ||
11: string; | ||
12: string; | ||
13: string; | ||
14: string; | ||
15: string; | ||
16: string; | ||
17: string; | ||
18: string; | ||
19: string; | ||
20: string; | ||
21: string; | ||
22: string; | ||
23: string; | ||
24: string; | ||
25: string; | ||
26: string; | ||
27: string; | ||
28: string; | ||
29: string; | ||
30: string; | ||
31: string; | ||
32: string; | ||
33: string; | ||
34: string; | ||
35: string; | ||
36: string; | ||
37: string; | ||
38: string; | ||
39: string; | ||
40: string; | ||
41: string; | ||
42: string; | ||
43: string; | ||
44: string; | ||
45: string; | ||
46: string; | ||
47: string; | ||
48: string; | ||
49: string; | ||
50: string; | ||
51: string; | ||
52: string; | ||
53: string; | ||
}; | ||
export declare const walk: any; | ||
/** | ||
* @deprecated this is preserved to avoid breaking lahm-plugin-kdu < 5.0 | ||
* with reactivityTransform: true. The desired behavior should be silently | ||
* ignoring the option instead of breaking. | ||
*/ | ||
export declare const shouldTransformRef: () => boolean; | ||
{ | ||
"name": "@kdujs/compiler-sfc-canary", | ||
"version": "3.20250113.0-minor.0", | ||
"version": "3.20250113.0", | ||
"description": "@kdujs/compiler-sfc", | ||
@@ -11,2 +11,12 @@ "main": "dist/compiler-sfc.cjs.js", | ||
], | ||
"exports": { | ||
".": { | ||
"types": "./dist/compiler-sfc.d.ts", | ||
"node": "./dist/compiler-sfc.cjs.js", | ||
"module": "./dist/compiler-sfc.esm-browser.js", | ||
"import": "./dist/compiler-sfc.esm-browser.js", | ||
"require": "./dist/compiler-sfc.cjs.js" | ||
}, | ||
"./*": "./*" | ||
}, | ||
"buildOptions": { | ||
@@ -36,25 +46,24 @@ "name": "KduCompilerSFC", | ||
"dependencies": { | ||
"@babel/parser": "^7.23.0", | ||
"@kdujs/compiler-core": "npm:@kdujs/compiler-core-canary@3.20250113.0-minor.0", | ||
"@kdujs/compiler-dom": "npm:@kdujs/compiler-dom-canary@3.20250113.0-minor.0", | ||
"@kdujs/compiler-ssr": "npm:@kdujs/compiler-ssr-canary@3.20250113.0-minor.0", | ||
"@kdujs/reactivity-transform": "npm:@kdujs/reactivity-transform-canary@3.20250113.0-minor.0", | ||
"@kdujs/shared": "npm:@kdujs/shared-canary@3.20250113.0-minor.0", | ||
"@babel/parser": "^7.24.6", | ||
"@kdujs/compiler-core": "npm:@kdujs/compiler-core-canary@3.20250113.0", | ||
"@kdujs/compiler-dom": "npm:@kdujs/compiler-dom-canary@3.20250113.0", | ||
"@kdujs/compiler-ssr": "npm:@kdujs/compiler-ssr-canary@3.20250113.0", | ||
"@kdujs/shared": "npm:@kdujs/shared-canary@3.20250113.0", | ||
"estree-walker": "^2.0.2", | ||
"magic-string": "^0.30.5", | ||
"postcss": "^8.4.31", | ||
"source-map-js": "^1.0.2" | ||
"magic-string": "^0.30.10", | ||
"postcss": "^8.4.38", | ||
"source-map-js": "^1.2.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/types": "^7.23.0", | ||
"@kdujs/consolidate": "^0.17.3", | ||
"@babel/types": "^7.24.6", | ||
"@kdujs/consolidate": "^1.0.0", | ||
"hash-sum": "^2.0.0", | ||
"lru-cache": "^10.0.1", | ||
"lru-cache": "10.1.0", | ||
"merge-source-map": "^1.1.0", | ||
"minimatch": "^9.0.3", | ||
"postcss-modules": "^4.3.1", | ||
"postcss-selector-parser": "^6.0.13", | ||
"pug": "^3.0.2", | ||
"sass": "^1.69.4" | ||
"minimatch": "^9.0.4", | ||
"postcss-modules": "^6.0.0", | ||
"postcss-selector-parser": "^6.1.0", | ||
"pug": "^3.0.3", | ||
"sass": "^1.77.4" | ||
} | ||
} |
@@ -5,3 +5,3 @@ # @kdujs/compiler-sfc | ||
This package contains lower level utilities that you can use if you are writing a plugin / transform for a bundler or module system that compiles Kdu Single File Components (SFCs) into JavaScript. It is used in `kdu-loader`, `rollup-plugin-kdu` and `wite`. | ||
This package contains lower level utilities that you can use if you are writing a plugin / transform for a bundler or module system that compiles Kdu Single File Components (SFCs) into JavaScript. It is used in `kdu-loader`, `rollup-plugin-kdu` and `lahm`. | ||
@@ -8,0 +8,0 @@ ## API |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2282428
9
1
65887
+ Added@kdujs/compiler-core-canary@3.20250113.0(transitive)
+ Added@kdujs/compiler-dom-canary@3.20250113.0(transitive)
+ Added@kdujs/compiler-ssr-canary@3.20250113.0(transitive)
+ Added@kdujs/shared-canary@3.20250113.0(transitive)
+ Addedentities@4.5.0(transitive)
- Removed@kdujs/reactivity-transform@npm:@kdujs/reactivity-transform-canary@3.20250113.0-minor.0
- Removed@kdujs/compiler-core-canary@3.20250113.0-minor.0(transitive)
- Removed@kdujs/compiler-dom-canary@3.20250113.0-minor.0(transitive)
- Removed@kdujs/compiler-ssr-canary@3.20250113.0-minor.0(transitive)
- Removed@kdujs/reactivity-transform-canary@3.20250113.0-minor.0(transitive)
- Removed@kdujs/shared-canary@3.20250113.0-minor.0(transitive)
Updated@babel/parser@^7.24.6
Updated@kdujs/compiler-core@npm:@kdujs/compiler-core-canary@3.20250113.0
Updated@kdujs/compiler-dom@npm:@kdujs/compiler-dom-canary@3.20250113.0
Updated@kdujs/compiler-ssr@npm:@kdujs/compiler-ssr-canary@3.20250113.0
Updatedmagic-string@^0.30.10
Updatedpostcss@^8.4.38
Updatedsource-map-js@^1.2.0