@lwrjs/tools 0.15.0-alpha.13 → 0.15.0-alpha.15

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.
@@ -108,8 +108,6 @@ function printRouteHandlers(routeHandlers) {
108
108
  }).join(",")}}`;
109
109
  }
110
110
  function buildLwrServer(config, buildDir) {
111
- process.env.SINGLE_RENDER_MODE = "true";
112
- process.env.REEVALUATE_MODULES = "true";
113
111
  return {
114
112
  name: "lwr-server-build",
115
113
  setup(build) {
@@ -15,11 +15,12 @@ function getMainScriptContent() {
15
15
  }
16
16
  function getEnvironmentSetup() {
17
17
  return `
18
- // Manually Invoke a SSR request
19
-
20
18
  // Overwrite Envs from SSR.js
21
- process.env.ASSETS_ON_LAMBDA = 'true';
22
19
  process.env.LWR_TRACING = 'off';
20
+ // Suppress TLS checking for now
21
+ process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0;
22
+ // Set SSR timeout to 30 seconds (allow override)
23
+ process.env.SSR_TIMEOUT = process.env.SSR_TIMEOUT ?? 30000;
23
24
 
24
25
  // Lambda Envs (required by pwa-kit runtime)
25
26
  process.env.AWS_LAMBDA_FUNCTION_NAME = 'get';
@@ -48,6 +49,10 @@ function getHandlerFunction() {
48
49
  if (error) {
49
50
  return reject(error);
50
51
  } else {
52
+ // Check if we wanted to override the artifactPath
53
+ if (input.artifactPath && result.body) {
54
+ result.body = result.body.replaceAll(/\\/mobify\\/bundle\\/[a-z0-9]*\\//g, input.artifactPath);
55
+ }
51
56
  resolve(result);
52
57
  }
53
58
  });
@@ -123,6 +128,10 @@ function getParseArguments() {
123
128
  case '-o':
124
129
  options.output = value;
125
130
  break;
131
+ case '--artifactPath':
132
+ case '-a':
133
+ options.artifactPath = value;
134
+ break;
126
135
  }
127
136
  });
128
137
 
