@lwrjs/lwc-module-provider 0.10.0-alpha.9 → 0.10.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/build/cjs/compiler.cjs +3 -1
- package/build/cjs/index.cjs +4 -1
- package/build/es/cache.d.ts +1 -1
- package/build/es/compiler.js +4 -2
- package/build/es/index.d.ts +3 -2
- package/build/es/index.js +4 -1
- package/package.json +8 -7
package/build/cjs/compiler.cjs
CHANGED
|
@@ -40,7 +40,7 @@ var DEFAULT_BABEL_CONFIG = {
|
|
|
40
40
|
};
|
|
41
41
|
var LwcCompiler = class {
|
|
42
42
|
async compileFile(source, config) {
|
|
43
|
-
const {name, namespace,
|
|
43
|
+
const {enableLightningWebSecurityTransforms, filename, name, namespace, scopedStyles} = config;
|
|
44
44
|
if (source.startsWith(import_utils.EXPLICIT_CONSTANT)) {
|
|
45
45
|
return {
|
|
46
46
|
code: source,
|
|
@@ -83,6 +83,8 @@ var LwcCompiler = class {
|
|
|
83
83
|
strictSpecifier: false
|
|
84
84
|
},
|
|
85
85
|
scopedStyles,
|
|
86
|
+
enableDynamicComponents: true,
|
|
87
|
+
enableLightningWebSecurityTransforms,
|
|
86
88
|
enableScopedSlots: true
|
|
87
89
|
};
|
|
88
90
|
import_shared_utils.logger.debug("transformSync", {filename, transformConfig});
|
package/build/cjs/index.cjs
CHANGED
|
@@ -37,7 +37,7 @@ function getModuleEntryCacheKey(specifier, version) {
|
|
|
37
37
|
var LwcModuleProvider = class {
|
|
38
38
|
constructor(options = {}, {
|
|
39
39
|
appEmitter,
|
|
40
|
-
config: {modules, rootDir, cacheDir, environment},
|
|
40
|
+
config: {locker, modules, rootDir, cacheDir, environment},
|
|
41
41
|
runtimeEnvironment: {watchFiles},
|
|
42
42
|
watcherFactory
|
|
43
43
|
}) {
|
|
@@ -51,6 +51,7 @@ var LwcModuleProvider = class {
|
|
|
51
51
|
this.inflightGetModuleEntryJobs = new import_shared_utils.InflightTasks();
|
|
52
52
|
const {disableCaching} = options;
|
|
53
53
|
this.emitter = appEmitter;
|
|
54
|
+
this.locker = locker;
|
|
54
55
|
this.modules = modules;
|
|
55
56
|
this.rootDir = rootDir;
|
|
56
57
|
this.watcher = watchFiles && watcherFactory ? (0, import_utils.setUpWatcher)(watcherFactory, this.onModuleChange.bind(this)) : void 0;
|
|
@@ -98,6 +99,7 @@ var LwcModuleProvider = class {
|
|
|
98
99
|
});
|
|
99
100
|
if (!compiledModule) {
|
|
100
101
|
const [name] = rawName.split("#");
|
|
102
|
+
const enableLightningWebSecurityTransforms = !!this.locker?.enabled && !this.locker?.clientOnly;
|
|
101
103
|
const scopedStyles = moduleEntry.entry.endsWith(".css") && moduleEntry.specifier.endsWith("?scoped=true");
|
|
102
104
|
import_shared_utils.logger.debug("[lwc-module-provider] compile", {
|
|
103
105
|
namespace,
|
|
@@ -109,6 +111,7 @@ var LwcModuleProvider = class {
|
|
|
109
111
|
namespace,
|
|
110
112
|
name,
|
|
111
113
|
filename: moduleEntry.entry,
|
|
114
|
+
enableLightningWebSecurityTransforms,
|
|
112
115
|
scopedStyles
|
|
113
116
|
});
|
|
114
117
|
import_shared_utils.logger.verbose("[lwc-module-provider] createGetModuleJob:compile compiledModule", {
|
package/build/es/cache.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ModuleSource, CompilerResult } from '@lwrjs/types';
|
|
1
|
+
import type { ModuleSource, CompilerResult } from '@lwrjs/types';
|
|
2
2
|
export declare const DEFAULT_COMPILED_DIR = "lwc_compiled_modules";
|
|
3
3
|
export declare const DEFAULT_CACHE_FOLDER = "cache";
|
|
4
4
|
export declare const DEFAULT_CACHE_INDEX = "compiled.json";
|
package/build/es/compiler.js
CHANGED
|
@@ -11,9 +11,9 @@ const DEFAULT_BABEL_CONFIG = {
|
|
|
11
11
|
},
|
|
12
12
|
};
|
|
13
13
|
export class LwcCompiler {
|
|
14
|
-
// compileFile takes a html, css,
|
|
14
|
+
// compileFile takes a html, css, typescript, etc, and transforms it to a es6 module
|
|
15
15
|
async compileFile(source, config) {
|
|
16
|
-
const { name, namespace,
|
|
16
|
+
const { enableLightningWebSecurityTransforms, filename, name, namespace, scopedStyles } = config;
|
|
17
17
|
if (source.startsWith(EXPLICIT_CONSTANT)) {
|
|
18
18
|
return {
|
|
19
19
|
code: source,
|
|
@@ -58,6 +58,8 @@ export class LwcCompiler {
|
|
|
58
58
|
strictSpecifier: false,
|
|
59
59
|
},
|
|
60
60
|
scopedStyles,
|
|
61
|
+
enableDynamicComponents: true,
|
|
62
|
+
enableLightningWebSecurityTransforms,
|
|
61
63
|
enableScopedSlots: true, // this flag turns on an additive feature and is backwards compatible
|
|
62
64
|
};
|
|
63
65
|
logger.debug('transformSync', { filename, transformConfig });
|
package/build/es/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ModuleCompiled, ModuleEntry, ModuleProvider, ModuleSource, ProviderContext, AbstractModuleId } from '@lwrjs/types';
|
|
1
|
+
import type { ModuleCompiled, ModuleEntry, ModuleProvider, ModuleSource, ProviderContext, AbstractModuleId } from '@lwrjs/types';
|
|
2
2
|
export interface LwcModuleProviderOptions {
|
|
3
3
|
disableCaching?: boolean;
|
|
4
4
|
}
|
|
@@ -7,6 +7,7 @@ export default class LwcModuleProvider implements ModuleProvider {
|
|
|
7
7
|
private rootDir;
|
|
8
8
|
private moduleFsCacheEnabled;
|
|
9
9
|
private interchangeableModulesEnabled;
|
|
10
|
+
private locker;
|
|
10
11
|
private lwcCacheDir?;
|
|
11
12
|
private lwcCacheIndex?;
|
|
12
13
|
private moduleSourceCache;
|
|
@@ -19,7 +20,7 @@ export default class LwcModuleProvider implements ModuleProvider {
|
|
|
19
20
|
private lwcCompiler;
|
|
20
21
|
private inflightGetModuleJobs;
|
|
21
22
|
private inflightGetModuleEntryJobs;
|
|
22
|
-
constructor(options: LwcModuleProviderOptions | undefined, { appEmitter, config: { modules, rootDir, cacheDir, environment }, runtimeEnvironment: { watchFiles }, watcherFactory, }: ProviderContext);
|
|
23
|
+
constructor(options: LwcModuleProviderOptions | undefined, { appEmitter, config: { locker, modules, rootDir, cacheDir, environment }, runtimeEnvironment: { watchFiles }, watcherFactory, }: ProviderContext);
|
|
23
24
|
onModuleChange(fileChanged: string): Promise<void>;
|
|
24
25
|
getModule(moduleId: AbstractModuleId): Promise<ModuleCompiled | undefined>;
|
|
25
26
|
/**
|
package/build/es/index.js
CHANGED
|
@@ -7,7 +7,7 @@ function getModuleEntryCacheKey(specifier, version) {
|
|
|
7
7
|
return `${specifier}@${version}`;
|
|
8
8
|
}
|
|
9
9
|
export default class LwcModuleProvider {
|
|
10
|
-
constructor(options = {}, { appEmitter, config: { modules, rootDir, cacheDir, environment }, runtimeEnvironment: { watchFiles }, watcherFactory, }) {
|
|
10
|
+
constructor(options = {}, { appEmitter, config: { locker, modules, rootDir, cacheDir, environment }, runtimeEnvironment: { watchFiles }, watcherFactory, }) {
|
|
11
11
|
this.name = 'lwc-module-provider';
|
|
12
12
|
this.moduleSourceCache = new Map();
|
|
13
13
|
this.packageVersionCache = new Map();
|
|
@@ -18,6 +18,7 @@ export default class LwcModuleProvider {
|
|
|
18
18
|
this.inflightGetModuleEntryJobs = new InflightTasks();
|
|
19
19
|
const { disableCaching } = options;
|
|
20
20
|
this.emitter = appEmitter;
|
|
21
|
+
this.locker = locker;
|
|
21
22
|
this.modules = modules;
|
|
22
23
|
this.rootDir = rootDir;
|
|
23
24
|
this.watcher =
|
|
@@ -74,6 +75,7 @@ export default class LwcModuleProvider {
|
|
|
74
75
|
});
|
|
75
76
|
if (!compiledModule) {
|
|
76
77
|
const [name] = rawName.split('#');
|
|
78
|
+
const enableLightningWebSecurityTransforms = !!this.locker?.enabled && !this.locker?.clientOnly;
|
|
77
79
|
const scopedStyles = moduleEntry.entry.endsWith('.css') && moduleEntry.specifier.endsWith('?scoped=true');
|
|
78
80
|
logger.debug('[lwc-module-provider] compile', {
|
|
79
81
|
namespace,
|
|
@@ -86,6 +88,7 @@ export default class LwcModuleProvider {
|
|
|
86
88
|
namespace,
|
|
87
89
|
name,
|
|
88
90
|
filename: moduleEntry.entry,
|
|
91
|
+
enableLightningWebSecurityTransforms,
|
|
89
92
|
scopedStyles,
|
|
90
93
|
});
|
|
91
94
|
logger.verbose('[lwc-module-provider] createGetModuleJob:compile compiledModule', {
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.10.0
|
|
7
|
+
"version": "0.10.0",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -31,15 +31,16 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/preset-typescript": "^7.9.0",
|
|
34
|
-
"@
|
|
35
|
-
"@lwrjs/shared-utils": "0.10.0-alpha.9",
|
|
36
|
-
"es-module-lexer": "^0.3.18"
|
|
34
|
+
"@lwrjs/shared-utils": "0.10.0"
|
|
37
35
|
},
|
|
38
36
|
"devDependencies": {
|
|
39
|
-
"@lwrjs/types": "0.10.0
|
|
37
|
+
"@lwrjs/types": "0.10.0"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"@lwc/module-resolver": "2.x || 3.x"
|
|
40
41
|
},
|
|
41
42
|
"engines": {
|
|
42
|
-
"node": ">=16.0.0
|
|
43
|
+
"node": ">=16.0.0"
|
|
43
44
|
},
|
|
44
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "e6deaeef3db8aa079acefed508897eca19b3218a"
|
|
45
46
|
}
|