@lwc/template-compiler
Advanced tools
Comparing version 6.6.3 to 7.0.0-alpha.0
@@ -71,2 +71,4 @@ import { APIVersion } from '@lwc/shared'; | ||
genScopedFragId(id: string | t.Expression): t.CallExpression; | ||
genClassExpression(value: Expression): import("estree").Expression; | ||
genNormalizeClassName(className: t.Expression): t.CallExpression; | ||
/** | ||
@@ -73,0 +75,0 @@ * Generates childs vnodes when slot content is static. |
import { InstrumentationObject } from '@lwc/errors'; | ||
import { CustomRendererConfig } from './shared/renderer-hooks'; | ||
export interface Config { | ||
/** The name of the component. For example, the name in `<my-component>` is `"component"`. */ | ||
name?: string; | ||
/** The namespace of the component. For example, the namespace in `<my-component>` is `"my"`. */ | ||
namespace?: string; | ||
/** | ||
@@ -64,3 +68,7 @@ * Specification to use to determine which nodes in the template require custom renderer hooks. | ||
} | ||
export type NormalizedConfig = Required<Omit<Config, 'customRendererConfig' | 'instrumentation'>> & Partial<Pick<Config, 'customRendererConfig' | 'instrumentation'>>; | ||
type OptionalConfigNames = 'customRendererConfig' | 'instrumentation' | 'namespace' | 'name'; | ||
type RequiredConfigOptions = Required<Omit<Config, OptionalConfigNames>>; | ||
type OptionalConfigOptions = Partial<Pick<Config, OptionalConfigNames>>; | ||
export type NormalizedConfig = RequiredConfigOptions & OptionalConfigOptions; | ||
export declare function normalizeConfig(config: Config): NormalizedConfig; | ||
export {}; |
@@ -19,5 +19,6 @@ import { Config } from './config'; | ||
* @param source HTML markup to compile | ||
* @param filename HTML filename | ||
* @param config HTML template compilation config | ||
* @returns Object containing the compiled code and any warnings that occurred. | ||
*/ | ||
export default function compile(source: string, config: Config): TemplateCompileResult; | ||
export default function compile(source: string, filename: string, config: Config): TemplateCompileResult; |
@@ -8,2 +8,6 @@ import { ElementDirectiveName } from './types'; | ||
export declare const TEMPLATE_MODULES_PARAMETER: string; | ||
export declare const FREEZE_TEMPLATE = "freezeTemplate"; | ||
export declare const IMPLICIT_STYLESHEETS = "_implicitStylesheets"; | ||
export declare const IMPLICIT_SCOPED_STYLESHEETS = "_implicitScopedStylesheets"; | ||
export declare const IMPLICIT_STYLESHEET_IMPORTS: string[]; | ||
export declare const TEMPLATE_FUNCTION_NAME: string; | ||
@@ -10,0 +14,0 @@ export declare const TEMPLATE_PARAMS: { |
@@ -35,2 +35,3 @@ import type * as t from 'estree'; | ||
export declare function functionDeclaration(id: t.Identifier, params: t.FunctionDeclaration['params'], body: t.FunctionDeclaration['body'], config?: Partial<t.FunctionDeclaration>): t.FunctionDeclaration; | ||
export declare function ifStatement(test: t.IfStatement['test'], consequent: t.IfStatement['consequent'], alternate?: t.IfStatement['alternate']): t.IfStatement; | ||
export declare function blockStatement(body: t.BlockStatement['body'], config?: Partial<t.BlockStatement>): t.BlockStatement; | ||
@@ -72,2 +73,3 @@ export declare function returnStatement(argument: t.ReturnStatement['argument'], config?: Partial<t.ReturnStatement>): t.ReturnStatement; | ||
export type AssignmentPattern = t.AssignmentPattern; | ||
export type IfStatement = t.IfStatement; | ||
export type BlockStatement = t.BlockStatement; | ||
@@ -74,0 +76,0 @@ export type ReturnStatement = t.ReturnStatement; |
@@ -9,2 +9,3 @@ import { CompilerDiagnostic } from '@lwc/errors'; | ||
code: string; | ||
cssScopeTokens: string[]; | ||
} | ||
@@ -11,0 +12,0 @@ export declare enum LWCDirectiveDomMode { |
@@ -1,3 +0,4 @@ | ||
import { NormalizedConfig } from './config'; | ||
import { BaseElement } from './shared/types'; | ||
import { type scopeTokens } from './scopeTokens'; | ||
import type { NormalizedConfig } from './config'; | ||
export default class State { | ||
@@ -22,3 +23,11 @@ config: NormalizedConfig; | ||
crCheckedElements: Map<BaseElement, boolean>; | ||
constructor(config: NormalizedConfig); | ||
/** | ||
* Filename of the HTML source | ||
*/ | ||
filename: string; | ||
/** | ||
* Contains the scopeTokens used in the template metadata | ||
*/ | ||
scopeTokens: scopeTokens; | ||
constructor(config: NormalizedConfig, filename: string); | ||
} |
@@ -18,4 +18,24 @@ # LWC core license | ||
MIT license defined in package.json in v0.4.0. | ||
The MIT License (MIT) | ||
Copyright © 2024 James Garbutt | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the “Software”), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
## entities | ||
@@ -22,0 +42,0 @@ |
@@ -7,3 +7,3 @@ { | ||
"name": "@lwc/template-compiler", | ||
"version": "6.6.3", | ||
"version": "7.0.0-alpha.0", | ||
"description": "Template compiler package", | ||
@@ -46,4 +46,4 @@ "keywords": [ | ||
"dependencies": { | ||
"@lwc/errors": "6.6.3", | ||
"@lwc/shared": "6.6.3", | ||
"@lwc/errors": "7.0.0-alpha.0", | ||
"@lwc/shared": "7.0.0-alpha.0", | ||
"acorn": "~8.11.3", | ||
@@ -54,3 +54,3 @@ "astring": "~1.8.6", | ||
"devDependencies": { | ||
"@parse5/tools": "^0.4.0", | ||
"@parse5/tools": "^0.5.0", | ||
"@types/estree": "1.0.5", | ||
@@ -61,2 +61,2 @@ "@types/he": "^1.2.3", | ||
} | ||
} | ||
} |
@@ -16,2 +16,3 @@ # @lwc/template-compiler | ||
const filename = 'component.html'; | ||
const options = {}; | ||
@@ -24,2 +25,3 @@ const { code, warnings } = compile( | ||
`, | ||
filename, | ||
options | ||
@@ -49,2 +51,3 @@ ); | ||
- `source` (string, required) - the HTML template source to compile. | ||
- `filename` (string, required) - the source filename with extension. | ||
- `options` (object, required) - the options to used to compile the HTML template source. | ||
@@ -54,2 +57,4 @@ | ||
- `name` (type: `string`, optional, `undefined` by default) - name of the component, e.g. `foo` in `x/foo`. | ||
- `namespace` (type: `string`, optional, `undefined` by default) - namespace of the component, e.g. `x` in `x/foo`. | ||
- `experimentalComputedMemberExpression` (boolean, optional, `false` by default) - set to `true` to enable computed member expression in the template, eg: `{list[0].name}`. | ||
@@ -56,0 +61,0 @@ - `experimentalComplexExpressions` (boolean, optional, `false` by default) - set to `true` to enable use of (a subset of) JavaScript expressions in place of template bindings. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
2945013
41
30610
108
1
+ Added@lwc/errors@7.0.0-alpha.0(transitive)
+ Added@lwc/shared@7.0.0-alpha.0(transitive)
- Removed@lwc/errors@6.6.3(transitive)
- Removed@lwc/shared@6.6.3(transitive)
Updated@lwc/errors@7.0.0-alpha.0
Updated@lwc/shared@7.0.0-alpha.0