@@ -134,7 +143,7 @@ function getPrintHelpMessage() {
134
143
  return `
135
144
  function printHelpMessage() {
136
145
  console.log(
137
- 'Usage: node your-script.js [options]\\n' +
146
+ 'Usage: node index.js [options]\\n' +
138
147
  '\\n' +
139
148
  'Options:\\n' +
140
149
  ' -H, --host=<host> Specify the host\\n' +
@@ -142,11 +151,12 @@ function getPrintHelpMessage() {
142
151
  ' -b, --basePath=<basePath> Specify the base path\\n' +
143
152
  ' -P, --path=<path> Specify the input path (default: ' + DEFAULT_INPUT.path + ')\\n' +
144
153
  ' -o, --output=<output> Specify the output file path\\n' +
154
+ ' -a, --artifactPath=<path> Replace /mobify/bundle/xxx/ with a path provided (e.g. /webruntime/ssr-in-core/)\\n' +
145
155
  ' -h, --help Show this help message\\n' +
146
156
  '\\n' +
147
157
  'Example:\\n' +
148
- ' node your-script.js --host=localhost --proto=http --basePath=/api --path=/data --output=result.json\\n' +
149
- ' node your-script.js -H=localhost -p=http -b=/api -P=/data -o=result.json\\n'
158
+ ' node index.js --host=localhost --proto=http --basePath=/api --path=/data --output=result.json\\n' +
159
+ ' node index.js -H=localhost -p=http -b=/api -P=/data -o=result.json\\n'
150
160
  );
151
161
  }
152
162
  `;
@@ -169,6 +179,10 @@ function getUpdateInput() {
169
179
  if (args.path) {
170
180
  input.path = args.path;
171
181
  }
182
+
183
+ if (args.artifactPath) {
184
+ input.artifactPath = args.artifactPath;
185
+ }
172
186
 
173
187
  return input;
174
188
  }
@@ -100,10 +100,6 @@ function printRouteHandlers(routeHandlers) {
100
100
  * @returns esbuild plugin
101
101
  */
102
102
  export default function buildLwrServer(config, buildDir) {
103
- // Lambda always runs one request at a time
104
- process.env.SINGLE_RENDER_MODE = 'true';
105
- // TODO: remove once W-16104831 is resolved
106
- process.env.REEVALUATE_MODULES = 'true';
107
103
  return {
108
104
  name: 'lwr-server-build',
109
105
  setup(build) {
@@ -10,11 +10,12 @@ export function getMainScriptContent() {
10
10
  }
11
11
  function getEnvironmentSetup() {
12
12
  return `
13
- // Manually Invoke a SSR request
14
-
15
13
  // Overwrite Envs from SSR.js
16
- process.env.ASSETS_ON_LAMBDA = 'true';
17
14
  process.env.LWR_TRACING = 'off';
15
+ // Suppress TLS checking for now
16
+ process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0;
17
+ // Set SSR timeout to 30 seconds (allow override)
18
+ process.env.SSR_TIMEOUT = process.env.SSR_TIMEOUT ?? 30000;
18
19
 
19
20
  // Lambda Envs (required by pwa-kit runtime)
20
21
  process.env.AWS_LAMBDA_FUNCTION_NAME = 'get';
@@ -43,6 +44,10 @@ function getHandlerFunction() {
43
44
  if (error) {
44
45
  return reject(error);
45
46
  } else {
47
+ // Check if we wanted to override the artifactPath
48
+ if (input.artifactPath && result.body) {
49
+ result.body = result.body.replaceAll(/\\/mobify\\/bundle\\/[a-z0-9]*\\//g, input.artifactPath);
50
+ }
46
51
  resolve(result);
47
52
  }
48
53
  });
@@ -118,6 +123,10 @@ function getParseArguments() {
118
123
  case '-o':
119
124
  options.output = value;
120
125
  break;
126
+ case '--artifactPath':
127
+ case '-a':
128
+ options.artifactPath = value;
129
+ break;
121
130
  }
122
131
  });
123
132
 
@@ -129,7 +138,7 @@ function getPrintHelpMessage() {
129
138
  return `
130
139
  function printHelpMessage() {
131
140
  console.log(
132
- 'Usage: node your-script.js [options]\\n' +
141
+ 'Usage: node index.js [options]\\n' +
133
142
  '\\n' +
134
143
  'Options:\\n' +
135
144
  ' -H, --host=<host> Specify the host\\n' +
@@ -137,11 +146,12 @@ function getPrintHelpMessage() {
137
146
  ' -b, --basePath=<basePath> Specify the base path\\n' +
138
147
  ' -P, --path=<path> Specify the input path (default: ' + DEFAULT_INPUT.path + ')\\n' +
139
148
  ' -o, --output=<output> Specify the output file path\\n' +
149
+ ' -a, --artifactPath=<path> Replace /mobify/bundle/xxx/ with a path provided (e.g. /webruntime/ssr-in-core/)\\n' +
140
150
  ' -h, --help Show this help message\\n' +
141
151
  '\\n' +
142
152
  'Example:\\n' +
143
- ' node your-script.js --host=localhost --proto=http --basePath=/api --path=/data --output=result.json\\n' +
144
- ' node your-script.js -H=localhost -p=http -b=/api -P=/data -o=result.json\\n'
153
+ ' node index.js --host=localhost --proto=http --basePath=/api --path=/data --output=result.json\\n' +
154
+ ' node index.js -H=localhost -p=http -b=/api -P=/data -o=result.json\\n'
145
155
  );
146
156
  }
147
157
  `;
@@ -164,6 +174,10 @@ function getUpdateInput() {
164
174
  if (args.path) {
165
175
  input.path = args.path;
166
176
  }
177
+
178
+ if (args.artifactPath) {
179
+ input.artifactPath = args.artifactPath;
180
+ }
167
181
 
168
182
  return input;
169
183
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.15.0-alpha.13",
7
+ "version": "0.15.0-alpha.15",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -34,16 +34,16 @@
34
34
  "package.cjs"
35
35
  ],
36
36
  "dependencies": {
37
- "@lwrjs/config": "0.15.0-alpha.13",
38
- "@lwrjs/core": "0.15.0-alpha.13",
39
- "@lwrjs/diagnostics": "0.15.0-alpha.13",
40
- "@lwrjs/shared-utils": "0.15.0-alpha.13",
41
- "@lwrjs/static": "0.15.0-alpha.13",
37
+ "@lwrjs/config": "0.15.0-alpha.15",
38
+ "@lwrjs/core": "0.15.0-alpha.15",
39
+ "@lwrjs/diagnostics": "0.15.0-alpha.15",
40
+ "@lwrjs/shared-utils": "0.15.0-alpha.15",
41
+ "@lwrjs/static": "0.15.0-alpha.15",
42
42
  "esbuild": "^0.17.4",
43
43
  "fs-extra": "^11.2.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@lwrjs/types": "0.15.0-alpha.13",
46
+ "@lwrjs/types": "0.15.0-alpha.15",
47
47
  "jest": "^26.6.3",
48
48
  "ts-jest": "^26.5.6"
49
49
  },
@@ -56,5 +56,5 @@
56
56
  "volta": {
57
57
  "extends": "../../../package.json"
58
58
  },
59
- "gitHead": "687327a328b33a1abc3ac45e1406d72ebe7d37b4"
59
+ "gitHead": "6399f18c87c36ded4daf9d90360a7e044a769394"
60
60
  }