@lwrjs/shared-utils 0.10.0-alpha.21 → 0.10.0-alpha.22

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.
@@ -25,11 +25,8 @@ var __toModule = (module2) => {
25
25
  __markAsModule(exports);
26
26
  __export(exports, {
27
27
  AMD_DEFINE: () => AMD_DEFINE,
28
- convertToAmd: () => convertToAmd,
29
- lockerize: () => lockerize
28
+ convertToAmd: () => convertToAmd
30
29
  });
31
- var import_identity = __toModule(require("./identity.cjs"));
32
- var import_compiler = __toModule(require("@locker/compiler"));
33
30
  var import_rollup = __toModule(require("rollup"));
34
31
  var AMD_DEFINE = "LWR.define";
35
32
  var AMD_ROLLUP_PLUGIN = function(rootId, source) {
@@ -61,20 +58,3 @@ async function convertToAmd(source, {id}, forceNamedExports = true) {
61
58
  const {code} = output[0];
62
59
  return {code, map: null};
63
60
  }
64
- function lockerize({compiledSource: source, specifier, moduleEntry: {entry: filename}}, {trustedComponents}, sourcemap = false) {
65
- const {namespace, name: rawName} = (0, import_identity.explodeSpecifier)(specifier);
66
- const [name] = rawName.split("#");
67
- const bareSpecifier = namespace ? `${namespace}/${name}` : name;
68
- const isJS = filename.endsWith(".js") || filename.endsWith(".mjs") || filename.endsWith(".ts");
69
- if (isJS && trustedComponents && !trustedComponents.includes(`${namespace}/*`) && !trustedComponents.includes(bareSpecifier)) {
70
- const {code} = import_compiler.Compiler.compile(source, {
71
- componentName: name,
72
- filename,
73
- sandboxKey: namespace || "sandbox",
74
- sourcemap,
75
- remapDynamicImport: true
76
- });
77
- return {code, map: null};
78
- }
79
- return {code: source, map: null};
80
- }
@@ -1,15 +1,10 @@
1
- import type { CompilerResult, LwrLockerConfig, ModuleCompiled } from '@lwrjs/types';
1
+ import type { CompilerResult } from '@lwrjs/types';
2
2
  /**
3
3
  * When importing these modules make sure the optional dependencies are installed:
4
4
  * - 'rollup' for convertToAmd()
5
- * - '@locker/compiler' for lockerize()
6
5
  */
7
6
  export declare const AMD_DEFINE = "LWR.define";
8
7
  export declare function convertToAmd(source: string, { id }: {
9
8
  id: string;
10
9
  }, forceNamedExports?: boolean): Promise<CompilerResult>;
11
- /** Locker
12
- * Trusted Components can contain namespaces with wildcard or single component
13
- */
14
- export declare function lockerize({ compiledSource: source, specifier, moduleEntry: { entry: filename } }: ModuleCompiled, { trustedComponents }: LwrLockerConfig, sourcemap?: boolean): CompilerResult;
15
10
  //# sourceMappingURL=compiler.d.ts.map
@@ -1,10 +1,7 @@
1
- import { explodeSpecifier } from './identity.js';
2
- import { Compiler as Locker } from '@locker/compiler';
3
1
  import { rollup } from 'rollup';
4
2
  /**
5
3
  * When importing these modules make sure the optional dependencies are installed:
6
4
  * - 'rollup' for convertToAmd()
7
- * - '@locker/compiler' for lockerize()
8
5
  */
9
6
  export const AMD_DEFINE = 'LWR.define';
10
7
  const AMD_ROLLUP_PLUGIN = function (rootId, source) {
@@ -37,29 +34,4 @@ export async function convertToAmd(source, { id }, forceNamedExports = true) {
37
34
  const { code } = output[0];
38
35
  return { code, map: null };
39
36
  }
40
- /** Locker
41
- * Trusted Components can contain namespaces with wildcard or single component
42
- */
43
- export function lockerize({ compiledSource: source, specifier, moduleEntry: { entry: filename } }, { trustedComponents }, sourcemap = false) {
44
- const { namespace, name: rawName } = explodeSpecifier(specifier);
45
- const [name] = rawName.split('#');
46
- const bareSpecifier = namespace ? `${namespace}/${name}` : name;
47
- const isJS = filename.endsWith('.js') || filename.endsWith('.mjs') || filename.endsWith('.ts');
48
- // lockerize if component is JS and is not explicitly trusted or in a trusted namespace
49
- if (isJS &&
50
- trustedComponents &&
51
- !trustedComponents.includes(`${namespace}/*`) &&
52
- !trustedComponents.includes(bareSpecifier)) {
53
- const { code } = Locker.compile(source, {
54
- componentName: name,
55
- filename,
56
- // put non-namespaced modules in a single sandbox - this should only be non-lwc npm modules
57
- sandboxKey: namespace || 'sandbox',
58
- sourcemap,
59
- remapDynamicImport: true, // support for dynamic imports
60
- });
61
- return { code, map: null };
62
- }
63
- return { code: source, map: null };
64
- }
65
37
  //# sourceMappingURL=compiler.js.map
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.10.0-alpha.21",
7
+ "version": "0.10.0-alpha.22",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -56,19 +56,18 @@
56
56
  "slugify": "^1.4.5"
57
57
  },
58
58
  "peerDependencies": {
59
- "@locker/compiler": "0.19.5",
60
59
  "chokidar": "^3.5.3",
61
60
  "esbuild": "^0.9.7",
62
61
  "rollup": "^2.78.0"
63
62
  },
64
63
  "devDependencies": {
65
- "@lwrjs/diagnostics": "0.10.0-alpha.21",
66
- "@lwrjs/types": "0.10.0-alpha.21",
64
+ "@lwrjs/diagnostics": "0.10.0-alpha.22",
65
+ "@lwrjs/types": "0.10.0-alpha.22",
67
66
  "@types/mime-types": "2.1.1",
68
67
  "@types/path-to-regexp": "^1.7.0"
69
68
  },
70
69
  "engines": {
71
70
  "node": ">=16.0.0"
72
71
  },
73
- "gitHead": "9213e6934ff9c90f32527d761754b6db75332593"
72
+ "gitHead": "ef991388d9158dbca91656d7ec7c0a641b477f4f"
74
73
  }