@lwc/compiler
Advanced tools
Comparing version 6.2.1 to 6.3.0
@@ -43,3 +43,3 @@ /** | ||
/* | ||
* Copyright (c) 2018, salesforce.com, inc. | ||
* Copyright (c) 2024, Salesforce, Inc. | ||
* All rights reserved. | ||
@@ -81,2 +81,12 @@ * SPDX-License-Identifier: MIT | ||
}; | ||
/** | ||
* Validates that the options conform to the expected shape and normalizes them to a standard format | ||
* @param options Input options | ||
* @returns Normalized options | ||
* @example | ||
* const normalizedOptions = validateTransformOptions({ | ||
* namespace: 'c', | ||
* name: 'app', | ||
* }) | ||
*/ | ||
function validateTransformOptions(options) { | ||
@@ -106,3 +116,3 @@ validateOptions(options); | ||
function validateOutputConfig(config) { | ||
errors.invariant(isUndefinedOrBoolean(config.sourcemap), errors.CompilerValidationErrors.INVALID_SOURCEMAP_PROPERTY, [config.sourcemap]); | ||
errors.invariant(isUndefinedOrBoolean(config.sourcemap) || config.sourcemap === 'inline', errors.CompilerValidationErrors.INVALID_SOURCEMAP_PROPERTY, [config.sourcemap]); | ||
if (!shared.isUndefined(config.minify)) { | ||
@@ -140,3 +150,3 @@ // eslint-disable-next-line no-console | ||
/* | ||
* Copyright (c) 2018, salesforce.com, inc. | ||
* Copyright (c) 2024, Salesforce, Inc. | ||
* All rights reserved. | ||
@@ -146,2 +156,11 @@ * SPDX-License-Identifier: MIT | ||
*/ | ||
/** | ||
* Transform the passed source code | ||
* @param src The source to be transformed. Can be the content of a JavaScript, HTML, or CSS file. | ||
* @param filename The source filename, with extension. | ||
* @param config The transformation options. The `name` and the `namespace` of the component is the | ||
* minimum required for transformation. | ||
* @returns An object with the generated code, source map and gathered metadata. | ||
* @throws Compilation errors | ||
*/ | ||
function styleTransform(src, filename, config) { | ||
@@ -175,3 +194,3 @@ const { customProperties } = config.stylesheetConfig; | ||
/* | ||
* Copyright (c) 2018, salesforce.com, inc. | ||
* Copyright (c) 2024, Salesforce, Inc. | ||
* All rights reserved. | ||
@@ -185,5 +204,8 @@ * SPDX-License-Identifier: MIT | ||
* the template regardless if there is an actual style or not. | ||
* @param src | ||
* @param filename | ||
* @param options | ||
* @param src HTML source | ||
* @param filename Source filename, with extension. | ||
* @param options Transformation options | ||
* @returns Transformed code, source map, and metadata | ||
* @throws Compiler errors, when compilation fails. | ||
* @example | ||
*/ | ||
@@ -317,3 +339,3 @@ function templateTransform(src, filename, options) { | ||
/* | ||
* Copyright (c) 2018, salesforce.com, inc. | ||
* Copyright (c) 2024, Salesforce, Inc. | ||
* All rights reserved. | ||
@@ -323,2 +345,11 @@ * SPDX-License-Identifier: MIT | ||
*/ | ||
/** | ||
* Transforms a JavaScript file. | ||
* @param code The source code to transform | ||
* @param filename The source filename, with extension. | ||
* @param options Transformation options. | ||
* @returns Compiled code | ||
* @throws Compilation errors | ||
* @example | ||
*/ | ||
function scriptTransform(code, filename, options) { | ||
@@ -376,3 +407,3 @@ const { isExplicitImport, experimentalDynamicComponent: dynamicImports, outputConfig: { sourcemap }, enableLightningWebSecurityTransforms, namespace, name, instrumentation, apiVersion, } = options; | ||
/* | ||
* Copyright (c) 2018, salesforce.com, inc. | ||
* Copyright (c) 2024, Salesforce, Inc. | ||
* All rights reserved. | ||
@@ -383,8 +414,20 @@ * SPDX-License-Identifier: MIT | ||
/** | ||
* Transforms the passed code. Returning a Promise of an object with the generated code, source map | ||
* and gathered metadata. | ||
* @param src | ||
* @param filename | ||
* @param options | ||
* @deprecated Use transformSync instead. | ||
* Transform the passed source code. | ||
* @param src The source to be transformed. Can be the content of a JavaScript, HTML, or CSS file. | ||
* @param filename The source filename, with extension. | ||
* @param options The transformation options. The `name` and the `namespace` of the component is the | ||
* minimum required for transformation. | ||
* @returns A promise resolving to an object with the generated code, source map and gathered metadata. | ||
* @example | ||
* const source = ` | ||
* import { LightningElement } from 'lwc'; | ||
* export default class App extends LightningElement {} | ||
* `; | ||
* const filename = 'app.js'; | ||
* const options = { | ||
* namespace: 'c', | ||
* name: 'app', | ||
* }; | ||
* const { code } = await transform(source, filename, options); | ||
* @deprecated Use {@linkcode transformSync} instead | ||
*/ | ||
@@ -404,7 +447,20 @@ function transform(src, filename, options) { | ||
/** | ||
* Transform the passed source code. Returning an object with the generated code, source map and | ||
* gathered metadata. | ||
* @param src | ||
* @param filename | ||
* @param options | ||
* Transform the passed source code | ||
* @param src The source to be transformed. Can be the content of a JavaScript, HTML, or CSS file. | ||
* @param filename The source filename, with extension. | ||
* @param options The transformation options. The `name` and the `namespace` of the component is the | ||
* minimum required for transformation. | ||
* @returns An object with the generated code, source map and gathered metadata. | ||
* @example | ||
* | ||
* const source = ` | ||
* import { LightningElement } from 'lwc'; | ||
* export default class App extends LightningElement {} | ||
* `; | ||
* const filename = 'app.js'; | ||
* const options = { | ||
* namespace: 'c', | ||
* name: 'app', | ||
* }; | ||
* const { code } = transformSync(source, filename, options); | ||
*/ | ||
@@ -443,3 +499,3 @@ function transformSync(src, filename, options) { | ||
/* | ||
* Copyright (c) 2018, salesforce.com, inc. | ||
* Copyright (c) 2024, Salesforce, Inc. | ||
* All rights reserved. | ||
@@ -449,3 +505,4 @@ * SPDX-License-Identifier: MIT | ||
*/ | ||
const version = "6.2.1"; | ||
/** The version of LWC being used. */ | ||
const version = "6.3.0"; | ||
@@ -455,3 +512,3 @@ exports.transform = transform; | ||
exports.version = version; | ||
/** version: 6.2.1 */ | ||
/** version: 6.3.0 */ | ||
//# sourceMappingURL=index.cjs.js.map |
export { transform, transformSync } from './transformers/transformer'; | ||
export { TransformResult } from './transformers/transformer'; | ||
export { TransformOptions, StylesheetConfig, CustomPropertiesResolution, DynamicImportConfig, OutputConfig, } from './options'; | ||
/** The version of LWC being used. */ | ||
export declare const version: string; |
@@ -18,3 +18,3 @@ /** | ||
/* | ||
* Copyright (c) 2018, salesforce.com, inc. | ||
* Copyright (c) 2024, Salesforce, Inc. | ||
* All rights reserved. | ||
@@ -56,2 +56,12 @@ * SPDX-License-Identifier: MIT | ||
}; | ||
/** | ||
* Validates that the options conform to the expected shape and normalizes them to a standard format | ||
* @param options Input options | ||
* @returns Normalized options | ||
* @example | ||
* const normalizedOptions = validateTransformOptions({ | ||
* namespace: 'c', | ||
* name: 'app', | ||
* }) | ||
*/ | ||
function validateTransformOptions(options) { | ||
@@ -81,3 +91,3 @@ validateOptions(options); | ||
function validateOutputConfig(config) { | ||
invariant(isUndefinedOrBoolean(config.sourcemap), CompilerValidationErrors.INVALID_SOURCEMAP_PROPERTY, [config.sourcemap]); | ||
invariant(isUndefinedOrBoolean(config.sourcemap) || config.sourcemap === 'inline', CompilerValidationErrors.INVALID_SOURCEMAP_PROPERTY, [config.sourcemap]); | ||
if (!isUndefined(config.minify)) { | ||
@@ -115,3 +125,3 @@ // eslint-disable-next-line no-console | ||
/* | ||
* Copyright (c) 2018, salesforce.com, inc. | ||
* Copyright (c) 2024, Salesforce, Inc. | ||
* All rights reserved. | ||
@@ -121,2 +131,11 @@ * SPDX-License-Identifier: MIT | ||
*/ | ||
/** | ||
* Transform the passed source code | ||
* @param src The source to be transformed. Can be the content of a JavaScript, HTML, or CSS file. | ||
* @param filename The source filename, with extension. | ||
* @param config The transformation options. The `name` and the `namespace` of the component is the | ||
* minimum required for transformation. | ||
* @returns An object with the generated code, source map and gathered metadata. | ||
* @throws Compilation errors | ||
*/ | ||
function styleTransform(src, filename, config) { | ||
@@ -150,3 +169,3 @@ const { customProperties } = config.stylesheetConfig; | ||
/* | ||
* Copyright (c) 2018, salesforce.com, inc. | ||
* Copyright (c) 2024, Salesforce, Inc. | ||
* All rights reserved. | ||
@@ -160,5 +179,8 @@ * SPDX-License-Identifier: MIT | ||
* the template regardless if there is an actual style or not. | ||
* @param src | ||
* @param filename | ||
* @param options | ||
* @param src HTML source | ||
* @param filename Source filename, with extension. | ||
* @param options Transformation options | ||
* @returns Transformed code, source map, and metadata | ||
* @throws Compiler errors, when compilation fails. | ||
* @example | ||
*/ | ||
@@ -292,3 +314,3 @@ function templateTransform(src, filename, options) { | ||
/* | ||
* Copyright (c) 2018, salesforce.com, inc. | ||
* Copyright (c) 2024, Salesforce, Inc. | ||
* All rights reserved. | ||
@@ -298,2 +320,11 @@ * SPDX-License-Identifier: MIT | ||
*/ | ||
/** | ||
* Transforms a JavaScript file. | ||
* @param code The source code to transform | ||
* @param filename The source filename, with extension. | ||
* @param options Transformation options. | ||
* @returns Compiled code | ||
* @throws Compilation errors | ||
* @example | ||
*/ | ||
function scriptTransform(code, filename, options) { | ||
@@ -351,3 +382,3 @@ const { isExplicitImport, experimentalDynamicComponent: dynamicImports, outputConfig: { sourcemap }, enableLightningWebSecurityTransforms, namespace, name, instrumentation, apiVersion, } = options; | ||
/* | ||
* Copyright (c) 2018, salesforce.com, inc. | ||
* Copyright (c) 2024, Salesforce, Inc. | ||
* All rights reserved. | ||
@@ -358,8 +389,20 @@ * SPDX-License-Identifier: MIT | ||
/** | ||
* Transforms the passed code. Returning a Promise of an object with the generated code, source map | ||
* and gathered metadata. | ||
* @param src | ||
* @param filename | ||
* @param options | ||
* @deprecated Use transformSync instead. | ||
* Transform the passed source code. | ||
* @param src The source to be transformed. Can be the content of a JavaScript, HTML, or CSS file. | ||
* @param filename The source filename, with extension. | ||
* @param options The transformation options. The `name` and the `namespace` of the component is the | ||
* minimum required for transformation. | ||
* @returns A promise resolving to an object with the generated code, source map and gathered metadata. | ||
* @example | ||
* const source = ` | ||
* import { LightningElement } from 'lwc'; | ||
* export default class App extends LightningElement {} | ||
* `; | ||
* const filename = 'app.js'; | ||
* const options = { | ||
* namespace: 'c', | ||
* name: 'app', | ||
* }; | ||
* const { code } = await transform(source, filename, options); | ||
* @deprecated Use {@linkcode transformSync} instead | ||
*/ | ||
@@ -379,7 +422,20 @@ function transform(src, filename, options) { | ||
/** | ||
* Transform the passed source code. Returning an object with the generated code, source map and | ||
* gathered metadata. | ||
* @param src | ||
* @param filename | ||
* @param options | ||
* Transform the passed source code | ||
* @param src The source to be transformed. Can be the content of a JavaScript, HTML, or CSS file. | ||
* @param filename The source filename, with extension. | ||
* @param options The transformation options. The `name` and the `namespace` of the component is the | ||
* minimum required for transformation. | ||
* @returns An object with the generated code, source map and gathered metadata. | ||
* @example | ||
* | ||
* const source = ` | ||
* import { LightningElement } from 'lwc'; | ||
* export default class App extends LightningElement {} | ||
* `; | ||
* const filename = 'app.js'; | ||
* const options = { | ||
* namespace: 'c', | ||
* name: 'app', | ||
* }; | ||
* const { code } = transformSync(source, filename, options); | ||
*/ | ||
@@ -418,3 +474,3 @@ function transformSync(src, filename, options) { | ||
/* | ||
* Copyright (c) 2018, salesforce.com, inc. | ||
* Copyright (c) 2024, Salesforce, Inc. | ||
* All rights reserved. | ||
@@ -424,6 +480,7 @@ * SPDX-License-Identifier: MIT | ||
*/ | ||
const version = "6.2.1"; | ||
/** The version of LWC being used. */ | ||
const version = "6.3.0"; | ||
export { transform, transformSync, version }; | ||
/** version: 6.2.1 */ | ||
/** version: 6.3.0 */ | ||
//# sourceMappingURL=index.js.map |
@@ -13,3 +13,3 @@ import { InstrumentationObject } from '@lwc/errors'; | ||
/** | ||
* @deprecated - Custom property transforms are deprecated because IE11 and other legacy browsers are no longer supported. | ||
* @deprecated Custom property transforms are deprecated because IE11 and other legacy browsers are no longer supported. | ||
*/ | ||
@@ -24,5 +24,6 @@ export interface StylesheetConfig { | ||
* If `true` a source map is generated for the transformed file. | ||
* If `inline`, an inline source map is generated and appended to the end of the transformed file. | ||
* @default false | ||
*/ | ||
sourcemap?: boolean; | ||
sourcemap?: boolean | 'inline'; | ||
/** | ||
@@ -37,20 +38,47 @@ * @deprecated The minify property has no effect on the generated output. | ||
} | ||
/** | ||
* Options used to change the behavior of the compiler. At a minimum, `name` and `namespace` are | ||
* required. | ||
*/ | ||
export interface TransformOptions { | ||
/** 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; | ||
/** @deprecated Ignored by compiler. */ | ||
stylesheetConfig?: StylesheetConfig; | ||
/** Config applied in usage of dynamic import statements in javascript */ | ||
experimentalDynamicComponent?: DynamicImportConfig; | ||
/** Flag to enable usage of dynamic component(lwc:dynamic) directive in HTML template */ | ||
experimentalDynamicDirective?: boolean; | ||
/** Flag to enable usage of dynamic component(lwc:is) directive in HTML template */ | ||
enableDynamicComponents?: boolean; | ||
/** Flag to enable use of (a subset of) JavaScript expressions in place of template bindings. Passed to `@lwc/template-compiler`. */ | ||
experimentalComplexExpressions?: boolean; | ||
/** Options to control what output gets generated. */ | ||
outputConfig?: OutputConfig; | ||
/** Whether this is an explicit import. Passed to `@lwc/babel-plugin-component`. */ | ||
isExplicitImport?: boolean; | ||
/** Whether the compiled HTML should include comments present in the source. */ | ||
preserveHtmlComments?: boolean; | ||
/** Whether the CSS file being compiled is a scoped stylesheet. Passed to `@lwc/style-compiler`. */ | ||
scopedStyles?: boolean; | ||
/** Whether the static content optimization should be enabled. Passed to `@lwc/template-compiler`. */ | ||
enableStaticContentOptimization?: boolean; | ||
/** Custom renderer config to pass to `@lwc/template-compiler`. See that package's README for details. */ | ||
customRendererConfig?: CustomRendererConfig; | ||
/** @deprecated Ignored by compiler. `lwc:spread` is always enabled. */ | ||
enableLwcSpread?: boolean; | ||
/** Set to true if synthetic shadow DOM support is not needed, which can result in smaller output. */ | ||
disableSyntheticShadowSupport?: boolean; | ||
/** | ||
* Enable transformations specific to {@link https://developer.salesforce.com/docs/platform/lwc/guide/security-lwsec-intro.html Lighting Web Security}. | ||
*/ | ||
enableLightningWebSecurityTransforms?: boolean; | ||
/** | ||
* Instrumentation object to gather metrics and non-error logs for internal use. | ||
* See the `@lwc/errors` package for details on the interface. | ||
*/ | ||
instrumentation?: InstrumentationObject; | ||
/** API version to associate with the compiled module. Values correspond to Salesforce platform releases. */ | ||
apiVersion?: number; | ||
@@ -71,3 +99,13 @@ } | ||
} | ||
/** | ||
* Validates that the options conform to the expected shape and normalizes them to a standard format | ||
* @param options Input options | ||
* @returns Normalized options | ||
* @example | ||
* const normalizedOptions = validateTransformOptions({ | ||
* namespace: 'c', | ||
* name: 'app', | ||
* }) | ||
*/ | ||
export declare function validateTransformOptions(options: TransformOptions): NormalizedTransformOptions; | ||
export {}; |
import { NormalizedTransformOptions } from '../options'; | ||
import { TransformResult } from './transformer'; | ||
/** | ||
* Transforms a JavaScript file. | ||
* @param code The source code to transform | ||
* @param filename The source filename, with extension. | ||
* @param options Transformation options. | ||
* @returns Compiled code | ||
* @throws Compilation errors | ||
* @example | ||
*/ | ||
export default function scriptTransform(code: string, filename: string, options: NormalizedTransformOptions): TransformResult; |
import { NormalizedTransformOptions } from '../options'; | ||
import { TransformResult } from './transformer'; | ||
/** | ||
* Transform the passed source code | ||
* @param src The source to be transformed. Can be the content of a JavaScript, HTML, or CSS file. | ||
* @param filename The source filename, with extension. | ||
* @param config The transformation options. The `name` and the `namespace` of the component is the | ||
* minimum required for transformation. | ||
* @returns An object with the generated code, source map and gathered metadata. | ||
* @throws Compilation errors | ||
*/ | ||
export default function styleTransform(src: string, filename: string, config: NormalizedTransformOptions): TransformResult; |
@@ -7,6 +7,9 @@ import { NormalizedTransformOptions } from '../options'; | ||
* the template regardless if there is an actual style or not. | ||
* @param src | ||
* @param filename | ||
* @param options | ||
* @param src HTML source | ||
* @param filename Source filename, with extension. | ||
* @param options Transformation options | ||
* @returns Transformed code, source map, and metadata | ||
* @throws Compiler errors, when compilation fails. | ||
* @example | ||
*/ | ||
export default function templateTransform(src: string, filename: string, options: NormalizedTransformOptions): TransformResult; |
import { CompilerDiagnostic } from '@lwc/errors'; | ||
import { TransformOptions } from '../options'; | ||
/** The object returned after transforming code. */ | ||
export interface TransformResult { | ||
/** The compiled source code. */ | ||
code: string; | ||
/** The generated source map. */ | ||
map: unknown; | ||
/** Any diagnostic warnings that may have occurred. */ | ||
warnings?: CompilerDiagnostic[]; | ||
/** | ||
* String tokens used for style scoping in synthetic shadow DOM and `*.scoped.css`, as either | ||
* attributes or classes. | ||
*/ | ||
cssScopeTokens?: string[]; | ||
} | ||
/** | ||
* Transforms the passed code. Returning a Promise of an object with the generated code, source map | ||
* and gathered metadata. | ||
* @param src | ||
* @param filename | ||
* @param options | ||
* @deprecated Use transformSync instead. | ||
* Transform the passed source code. | ||
* @param src The source to be transformed. Can be the content of a JavaScript, HTML, or CSS file. | ||
* @param filename The source filename, with extension. | ||
* @param options The transformation options. The `name` and the `namespace` of the component is the | ||
* minimum required for transformation. | ||
* @returns A promise resolving to an object with the generated code, source map and gathered metadata. | ||
* @example | ||
* const source = ` | ||
* import { LightningElement } from 'lwc'; | ||
* export default class App extends LightningElement {} | ||
* `; | ||
* const filename = 'app.js'; | ||
* const options = { | ||
* namespace: 'c', | ||
* name: 'app', | ||
* }; | ||
* const { code } = await transform(source, filename, options); | ||
* @deprecated Use {@linkcode transformSync} instead | ||
*/ | ||
export declare function transform(src: string, filename: string, options: TransformOptions): Promise<TransformResult>; | ||
/** | ||
* Transform the passed source code. Returning an object with the generated code, source map and | ||
* gathered metadata. | ||
* @param src | ||
* @param filename | ||
* @param options | ||
* Transform the passed source code | ||
* @param src The source to be transformed. Can be the content of a JavaScript, HTML, or CSS file. | ||
* @param filename The source filename, with extension. | ||
* @param options The transformation options. The `name` and the `namespace` of the component is the | ||
* minimum required for transformation. | ||
* @returns An object with the generated code, source map and gathered metadata. | ||
* @example | ||
* | ||
* const source = ` | ||
* import { LightningElement } from 'lwc'; | ||
* export default class App extends LightningElement {} | ||
* `; | ||
* const filename = 'app.js'; | ||
* const options = { | ||
* namespace: 'c', | ||
* name: 'app', | ||
* }; | ||
* const { code } = transformSync(source, filename, options); | ||
*/ | ||
export declare function transformSync(src: string, filename: string, options: TransformOptions): TransformResult; |
@@ -7,3 +7,3 @@ { | ||
"name": "@lwc/compiler", | ||
"version": "6.2.1", | ||
"version": "6.3.0", | ||
"description": "LWC compiler", | ||
@@ -52,8 +52,8 @@ "keywords": [ | ||
"@locker/babel-plugin-transform-unforgeables": "0.20.0", | ||
"@lwc/babel-plugin-component": "6.2.1", | ||
"@lwc/errors": "6.2.1", | ||
"@lwc/shared": "6.2.1", | ||
"@lwc/style-compiler": "6.2.1", | ||
"@lwc/template-compiler": "6.2.1" | ||
"@lwc/babel-plugin-component": "6.3.0", | ||
"@lwc/errors": "6.3.0", | ||
"@lwc/shared": "6.3.0", | ||
"@lwc/style-compiler": "6.3.0", | ||
"@lwc/template-compiler": "6.3.0" | ||
} | ||
} |
@@ -49,3 +49,3 @@ # LWC Compiler | ||
- `outputConfig` (type: `object`, optional) - see below: | ||
- `sourcemap` (type: `boolean`, optional) - if `true`, a sourcemap is generated for the transformed file. | ||
- `sourcemap` (type: `boolean` | `'inline'`, optional) - if `true`, a sourcemap is generated for the transformed file. If `'inline'`, an inline sourcemap is generated and appended to the transformed file. | ||
- `minify` (type: `boolean`, optional, deprecated) - this option has no effect. | ||
@@ -52,0 +52,0 @@ - `experimentalComplexExpressions` (type: `boolean`, optional) - set to true to enable use of (a subset of) JavaScript expressions in place of template bindings. Passed to `@lwc/template-compiler`. |
Sorry, the diff of this file is not supported yet
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
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
77239
1162
+ Added@lwc/babel-plugin-component@6.3.0(transitive)
+ Added@lwc/errors@6.3.0(transitive)
+ Added@lwc/shared@6.3.0(transitive)
+ Added@lwc/style-compiler@6.3.0(transitive)
+ Added@lwc/template-compiler@6.3.0(transitive)
- Removed@lwc/babel-plugin-component@6.2.1(transitive)
- Removed@lwc/errors@6.2.1(transitive)
- Removed@lwc/shared@6.2.1(transitive)
- Removed@lwc/style-compiler@6.2.1(transitive)
- Removed@lwc/template-compiler@6.2.1(transitive)
Updated@lwc/errors@6.3.0
Updated@lwc/shared@6.3.0
Updated@lwc/style-compiler@6.3.0
Updated@lwc/template-compiler@6.3.0