@kdujs/compiler-sfc-canary
Advanced tools
Comparing version 3.20241111.0 to 3.20241118.0-minor.0
@@ -0,5 +1,7 @@ | ||
import * as lru_cache_min from 'lru-cache/min'; | ||
import * as _babel_types from '@babel/types'; | ||
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'; | ||
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'; | ||
export { BindingMetadata, CompilerError, CompilerOptions, extractIdentifiers, generateCodeFrame, isInDestructureAssignment, isStaticProperty, walkIdentifiers } from '@kdujs/compiler-core'; | ||
import { RawSourceMap } from 'source-map-js'; | ||
import { ParserPlugin } from '@babel/parser'; | ||
@@ -11,2 +13,3 @@ 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'; | ||
@@ -30,3 +33,3 @@ export interface AssetURLTagConfig { | ||
export interface TemplateCompiler { | ||
compile(source: string | RootNode, options: CompilerOptions): CodegenResult; | ||
compile(template: string, options: CompilerOptions): CodegenResult; | ||
parse(template: string, options: ParserOptions): RootNode; | ||
@@ -45,3 +48,2 @@ } | ||
source: string; | ||
ast?: RootNode; | ||
filename: string; | ||
@@ -106,3 +108,3 @@ id: string; | ||
* Generate the final component as a variable instead of default export. | ||
* This is useful in e.g. @lahmjs/plugin-kdu where the script needs to be | ||
* This is useful in e.g. @witejs/plugin-kdu where the script needs to be | ||
* placed inside the main module. | ||
@@ -124,2 +126,7 @@ */ | ||
/** | ||
* (**Experimental**) Enable macro `defineModel` | ||
* @default false | ||
*/ | ||
defineModel?: boolean; | ||
/** | ||
* (**Experimental**) Enable reactive destructure for `defineProps` | ||
@@ -137,8 +144,10 @@ * @default false | ||
readFile(file: string): string | undefined; | ||
realpath?(file: string): string; | ||
}; | ||
/** | ||
* Transform Kdu SFCs into custom elements. | ||
* (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. | ||
*/ | ||
customElement?: boolean | ((filename: string) => boolean); | ||
reactivityTransform?: boolean; | ||
} | ||
@@ -167,8 +176,2 @@ interface ImportBinding { | ||
compiler?: TemplateCompiler; | ||
templateParseOptions?: ParserOptions; | ||
/** | ||
* TODO remove in 3.5 | ||
* @deprecated use `templateParseOptions: { prefixIdentifiers: false }` instead | ||
*/ | ||
parseExpressions?: boolean; | ||
} | ||
@@ -186,3 +189,3 @@ export interface SFCBlock { | ||
type: 'template'; | ||
ast?: RootNode; | ||
ast: ElementNode; | ||
} | ||
@@ -199,3 +202,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 @lahmjs/plugin-kdu and | ||
* used in macros, used for HMR cache busting in @witejs/plugin-kdu and | ||
* kdu-loader. | ||
@@ -238,3 +241,4 @@ */ | ||
} | ||
export declare function parse(source: string, options?: SFCParseOptions): SFCParseResult; | ||
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; | ||
@@ -301,3 +305,2 @@ type PreprocessLang = 'less' | 'sass' | 'scss' | 'styl' | 'stylus'; | ||
}>; | ||
export declare function extractRuntimeProps(ctx: TypeResolveContext): string | undefined; | ||
@@ -308,6 +311,5 @@ interface ModelDecl { | ||
identifier: string | undefined; | ||
runtimeOptionNodes: Node[]; | ||
} | ||
declare enum BindingTypes { | ||
declare const enum BindingTypes { | ||
/** | ||
@@ -369,3 +371,2 @@ * returned from data() | ||
isTS: boolean; | ||
isCE: boolean; | ||
scriptAst: Program | null; | ||
@@ -418,3 +419,2 @@ scriptSetupAst: Program | null; | ||
export type SimpleTypeResolveOptions = Partial<Pick<SFCScriptCompileOptions, 'globalTypeFiles' | 'fs' | 'babelParserPlugins' | 'isProd'>>; | ||
/** | ||
@@ -435,5 +435,4 @@ * TypeResolveContext is compatible with ScriptCompileContext | ||
*/ | ||
export type SimpleTypeResolveContext = Pick<ScriptCompileContext, 'source' | 'filename' | 'error' | 'helper' | 'getString' | 'propsTypeDecl' | 'propsRuntimeDefaults' | 'propsDestructuredBindings' | 'emitsTypeDecl' | 'isCE'> & Partial<Pick<ScriptCompileContext, 'scope' | 'globalScopes' | 'deps' | 'fs'>> & { | ||
export type SimpleTypeResolveContext = Pick<ScriptCompileContext, 'source' | 'filename' | 'error' | 'options'> & Partial<Pick<ScriptCompileContext, 'scope' | 'globalScopes' | 'deps' | 'fs'>> & { | ||
ast: Statement[]; | ||
options: SimpleTypeResolveOptions; | ||
}; | ||
@@ -456,3 +455,2 @@ 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>; | ||
@@ -477,3 +475,3 @@ exportedTypes: Record<string, ScopeTypeNode>; | ||
_resolvedElements?: ResolvedElements; | ||
}, scope?: TypeScope, typeParameters?: Record<string, Node>): ResolvedElements; | ||
}, scope?: TypeScope): ResolvedElements; | ||
/** | ||
@@ -487,74 +485,7 @@ * @private | ||
export declare function invalidateTypeCache(filename: string): void; | ||
export declare function inferRuntimeType(ctx: TypeResolveContext, node: Node & MaybeWithScope, scope?: TypeScope, isKeyOf?: boolean): string[]; | ||
export declare function inferRuntimeType(ctx: TypeResolveContext, node: Node & MaybeWithScope, scope?: TypeScope): 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.20241111.0", | ||
"version": "3.20241118.0-minor.0", | ||
"description": "@kdujs/compiler-sfc", | ||
@@ -11,12 +11,2 @@ "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": { | ||
@@ -46,24 +36,25 @@ "name": "KduCompilerSFC", | ||
"dependencies": { | ||
"@babel/parser": "^7.24.6", | ||
"@kdujs/compiler-core": "npm:@kdujs/compiler-core-canary@3.20241111.0", | ||
"@kdujs/compiler-dom": "npm:@kdujs/compiler-dom-canary@3.20241111.0", | ||
"@kdujs/compiler-ssr": "npm:@kdujs/compiler-ssr-canary@3.20241111.0", | ||
"@kdujs/shared": "npm:@kdujs/shared-canary@3.20241111.0", | ||
"@babel/parser": "^7.23.0", | ||
"@kdujs/compiler-core": "npm:@kdujs/compiler-core-canary@3.20241118.0-minor.0", | ||
"@kdujs/compiler-dom": "npm:@kdujs/compiler-dom-canary@3.20241118.0-minor.0", | ||
"@kdujs/compiler-ssr": "npm:@kdujs/compiler-ssr-canary@3.20241118.0-minor.0", | ||
"@kdujs/reactivity-transform": "npm:@kdujs/reactivity-transform-canary@3.20241118.0-minor.0", | ||
"@kdujs/shared": "npm:@kdujs/shared-canary@3.20241118.0-minor.0", | ||
"estree-walker": "^2.0.2", | ||
"magic-string": "^0.30.10", | ||
"postcss": "^8.4.38", | ||
"source-map-js": "^1.2.0" | ||
"magic-string": "^0.30.5", | ||
"postcss": "^8.4.31", | ||
"source-map-js": "^1.0.2" | ||
}, | ||
"devDependencies": { | ||
"@babel/types": "^7.24.6", | ||
"@kdujs/consolidate": "^1.0.0", | ||
"@babel/types": "^7.23.0", | ||
"@kdujs/consolidate": "^0.17.3", | ||
"hash-sum": "^2.0.0", | ||
"lru-cache": "10.1.0", | ||
"lru-cache": "^10.0.1", | ||
"merge-source-map": "^1.1.0", | ||
"minimatch": "^9.0.4", | ||
"postcss-modules": "^6.0.0", | ||
"postcss-selector-parser": "^6.1.0", | ||
"pug": "^3.0.3", | ||
"sass": "^1.77.4" | ||
"minimatch": "^9.0.3", | ||
"postcss-modules": "^4.3.1", | ||
"postcss-selector-parser": "^6.0.13", | ||
"pug": "^3.0.2", | ||
"sass": "^1.69.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 `lahm`. | ||
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`. | ||
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
66647
2223917
10
2
+ Added@kdujs/reactivity-transform@npm:@kdujs/reactivity-transform-canary@3.20241118.0-minor.0
+ Added@kdujs/compiler-core-canary@3.20241118.0-minor.0(transitive)
+ Added@kdujs/compiler-dom-canary@3.20241118.0-minor.0(transitive)
+ Added@kdujs/compiler-ssr-canary@3.20241118.0-minor.0(transitive)
+ Added@kdujs/reactivity-transform-canary@3.20241118.0-minor.0(transitive)
+ Added@kdujs/shared-canary@3.20241118.0-minor.0(transitive)
- Removed@kdujs/compiler-core-canary@3.20241111.0(transitive)
- Removed@kdujs/compiler-dom-canary@3.20241111.0(transitive)
- Removed@kdujs/compiler-ssr-canary@3.20241111.0(transitive)
- Removed@kdujs/shared-canary@3.20241111.0(transitive)
- Removedentities@4.5.0(transitive)
Updated@babel/parser@^7.23.0
Updated@kdujs/compiler-core@npm:@kdujs/compiler-core-canary@3.20241118.0-minor.0
Updated@kdujs/compiler-dom@npm:@kdujs/compiler-dom-canary@3.20241118.0-minor.0
Updated@kdujs/compiler-ssr@npm:@kdujs/compiler-ssr-canary@3.20241118.0-minor.0
Updated@kdujs/shared@npm:@kdujs/shared-canary@3.20241118.0-minor.0
Updatedmagic-string@^0.30.5
Updatedpostcss@^8.4.31
Updatedsource-map-js@^1.0.2