@kdujs/compiler-dom-canary
Advanced tools
Comparing version 3.20241216.0-minor.0 to 3.20241216.0
@@ -1,2 +0,2 @@ | ||
import { ParserOptions, NodeTransform, SourceLocation, CompilerError, DirectiveTransform, CompilerOptions, CodegenResult, RootNode } from '@kdujs/compiler-core'; | ||
import { ParserOptions, NodeTransform, SourceLocation, CompilerError, DirectiveTransform, RootNode, CompilerOptions, CodegenResult } from '@kdujs/compiler-core'; | ||
export * from '@kdujs/compiler-core'; | ||
@@ -23,3 +23,3 @@ | ||
export declare function createDOMCompilerError(code: DOMErrorCodes, loc?: SourceLocation): DOMCompilerError; | ||
export declare const enum DOMErrorCodes { | ||
export declare enum DOMErrorCodes { | ||
X_K_HTML_NO_EXPRESSION = 53, | ||
@@ -38,7 +38,10 @@ X_K_HTML_WITH_CHILDREN = 54, | ||
} | ||
export declare const DOMErrorMessages: { | ||
[code: number]: string; | ||
}; | ||
export declare const DOMNodeTransforms: NodeTransform[]; | ||
export declare const DOMDirectiveTransforms: Record<string, DirectiveTransform>; | ||
export declare function compile(template: string, options?: CompilerOptions): CodegenResult; | ||
export declare function compile(src: string | RootNode, options?: CompilerOptions): CodegenResult; | ||
export declare function parse(template: string, options?: ParserOptions): RootNode; | ||
@@ -1,4 +0,9 @@ | ||
import { registerRuntimeHelpers, isBuiltInType, createSimpleExpression, createCompilerError, createObjectProperty, getConstantType, createCallExpression, TO_DISPLAY_STRING, transformModel as transformModel$1, findProp, hasDynamicKeyKBind, transformOn as transformOn$1, isStaticExp, createCompoundExpression, checkCompatEnabled, noopDirectiveTransform, baseCompile, baseParse } from '@kdujs/compiler-core'; | ||
/** | ||
* @kdujs/compiler-dom-canary v3.20241216.0 | ||
* (c) 2021-present NKDuy | ||
* @license MIT | ||
**/ | ||
import { registerRuntimeHelpers, createSimpleExpression, createCompilerError, createObjectProperty, getConstantType, createCallExpression, TO_DISPLAY_STRING, transformModel as transformModel$1, findProp, hasDynamicKeyKBind, findDir, isStaticArgOf, transformOn as transformOn$1, isStaticExp, createCompoundExpression, checkCompatEnabled, noopDirectiveTransform, baseCompile, baseParse } from '@kdujs/compiler-core'; | ||
export * from '@kdujs/compiler-core'; | ||
import { isVoidTag, isHTMLTag, isSVGTag, makeMap, parseStringStyle, capitalize, extend } from '@kdujs/shared'; | ||
import { isVoidTag, isHTMLTag, isSVGTag, isMathMLTag, parseStringStyle, capitalize, makeMap, extend } from '@kdujs/shared'; | ||
@@ -42,15 +47,12 @@ const K_MODEL_RADIO = Symbol(!!(process.env.NODE_ENV !== "production") ? `kModelRadio` : ``); | ||
const isRawTextContainer = /* @__PURE__ */ makeMap( | ||
"style,iframe,script,noscript", | ||
true | ||
); | ||
const parserOptions = { | ||
parseMode: "html", | ||
isVoidTag, | ||
isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag), | ||
isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag), | ||
isPreTag: (tag) => tag === "pre", | ||
decodeEntities: decodeHtmlBrowser , | ||
isBuiltInComponent: (tag) => { | ||
if (isBuiltInType(tag, `Transition`)) { | ||
if (tag === "Transition" || tag === "transition") { | ||
return TRANSITION; | ||
} else if (isBuiltInType(tag, `TransitionGroup`)) { | ||
} else if (tag === "TransitionGroup" || tag === "transition-group") { | ||
return TRANSITION_GROUP; | ||
@@ -60,4 +62,4 @@ } | ||
// https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher | ||
getNamespace(tag, parent) { | ||
let ns = parent ? parent.ns : 0; | ||
getNamespace(tag, parent, rootNamespace) { | ||
let ns = parent ? parent.ns : rootNamespace; | ||
if (parent && ns === 2) { | ||
@@ -90,14 +92,2 @@ if (parent.tag === "annotation-xml") { | ||
return ns; | ||
}, | ||
// https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragments | ||
getTextMode({ tag, ns }) { | ||
if (ns === 0) { | ||
if (tag === "textarea" || tag === "title") { | ||
return 1; | ||
} | ||
if (isRawTextContainer(tag)) { | ||
return 2; | ||
} | ||
} | ||
return 0; | ||
} | ||
@@ -139,2 +129,28 @@ }; | ||
} | ||
const DOMErrorCodes = { | ||
"X_K_HTML_NO_EXPRESSION": 53, | ||
"53": "X_K_HTML_NO_EXPRESSION", | ||
"X_K_HTML_WITH_CHILDREN": 54, | ||
"54": "X_K_HTML_WITH_CHILDREN", | ||
"X_K_TEXT_NO_EXPRESSION": 55, | ||
"55": "X_K_TEXT_NO_EXPRESSION", | ||
"X_K_TEXT_WITH_CHILDREN": 56, | ||
"56": "X_K_TEXT_WITH_CHILDREN", | ||
"X_K_MODEL_ON_INVALID_ELEMENT": 57, | ||
"57": "X_K_MODEL_ON_INVALID_ELEMENT", | ||
"X_K_MODEL_ARG_ON_ELEMENT": 58, | ||
"58": "X_K_MODEL_ARG_ON_ELEMENT", | ||
"X_K_MODEL_ON_FILE_INPUT_ELEMENT": 59, | ||
"59": "X_K_MODEL_ON_FILE_INPUT_ELEMENT", | ||
"X_K_MODEL_UNNECESSARY_VALUE": 60, | ||
"60": "X_K_MODEL_UNNECESSARY_VALUE", | ||
"X_K_SHOW_NO_EXPRESSION": 61, | ||
"61": "X_K_SHOW_NO_EXPRESSION", | ||
"X_TRANSITION_INVALID_CHILDREN": 62, | ||
"62": "X_TRANSITION_INVALID_CHILDREN", | ||
"X_IGNORED_SIDE_EFFECT_TAG": 63, | ||
"63": "X_IGNORED_SIDE_EFFECT_TAG", | ||
"__EXTEND_POINT__": 64, | ||
"64": "__EXTEND_POINT__" | ||
}; | ||
const DOMErrorMessages = { | ||
@@ -218,4 +234,4 @@ [53]: `k-html is missing expression.`, | ||
function checkDuplicatedValue() { | ||
const value = findProp(node, "value"); | ||
if (value) { | ||
const value = findDir(node, "bind"); | ||
if (value && isStaticArgOf(value.arg, "value")) { | ||
context.onError( | ||
@@ -352,4 +368,3 @@ createDOMCompilerError( | ||
const { modifiers } = dir; | ||
if (!modifiers.length) | ||
return baseResult; | ||
if (!modifiers.length) return baseResult; | ||
let { key, value: handlerExp } = baseResult.props[0]; | ||
@@ -426,2 +441,3 @@ const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc); | ||
name: "persisted", | ||
nameLoc: node.loc, | ||
value: void 0, | ||
@@ -471,5 +487,5 @@ loc: node.loc | ||
}; | ||
function compile(template, options = {}) { | ||
function compile(src, options = {}) { | ||
return baseCompile( | ||
template, | ||
src, | ||
extend({}, parserOptions, options, { | ||
@@ -497,2 +513,2 @@ nodeTransforms: [ | ||
export { DOMDirectiveTransforms, DOMNodeTransforms, K_MODEL_CHECKBOX, K_MODEL_DYNAMIC, K_MODEL_RADIO, K_MODEL_SELECT, K_MODEL_TEXT, K_ON_WITH_KEYS, K_ON_WITH_MODIFIERS, K_SHOW, TRANSITION, TRANSITION_GROUP, compile, createDOMCompilerError, parse, parserOptions, transformStyle }; | ||
export { DOMDirectiveTransforms, DOMErrorCodes, DOMErrorMessages, DOMNodeTransforms, K_MODEL_CHECKBOX, K_MODEL_DYNAMIC, K_MODEL_RADIO, K_MODEL_SELECT, K_MODEL_TEXT, K_ON_WITH_KEYS, K_ON_WITH_MODIFIERS, K_SHOW, TRANSITION, TRANSITION_GROUP, compile, createDOMCompilerError, parse, parserOptions, transformStyle }; |
{ | ||
"name": "@kdujs/compiler-dom-canary", | ||
"version": "3.20241216.0-minor.0", | ||
"version": "3.20241216.0", | ||
"description": "@kdujs/compiler-dom", | ||
@@ -14,2 +14,16 @@ "main": "index.js", | ||
], | ||
"exports": { | ||
".": { | ||
"types": "./dist/compiler-dom.d.ts", | ||
"node": { | ||
"production": "./dist/compiler-dom.cjs.prod.js", | ||
"development": "./dist/compiler-dom.cjs.js", | ||
"default": "./index.js" | ||
}, | ||
"module": "./dist/compiler-dom.esm-bundler.js", | ||
"import": "./dist/compiler-dom.esm-bundler.js", | ||
"require": "./index.js" | ||
}, | ||
"./*": "./*" | ||
}, | ||
"sideEffects": false, | ||
@@ -41,5 +55,5 @@ "buildOptions": { | ||
"dependencies": { | ||
"@kdujs/shared": "npm:@kdujs/shared-canary@3.20241216.0-minor.0", | ||
"@kdujs/compiler-core": "npm:@kdujs/compiler-core-canary@3.20241216.0-minor.0" | ||
"@kdujs/shared": "npm:@kdujs/shared-canary@3.20241216.0", | ||
"@kdujs/compiler-core": "npm:@kdujs/compiler-core-canary@3.20241216.0" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
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
610829
1
15158
+ Added@kdujs/compiler-core-canary@3.20241216.0(transitive)
+ Added@kdujs/shared-canary@3.20241216.0(transitive)
+ Addedentities@4.5.0(transitive)
- Removed@kdujs/compiler-core-canary@3.20241216.0-minor.0(transitive)
- Removed@kdujs/shared-canary@3.20241216.0-minor.0(transitive)
Updated@kdujs/compiler-core@npm:@kdujs/compiler-core-canary@3.20241216.0