@lwrjs/tools 0.10.0-alpha.9 → 0.11.0-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.
@@ -40,7 +40,8 @@ var services = getServices([
40
40
  "viewTransformers",
41
41
  "resourceProviders",
42
42
  "assetProviders",
43
- "assetTransformers"
43
+ "assetTransformers",
44
+ "uriTransformers"
44
45
  ]);
45
46
  function processServices(kind, entries, rootDir) {
46
47
  const output = {
@@ -60,11 +61,11 @@ function processHooks(hooksConfig, hooks, rootDir) {
60
61
  entries: []
61
62
  };
62
63
  for (const [index, [entry, config]] of hooksConfig.entries()) {
63
- if (!hooks[index].onStart) {
64
+ if (!hooks[index].onStart && !hooks[index].initInstrumentation) {
64
65
  continue;
65
66
  }
66
67
  if (hooks[index].initConfigs) {
67
- import_shared_utils.logger.warn("Consider splitting `initConfigs` hooks to a file separate from `onStart`.");
68
+ import_shared_utils.logger.warn("Consider splitting `initConfigs` hooks to a separate file.");
68
69
  }
69
70
  const name = "hook" + index;
70
71
  output.imports.push(`import ${name} from '${(0, import_shared_utils.normalizeDirectory)(entry, rootDir)}';`);
@@ -77,11 +78,11 @@ function processRouteHandlers(routeHandlers, rootDir) {
77
78
  imports: [],
78
79
  routeHandlers: {}
79
80
  };
80
- for (const [id, handlerPath] of Object.entries(routeHandlers)) {
81
+ for (const [id, [handler, options]] of Object.entries(routeHandlers)) {
81
82
  if (!output.routeHandlers[id]) {
82
83
  const name = `routeHandler${output.imports.length}`;
83
- output.imports.push(`import ${name} from '${(0, import_shared_utils.normalizeDirectory)(handlerPath, rootDir)}';`);
84
- output.routeHandlers[id] = name;
84
+ output.imports.push(`import ${name} from '${(0, import_shared_utils.normalizeDirectory)(handler, rootDir)}';`);
85
+ output.routeHandlers[id] = [name, options];
85
86
  }
86
87
  }
87
88
  return output;
@@ -98,8 +99,8 @@ function printHooks(hooks) {
98
99
  }).join(",")}]`;
99
100
  }
100
101
  function printRouteHandlers(routeHandlers) {
101
- return `{${Object.entries(routeHandlers).map(([id, handler]) => {
102
- return `'${id}': ${handler}`;
102
+ return `{${Object.entries(routeHandlers).map(([id, [handler, options]]) => {
103
+ return `'${id}': [${handler}, ${JSON.stringify(options)}]`;
103
104
  }).join(",")}}`;
104
105
  }
105
106
  function buildLwrServer(config, buildDir) {
@@ -13,6 +13,7 @@ const services = getServices([
13
13
  'resourceProviders',
14
14
  'assetProviders',
15
15
  'assetTransformers',
16
+ 'uriTransformers',
16
17
  ]);
17
18
  function processServices(kind, entries, rootDir) {
18
19
  const output = {
@@ -32,11 +33,11 @@ function processHooks(hooksConfig, hooks, rootDir) {
32
33
  entries: [],
33
34
  };
34
35
  for (const [index, [entry, config]] of hooksConfig.entries()) {
35
- if (!hooks[index].onStart) {
36
+ if (!hooks[index].onStart && !hooks[index].initInstrumentation) {
36
37
  continue;
37
38
  }
38
39
  if (hooks[index].initConfigs) {
39
- logger.warn('Consider splitting `initConfigs` hooks to a file separate from `onStart`.');
40
+ logger.warn('Consider splitting `initConfigs` hooks to a separate file.');
40
41
  }
41
42
  const name = 'hook' + index;
42
43
  output.imports.push(`import ${name} from '${normalizeDirectory(entry, rootDir)}';`);
@@ -49,11 +50,11 @@ function processRouteHandlers(routeHandlers, rootDir) {
49
50
  imports: [],
50
51
  routeHandlers: {},
51
52
  };
52
- for (const [id, handlerPath] of Object.entries(routeHandlers)) {
53
+ for (const [id, [handler, options]] of Object.entries(routeHandlers)) {
53
54
  if (!output.routeHandlers[id]) {
54
55
  const name = `routeHandler${output.imports.length}`;
55
- output.imports.push(`import ${name} from '${normalizeDirectory(handlerPath, rootDir)}';`);
56
- output.routeHandlers[id] = name;
56
+ output.imports.push(`import ${name} from '${normalizeDirectory(handler, rootDir)}';`);
57
+ output.routeHandlers[id] = [name, options];
57
58
  }
58
59
  }
59
60
  return output;
@@ -75,8 +76,8 @@ function printHooks(hooks) {
75
76
  }
76
77
  function printRouteHandlers(routeHandlers) {
77
78
  return `{${Object.entries(routeHandlers)
78
- .map(([id, handler]) => {
79
- return `'${id}': ${handler}`;
79
+ .map(([id, [handler, options]]) => {
80
+ return `'${id}': [${handler}, ${JSON.stringify(options)}]`;
80
81
  })
81
82
  .join(',')}}`;
82
83
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.10.0-alpha.9",
7
+ "version": "0.11.0-alpha.0",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -32,17 +32,17 @@
32
32
  "package.cjs"
33
33
  ],
34
34
  "dependencies": {
35
- "@lwrjs/core": "0.10.0-alpha.9",
35
+ "@lwrjs/core": "0.11.0-alpha.0",
36
36
  "esbuild": "^0.17.4"
37
37
  },
38
38
  "devDependencies": {
39
- "@lwrjs/types": "0.10.0-alpha.9"
39
+ "@lwrjs/types": "0.11.0-alpha.0"
40
40
  },
41
41
  "peerDependencies": {
42
- "lwc": "2.x"
42
+ "lwc": "2.x || 3.x"
43
43
  },
44
44
  "engines": {
45
- "node": ">=16.0.0 <20"
45
+ "node": ">=16.0.0"
46
46
  },
47
- "gitHead": "6da48f5164ac881396055096a6c1e3d0f8d981aa"
47
+ "gitHead": "6917abefe32752eeed0f9ba98505ca2b76f1df9d"
48
48
  }