@lwc/ssr-compiler 9.0.4-alpha.2 → 9.1.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compile-js/types.d.ts +1 -1
- package/dist/{index.cjs.js → index.cjs} +11 -12
- package/dist/index.js +9 -10
- package/dist/shared.d.ts +1 -3
- package/package.json +12 -7
|
@@ -40,7 +40,7 @@ export interface ComponentMetaState {
|
|
|
40
40
|
/** indicates whether the LightningElement has any wired props */
|
|
41
41
|
wireAdapters: WireAdapter[];
|
|
42
42
|
/** dynamic imports configuration */
|
|
43
|
-
|
|
43
|
+
dynamicImports: ComponentTransformOptions['dynamicImports'];
|
|
44
44
|
/** imports to add to the top of the program after parsing */
|
|
45
45
|
importManager: ImportManager;
|
|
46
46
|
/** identifiers starting with __lwc that we added */
|
|
@@ -16,7 +16,7 @@ var node_path = require('node:path');
|
|
|
16
16
|
var templateCompiler = require('@lwc/template-compiler');
|
|
17
17
|
var builders = require('estree-toolkit/dist/builders');
|
|
18
18
|
var types = require('@babel/types');
|
|
19
|
-
var
|
|
19
|
+
var node_util = require('node:util');
|
|
20
20
|
|
|
21
21
|
/*
|
|
22
22
|
* Copyright (c) 2024, salesforce.com, inc.
|
|
@@ -837,12 +837,11 @@ function addGenerateMarkupFunction(program, state, tagName, filename) {
|
|
|
837
837
|
// At the time of generation, the invoker does not have reference to its tag name to pass as an argument.
|
|
838
838
|
const defaultTagName = estreeToolkit.builders.literal(tagName);
|
|
839
839
|
const classIdentifier = estreeToolkit.builders.identifier(state.lwcClassName);
|
|
840
|
-
let exposeTemplateBlock = null;
|
|
841
840
|
const defaultTmplPath = `./${node_path.parse(filename).name}.html`;
|
|
842
841
|
const tmplVar = estreeToolkit.builders.identifier('__lwcTmpl');
|
|
843
842
|
program.body.unshift(bImportDeclaration({ default: tmplVar.name }, defaultTmplPath));
|
|
844
843
|
program.body.unshift(bImportDeclaration({ SYMBOL__DEFAULT_TEMPLATE: '__SYMBOL__DEFAULT_TEMPLATE' }));
|
|
845
|
-
exposeTemplateBlock = bExposeTemplate(tmplVar, classIdentifier);
|
|
844
|
+
const exposeTemplateBlock = bExposeTemplate(tmplVar, classIdentifier);
|
|
846
845
|
// If no wire adapters are detected on the component, we don't bother injecting the wire-related code.
|
|
847
846
|
let connectWireAdapterCode = [];
|
|
848
847
|
if (state.wireAdapters.length) {
|
|
@@ -996,17 +995,17 @@ const visitors = {
|
|
|
996
995
|
removeDecoratorImport(path);
|
|
997
996
|
},
|
|
998
997
|
ImportExpression(path, state) {
|
|
999
|
-
const {
|
|
1000
|
-
if (!
|
|
1001
|
-
// if no `
|
|
998
|
+
const { dynamicImports, importManager } = state;
|
|
999
|
+
if (!dynamicImports) {
|
|
1000
|
+
// if no `dynamicImports` config, then leave dynamic `import()`s as-is
|
|
1002
1001
|
return;
|
|
1003
1002
|
}
|
|
1004
|
-
if (
|
|
1003
|
+
if (dynamicImports.strictSpecifier) {
|
|
1005
1004
|
if (!estreeToolkit.is.literal(path.node?.source) || typeof path.node.source.value !== 'string') {
|
|
1006
1005
|
throw generateError(path.node, errors.LWCClassErrors.INVALID_DYNAMIC_IMPORT_SOURCE_STRICT, estreeToolkit.is.literal(path.node?.source) ? String(path.node.source.value) : 'undefined');
|
|
1007
1006
|
}
|
|
1008
1007
|
}
|
|
1009
|
-
const loader =
|
|
1008
|
+
const loader = dynamicImports.loader;
|
|
1010
1009
|
if (!loader) {
|
|
1011
1010
|
// if no `loader` defined, then leave dynamic `import()`s as-is
|
|
1012
1011
|
return;
|
|
@@ -1214,7 +1213,7 @@ function compileJS(src, filename, tagName, options, compilationMode) {
|
|
|
1214
1213
|
publicProperties: new Map(),
|
|
1215
1214
|
privateProperties: new Set(),
|
|
1216
1215
|
wireAdapters: [],
|
|
1217
|
-
|
|
1216
|
+
dynamicImports: options.dynamicImports,
|
|
1218
1217
|
importManager: new ImportManager(),
|
|
1219
1218
|
trustedLwcIdentifiers: new WeakSet(),
|
|
1220
1219
|
};
|
|
@@ -2501,7 +2500,7 @@ const Root = function Root(node, cxt) {
|
|
|
2501
2500
|
return irChildrenToEs(node.children, cxt);
|
|
2502
2501
|
};
|
|
2503
2502
|
const defaultTransformer = (node) => {
|
|
2504
|
-
throw new Error(`Unimplemented IR node: ${
|
|
2503
|
+
throw new Error(`Unimplemented IR node: ${node_util.inspect(node)}`);
|
|
2505
2504
|
};
|
|
2506
2505
|
const transformers = {
|
|
2507
2506
|
Comment,
|
|
@@ -2716,5 +2715,5 @@ function compileTemplateForSSR(src, filename, options, mode = shared.DEFAULT_SSR
|
|
|
2716
2715
|
|
|
2717
2716
|
exports.compileComponentForSSR = compileComponentForSSR;
|
|
2718
2717
|
exports.compileTemplateForSSR = compileTemplateForSSR;
|
|
2719
|
-
/** version: 9.
|
|
2720
|
-
//# sourceMappingURL=index.cjs.
|
|
2718
|
+
/** version: 9.1.1-alpha.0 */
|
|
2719
|
+
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import { parse as parse$1 } from 'node:path';
|
|
|
12
12
|
import { generateScopeTokens, bindExpression, toPropertyName, kebabcaseToCamelcase, parse as parse$2 } from '@lwc/template-compiler';
|
|
13
13
|
import { builders as builders$1 } from 'estree-toolkit/dist/builders';
|
|
14
14
|
import { isValidES3Identifier } from '@babel/types';
|
|
15
|
-
import { inspect } from 'util';
|
|
15
|
+
import { inspect } from 'node:util';
|
|
16
16
|
|
|
17
17
|
/*
|
|
18
18
|
* Copyright (c) 2024, salesforce.com, inc.
|
|
@@ -833,12 +833,11 @@ function addGenerateMarkupFunction(program, state, tagName, filename) {
|
|
|
833
833
|
// At the time of generation, the invoker does not have reference to its tag name to pass as an argument.
|
|
834
834
|
const defaultTagName = builders.literal(tagName);
|
|
835
835
|
const classIdentifier = builders.identifier(state.lwcClassName);
|
|
836
|
-
let exposeTemplateBlock = null;
|
|
837
836
|
const defaultTmplPath = `./${parse$1(filename).name}.html`;
|
|
838
837
|
const tmplVar = builders.identifier('__lwcTmpl');
|
|
839
838
|
program.body.unshift(bImportDeclaration({ default: tmplVar.name }, defaultTmplPath));
|
|
840
839
|
program.body.unshift(bImportDeclaration({ SYMBOL__DEFAULT_TEMPLATE: '__SYMBOL__DEFAULT_TEMPLATE' }));
|
|
841
|
-
exposeTemplateBlock = bExposeTemplate(tmplVar, classIdentifier);
|
|
840
|
+
const exposeTemplateBlock = bExposeTemplate(tmplVar, classIdentifier);
|
|
842
841
|
// If no wire adapters are detected on the component, we don't bother injecting the wire-related code.
|
|
843
842
|
let connectWireAdapterCode = [];
|
|
844
843
|
if (state.wireAdapters.length) {
|
|
@@ -992,17 +991,17 @@ const visitors = {
|
|
|
992
991
|
removeDecoratorImport(path);
|
|
993
992
|
},
|
|
994
993
|
ImportExpression(path, state) {
|
|
995
|
-
const {
|
|
996
|
-
if (!
|
|
997
|
-
// if no `
|
|
994
|
+
const { dynamicImports, importManager } = state;
|
|
995
|
+
if (!dynamicImports) {
|
|
996
|
+
// if no `dynamicImports` config, then leave dynamic `import()`s as-is
|
|
998
997
|
return;
|
|
999
998
|
}
|
|
1000
|
-
if (
|
|
999
|
+
if (dynamicImports.strictSpecifier) {
|
|
1001
1000
|
if (!is.literal(path.node?.source) || typeof path.node.source.value !== 'string') {
|
|
1002
1001
|
throw generateError(path.node, LWCClassErrors.INVALID_DYNAMIC_IMPORT_SOURCE_STRICT, is.literal(path.node?.source) ? String(path.node.source.value) : 'undefined');
|
|
1003
1002
|
}
|
|
1004
1003
|
}
|
|
1005
|
-
const loader =
|
|
1004
|
+
const loader = dynamicImports.loader;
|
|
1006
1005
|
if (!loader) {
|
|
1007
1006
|
// if no `loader` defined, then leave dynamic `import()`s as-is
|
|
1008
1007
|
return;
|
|
@@ -1210,7 +1209,7 @@ function compileJS(src, filename, tagName, options, compilationMode) {
|
|
|
1210
1209
|
publicProperties: new Map(),
|
|
1211
1210
|
privateProperties: new Set(),
|
|
1212
1211
|
wireAdapters: [],
|
|
1213
|
-
|
|
1212
|
+
dynamicImports: options.dynamicImports,
|
|
1214
1213
|
importManager: new ImportManager(),
|
|
1215
1214
|
trustedLwcIdentifiers: new WeakSet(),
|
|
1216
1215
|
};
|
|
@@ -2711,5 +2710,5 @@ function compileTemplateForSSR(src, filename, options, mode = DEFAULT_SSR_MODE)
|
|
|
2711
2710
|
}
|
|
2712
2711
|
|
|
2713
2712
|
export { compileComponentForSSR, compileTemplateForSSR };
|
|
2714
|
-
/** version: 9.
|
|
2713
|
+
/** version: 9.1.1-alpha.0 */
|
|
2715
2714
|
//# sourceMappingURL=index.js.map
|
package/dist/shared.d.ts
CHANGED
|
@@ -2,7 +2,5 @@ import type { LwcBabelPluginOptions } from '@lwc/babel-plugin-component';
|
|
|
2
2
|
import type { Config as TemplateCompilerConfig } from '@lwc/template-compiler';
|
|
3
3
|
export type Expression = string;
|
|
4
4
|
export type TemplateTransformOptions = Pick<TemplateCompilerConfig, 'name' | 'namespace'>;
|
|
5
|
-
export type ComponentTransformOptions = Partial<Pick<LwcBabelPluginOptions, 'name' | 'namespace'
|
|
6
|
-
experimentalDynamicComponent?: LwcBabelPluginOptions['dynamicImports'];
|
|
7
|
-
};
|
|
5
|
+
export type ComponentTransformOptions = Partial<Pick<LwcBabelPluginOptions, 'name' | 'namespace' | 'dynamicImports'>>;
|
|
8
6
|
//# sourceMappingURL=shared.d.ts.map
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"You can safely modify dependencies, devDependencies, keywords, etc., but other props will be overwritten."
|
|
5
5
|
],
|
|
6
6
|
"name": "@lwc/ssr-compiler",
|
|
7
|
-
"version": "9.
|
|
7
|
+
"version": "9.1.1-alpha.0",
|
|
8
8
|
"description": "Compile component for use during server-side rendering",
|
|
9
9
|
"keywords": [
|
|
10
10
|
"compiler",
|
|
@@ -21,17 +21,22 @@
|
|
|
21
21
|
"url": "https://github.com/salesforce/lwc/issues"
|
|
22
22
|
},
|
|
23
23
|
"license": "MIT",
|
|
24
|
+
"type": "module",
|
|
24
25
|
"publishConfig": {
|
|
25
26
|
"access": "public"
|
|
26
27
|
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=16.6.0"
|
|
30
|
+
},
|
|
27
31
|
"volta": {
|
|
28
32
|
"extends": "../../../package.json"
|
|
29
33
|
},
|
|
30
|
-
"main": "dist/index.
|
|
34
|
+
"main": "dist/index.js",
|
|
31
35
|
"module": "dist/index.js",
|
|
32
36
|
"types": "dist/index.d.ts",
|
|
33
37
|
"files": [
|
|
34
38
|
"dist/**/*.js",
|
|
39
|
+
"dist/**/*.cjs",
|
|
35
40
|
"dist/**/*.d.ts"
|
|
36
41
|
],
|
|
37
42
|
"scripts": {
|
|
@@ -49,17 +54,17 @@
|
|
|
49
54
|
},
|
|
50
55
|
"dependencies": {
|
|
51
56
|
"@babel/types": "7.29.0",
|
|
52
|
-
"@lwc/errors": "9.
|
|
53
|
-
"@lwc/shared": "9.
|
|
54
|
-
"@lwc/template-compiler": "9.
|
|
57
|
+
"@lwc/errors": "9.1.1-alpha.0",
|
|
58
|
+
"@lwc/shared": "9.1.1-alpha.0",
|
|
59
|
+
"@lwc/template-compiler": "9.1.1-alpha.0",
|
|
55
60
|
"acorn": "8.16.0",
|
|
56
61
|
"astring": "^1.9.0",
|
|
57
62
|
"estree-toolkit": "^1.7.13",
|
|
58
63
|
"immer": "^11.1.4",
|
|
59
|
-
"meriyah": "^
|
|
64
|
+
"meriyah": "^7.1.0"
|
|
60
65
|
},
|
|
61
66
|
"devDependencies": {
|
|
62
|
-
"@lwc/babel-plugin-component": "9.
|
|
67
|
+
"@lwc/babel-plugin-component": "9.1.1-alpha.0",
|
|
63
68
|
"@types/estree": "^1.0.8"
|
|
64
69
|
}
|
|
65
70
|
}
|