@zengenti/contensis-react-base 4.0.1-beta.1 → 4.0.1-beta.11
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/cjs/{App-Bg1MzW4V.js → App-95IjaQXT.js} +26 -22
- package/cjs/App-95IjaQXT.js.map +1 -0
- package/cjs/{ChangePassword.container-C4Du3Wb1.js → ChangePassword.container-CVwXfQjB.js} +7 -5
- package/cjs/ChangePassword.container-CVwXfQjB.js.map +1 -0
- package/cjs/{ContensisDeliveryApi-MfcvdfDR.js → ContensisDeliveryApi-vsHVQ_Ci.js} +46 -21
- package/cjs/ContensisDeliveryApi-vsHVQ_Ci.js.map +1 -0
- package/cjs/{RouteLoader-DJeM8cym.js → RouteLoader-NjuQ0VMn.js} +11 -7
- package/cjs/RouteLoader-NjuQ0VMn.js.map +1 -0
- package/cjs/{SSRContext-tMufQDHY.js → SSRContext-WPN0QwEg.js} +2 -2
- package/cjs/{SSRContext-tMufQDHY.js.map → SSRContext-WPN0QwEg.js.map} +1 -1
- package/cjs/{VersionInfo-zFPsvS8q.js → VersionInfo-BygZuA9D.js} +3 -3
- package/cjs/{VersionInfo-zFPsvS8q.js.map → VersionInfo-BygZuA9D.js.map} +1 -1
- package/cjs/build.js +219 -0
- package/cjs/build.js.map +1 -0
- package/cjs/client.js +13 -13
- package/cjs/contensis-react-base.js +39 -24
- package/cjs/contensis-react-base.js.map +1 -1
- package/cjs/dev-server-globals.js +21 -0
- package/cjs/dev-server-globals.js.map +1 -0
- package/cjs/{matchGroups-dqONU-vY.js → matchGroups-D8QZEd1p.js} +2 -2
- package/cjs/{matchGroups-dqONU-vY.js.map → matchGroups-D8QZEd1p.js.map} +1 -1
- package/cjs/redux.js +7 -7
- package/cjs/redux.js.map +1 -1
- package/cjs/routing.js +10 -10
- package/cjs/{sagas-BCy9u6zA.js → sagas-BG31QdkC.js} +8 -6
- package/cjs/sagas-BG31QdkC.js.map +1 -0
- package/cjs/search.js +6 -6
- package/cjs/{selectors-BrxJ8-F8.js → selectors-BnaBk5xL.js} +24 -20
- package/cjs/selectors-BnaBk5xL.js.map +1 -0
- package/cjs/{store-B7SJs5Hf.js → store-Ccwrx5Do.js} +14 -8
- package/cjs/store-Ccwrx5Do.js.map +1 -0
- package/cjs/user.js +3 -3
- package/cjs/{util-eOjxDjxF.js → util-LE7KTRCU.js} +5 -2
- package/cjs/util-LE7KTRCU.js.map +1 -0
- package/cjs/util.js +6 -6
- package/cjs/{version-yjHMrfVz.js → version-AE19NqSo.js} +3 -3
- package/cjs/{version-yjHMrfVz.js.map → version-AE19NqSo.js.map} +1 -1
- package/cjs/{version-rFG9Y6_B.js → version-CaRCM9vq.js} +2 -2
- package/cjs/{version-rFG9Y6_B.js.map → version-CaRCM9vq.js.map} +1 -1
- package/esm/{App-Bplaqueq.js → App-DvfrUH4b.js} +27 -23
- package/esm/App-DvfrUH4b.js.map +1 -0
- package/esm/{ChangePassword.container-CUBtn82K.js → ChangePassword.container-BlSy5eHk.js} +8 -6
- package/esm/ChangePassword.container-BlSy5eHk.js.map +1 -0
- package/esm/{ContensisDeliveryApi-LWYXevZ1.js → ContensisDeliveryApi-Czq1gBOi.js} +46 -21
- package/esm/ContensisDeliveryApi-Czq1gBOi.js.map +1 -0
- package/esm/{RouteLoader-CzrlySZf.js → RouteLoader-CAVJs2rj.js} +14 -10
- package/esm/RouteLoader-CAVJs2rj.js.map +1 -0
- package/esm/{SSRContext-Bxtg1KGv.js → SSRContext-DqqZUlqT.js} +2 -2
- package/esm/{SSRContext-Bxtg1KGv.js.map → SSRContext-DqqZUlqT.js.map} +1 -1
- package/esm/{VersionInfo-By2ZCZOh.js → VersionInfo-BinQYaU1.js} +6 -6
- package/esm/{VersionInfo-By2ZCZOh.js.map → VersionInfo-BinQYaU1.js.map} +1 -1
- package/esm/build.js +208 -0
- package/esm/build.js.map +1 -0
- package/esm/client.js +15 -15
- package/esm/contensis-react-base.js +41 -26
- package/esm/contensis-react-base.js.map +1 -1
- package/esm/dev-server-globals.js +15 -0
- package/esm/dev-server-globals.js.map +1 -0
- package/esm/i18n.js +2 -2
- package/esm/{matchGroups-_w8BwzCC.js → matchGroups-C2_rxOIO.js} +3 -3
- package/esm/{matchGroups-_w8BwzCC.js.map → matchGroups-C2_rxOIO.js.map} +1 -1
- package/esm/redux.js +7 -7
- package/esm/routing.js +7 -7
- package/esm/{sagas-Fr9yRduO.js → sagas-BN4gNmmc.js} +10 -8
- package/esm/sagas-BN4gNmmc.js.map +1 -0
- package/esm/search.js +9 -9
- package/esm/{selectors-DcmvOeX2.js → selectors-D4ulaTom.js} +2 -2
- package/esm/{selectors-DcmvOeX2.js.map → selectors-D4ulaTom.js.map} +1 -1
- package/esm/{selectors-8ROQrTd7.js → selectors-Dj45vPZR.js} +21 -13
- package/esm/selectors-Dj45vPZR.js.map +1 -0
- package/esm/{store-B4IrBYHm.js → store-Cxe7mlLh.js} +16 -10
- package/esm/store-Cxe7mlLh.js.map +1 -0
- package/esm/user.js +5 -5
- package/esm/{util-Bl2u6LpY.js → util-DHWbLSvO.js} +6 -3
- package/esm/util-DHWbLSvO.js.map +1 -0
- package/esm/util.js +6 -6
- package/esm/{version-CA9Mdm3A.js → version-Cy-gb20a.js} +4 -4
- package/esm/{version-CA9Mdm3A.js.map → version-Cy-gb20a.js.map} +1 -1
- package/esm/{version-BQAL8sQO.js → version-hQnuV0n7.js} +3 -3
- package/esm/{version-BQAL8sQO.js.map → version-hQnuV0n7.js.map} +1 -1
- package/models/build/cli.d.ts +2 -0
- package/models/build/dev-server-runtime-globals.d.ts +1 -0
- package/models/build/dev-server.d.ts +12 -0
- package/models/i18n/redux/slice.d.ts +170 -60
- package/models/models/config/ServerConfig.d.ts +9 -0
- package/models/routing/redux/actions.d.ts +17 -1
- package/models/routing/redux/selectors.d.ts +4 -4
- package/models/routing/redux/types.d.ts +1 -1
- package/models/search/redux/sagas.d.ts +1 -1
- package/models/server/features/reverse-proxy/index.d.ts +3 -2
- package/models/server/util/getVersionInfo.d.ts +8 -0
- package/models/user/redux/sagas/login.d.ts +1 -1
- package/models/user/util/OidcUserManager.d.ts +2 -18
- package/models/util/ContensisDeliveryApi.d.ts +1 -1
- package/models/util/donotuse_useHistory.d.ts +3 -3
- package/models/util/env.d.ts +1 -0
- package/models/util/navigation.d.ts +1 -1
- package/package.json +53 -36
- package/cjs/App-Bg1MzW4V.js.map +0 -1
- package/cjs/ChangePassword.container-C4Du3Wb1.js.map +0 -1
- package/cjs/ContensisDeliveryApi-MfcvdfDR.js.map +0 -1
- package/cjs/RouteLoader-DJeM8cym.js.map +0 -1
- package/cjs/sagas-BCy9u6zA.js.map +0 -1
- package/cjs/selectors-BrxJ8-F8.js.map +0 -1
- package/cjs/store-B7SJs5Hf.js.map +0 -1
- package/cjs/util-eOjxDjxF.js.map +0 -1
- package/esm/App-Bplaqueq.js.map +0 -1
- package/esm/ChangePassword.container-CUBtn82K.js.map +0 -1
- package/esm/ContensisDeliveryApi-LWYXevZ1.js.map +0 -1
- package/esm/RouteLoader-CzrlySZf.js.map +0 -1
- package/esm/sagas-Fr9yRduO.js.map +0 -1
- package/esm/selectors-8ROQrTd7.js.map +0 -1
- package/esm/store-B4IrBYHm.js.map +0 -1
- package/esm/util-Bl2u6LpY.js.map +0 -1
package/esm/build.js
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { cac } from 'cac';
|
|
3
|
+
import { execSync } from 'child_process';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import fs from 'fs';
|
|
6
|
+
import dotenv from 'dotenv';
|
|
7
|
+
import nodemon from 'nodemon';
|
|
8
|
+
import webpack from 'webpack';
|
|
9
|
+
import WebpackDevServer from 'webpack-dev-server';
|
|
10
|
+
|
|
11
|
+
const projectRoot = process.cwd();
|
|
12
|
+
const DEVSERVER_RUNTIME_GLOBALS = path.resolve(__dirname, 'dev-server-globals.js');
|
|
13
|
+
function runDev(args) {
|
|
14
|
+
const configPath = args.config;
|
|
15
|
+
const devHost = args.devHost || 'localhost';
|
|
16
|
+
const devPort = args.devPort || '3000';
|
|
17
|
+
const devListen = args.devListen || '0.0.0.0';
|
|
18
|
+
const openBrowser = args.open !== false;
|
|
19
|
+
|
|
20
|
+
// --inspect-brk takes precedence over --inspect.
|
|
21
|
+
// A bare flag (no port value) resolves to true in cac — treat that as the default port.
|
|
22
|
+
const resolveInspectPort = val => val === true || val === undefined ? '9229' : String(val);
|
|
23
|
+
const inspectNodeArg = args.inspectBrk !== undefined ? `--inspect-brk=${resolveInspectPort(args.inspectBrk)}` : `--inspect=${resolveInspectPort(args.inspect)}`;
|
|
24
|
+
|
|
25
|
+
// Validate --config option
|
|
26
|
+
if (!configPath) {
|
|
27
|
+
console.error('[crb] ❌ Error: --config option is required');
|
|
28
|
+
console.log('Usage: crb dev --config <path-to-webpack-config> [--dev-host <host>] [--dev-port <port>] [--dev-listen <host>] [--inspect[=port]] [--inspect-brk[=port]]');
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
console.info('[crb] 🚀 Starting SSR dev server pipeline');
|
|
32
|
+
const resolvedConfigPath = path.resolve(projectRoot, configPath);
|
|
33
|
+
|
|
34
|
+
// Check config file exists
|
|
35
|
+
if (!fs.existsSync(resolvedConfigPath)) {
|
|
36
|
+
console.error(`[crb] ❌ Error: Config file not found: ${resolvedConfigPath}`);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Set default host and port
|
|
41
|
+
process.env.DEV_HOST = devHost;
|
|
42
|
+
process.env.DEV_PORT = devPort;
|
|
43
|
+
|
|
44
|
+
// Load .env file
|
|
45
|
+
const envFilePath = path.resolve(projectRoot, args.envFile || '.env');
|
|
46
|
+
try {
|
|
47
|
+
dotenv.config({
|
|
48
|
+
path: envFilePath
|
|
49
|
+
});
|
|
50
|
+
} catch (e) {
|
|
51
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
52
|
+
console.error(`[crb] ❌ Error: Failed to load env file (${envFilePath}): ${msg}`);
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Validate required environment variables
|
|
57
|
+
const REQUIRED_ENV = ['ALIAS', 'PROJECT', 'ACCESS_TOKEN'];
|
|
58
|
+
const missingEnv = REQUIRED_ENV.filter(k => !process.env[k] || !process.env[k].trim());
|
|
59
|
+
if (missingEnv.length) {
|
|
60
|
+
console.error(`[crb] ❌ Error: Cannot start dev server. Missing required env vars: ${missingEnv.join(', ')}. ` + `Set them in a .env file at the project root or export them in your shell.`);
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Load project webpack config
|
|
65
|
+
let webpackConfig;
|
|
66
|
+
try {
|
|
67
|
+
webpackConfig = require(resolvedConfigPath);
|
|
68
|
+
} catch (e) {
|
|
69
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
70
|
+
console.error(`[crb] ❌ Error: Failed to load webpack config: ${msg}`);
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Validate webpack config is an array (dual-target mode)
|
|
75
|
+
if (!Array.isArray(webpackConfig)) {
|
|
76
|
+
console.error(`[crb] ❌ Error: webpack config must be an array [clientConfig, serverConfig]. ` + `The config appears to be a single object (CSR/ANALYZE mode). ` + `Use the unified webpack.config.js for SSR dev mode.`);
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
79
|
+
const [clientConfig, serverConfig] = webpackConfig;
|
|
80
|
+
|
|
81
|
+
// State flags for orchestration
|
|
82
|
+
let clientReady = false;
|
|
83
|
+
let serverReady = false;
|
|
84
|
+
let nodemonStarted = false;
|
|
85
|
+
let browserOpened = false;
|
|
86
|
+
|
|
87
|
+
// Nodemon reference for cleanup
|
|
88
|
+
let nodemonInstance = null;
|
|
89
|
+
|
|
90
|
+
// Dev server options
|
|
91
|
+
const devServerOptions = {
|
|
92
|
+
host: devListen,
|
|
93
|
+
port: parseInt(devPort, 10),
|
|
94
|
+
headers: {
|
|
95
|
+
'Access-Control-Allow-Origin': '*'
|
|
96
|
+
},
|
|
97
|
+
hot: true,
|
|
98
|
+
historyApiFallback: true,
|
|
99
|
+
devMiddleware: {
|
|
100
|
+
index: 'index_csr.html',
|
|
101
|
+
writeToDisk: true
|
|
102
|
+
}
|
|
103
|
+
// TODO: Add proxy config from bundle-info.js (DEVSERVER_PROXIES)
|
|
104
|
+
// to proxy API calls and reverse proxy paths to CMS/IIS
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// Create dual webpack compilers (single config each → single Compiler, not MultiCompiler)
|
|
108
|
+
const clientCompiler = webpack(clientConfig);
|
|
109
|
+
const nodeServerCompiler = webpack(serverConfig);
|
|
110
|
+
|
|
111
|
+
// Start nodemon when both compilers are ready
|
|
112
|
+
function startNodemon() {
|
|
113
|
+
if (nodemonStarted) return;
|
|
114
|
+
nodemonStarted = true;
|
|
115
|
+
console.info('[crb] 🎯 Starting nodemon...');
|
|
116
|
+
nodemonInstance = nodemon({
|
|
117
|
+
script: 'dist/server-dev.js',
|
|
118
|
+
ext: 'js json',
|
|
119
|
+
watch: ['dist/server-dev.js'],
|
|
120
|
+
nodeArgs: [inspectNodeArg, '-r', DEVSERVER_RUNTIME_GLOBALS]
|
|
121
|
+
}).on('start', () => {
|
|
122
|
+
console.info('[nodemon] started. Now starting local web server at port 3001, with hot-reload enabled.');
|
|
123
|
+
if (openBrowser && !browserOpened) {
|
|
124
|
+
browserOpened = true;
|
|
125
|
+
try {
|
|
126
|
+
const cmd = process.platform === 'win32' ? 'start' : process.platform === 'darwin' ? 'open' : 'xdg-open';
|
|
127
|
+
execSync(`${cmd} http://${process.env.DEV_HOST}:3001/`, {
|
|
128
|
+
windowsHide: true
|
|
129
|
+
});
|
|
130
|
+
} catch {
|
|
131
|
+
console.info(`Please open http://${process.env.DEV_HOST}:3001/ in your browser`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}).on('crash', () => {
|
|
135
|
+
console.error('[nodemon] crashed');
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Server afterEmit -> start nodemon when both compilers are ready
|
|
140
|
+
nodeServerCompiler.hooks.afterEmit.tap('serverAfterEmitPlugin', () => {
|
|
141
|
+
if (serverReady) return;
|
|
142
|
+
serverReady = true;
|
|
143
|
+
if (clientReady) {
|
|
144
|
+
startNodemon();
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
// Start server compiler watch immediately
|
|
149
|
+
console.info('[crb] 📦 Starting server compiler...');
|
|
150
|
+
nodeServerCompiler.watch({}, (err, stats) => {
|
|
151
|
+
if (err) {
|
|
152
|
+
return console.error(err);
|
|
153
|
+
}
|
|
154
|
+
const statString = stats.toString();
|
|
155
|
+
process.stdout.write(statString + '\n');
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
// Client afterEmit -> start nodemon if server is already ready
|
|
159
|
+
clientCompiler.hooks.afterEmit.tap('clientAfterEmitPlugin', () => {
|
|
160
|
+
if (clientReady) return;
|
|
161
|
+
clientReady = true;
|
|
162
|
+
if (serverReady) {
|
|
163
|
+
startNodemon();
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
// Start webpack dev server
|
|
168
|
+
const devServer = new WebpackDevServer(devServerOptions, clientCompiler);
|
|
169
|
+
devServer.startCallback(err => {
|
|
170
|
+
if (err) {
|
|
171
|
+
console.error('[webpack] devServer listening failed');
|
|
172
|
+
return console.error(err);
|
|
173
|
+
}
|
|
174
|
+
console.info(`[webpack] devServer listening on port ${devPort}`);
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
// Cleanup on SIGTERM/SIGINT
|
|
178
|
+
function cleanup() {
|
|
179
|
+
console.info('[crb] 🛑 Shutting down...');
|
|
180
|
+
if (nodemonInstance) {
|
|
181
|
+
nodemonInstance.emit('quit');
|
|
182
|
+
}
|
|
183
|
+
devServer.stopCallback(() => {
|
|
184
|
+
console.info('[webpack] devServer stopped');
|
|
185
|
+
clientCompiler.close(() => {
|
|
186
|
+
console.info('[webpack] client compiler closed');
|
|
187
|
+
nodeServerCompiler.close(() => {
|
|
188
|
+
console.info('[webpack] server compiler closed');
|
|
189
|
+
process.exit(0);
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
process.on('SIGTERM', cleanup);
|
|
195
|
+
process.on('SIGINT', cleanup);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const cli = cac('crb');
|
|
199
|
+
|
|
200
|
+
// Dev subcommand
|
|
201
|
+
cli.command('dev', 'Start the SSR dev server pipeline').option('--config <path>', 'Path to webpack config file (required)').option('--env-file <path>', 'Path to .env file (default: .env)').option('--dev-host <host>', 'webpack publicPath / HMR host (default: localhost)').option('--dev-port <port>', 'webpack-dev-server listen port (default: 3000)').option('--dev-listen <host>', 'webpack-dev-server listen host (default: 0.0.0.0)').option('--open', 'Open the browser when the SSR server starts. Use --no-open to disable. (default: true)').option('--inspect [port]', 'Enable the V8 inspector on the SSR server. Optionally specify a port (default: 9229)').option('--inspect-brk [port]', 'Enable the V8 inspector and break before the script starts — useful for debugging server startup. Optionally specify a port (default: 9229). Takes precedence over --inspect.').action(runDev);
|
|
202
|
+
cli.help();
|
|
203
|
+
cli.parse();
|
|
204
|
+
if (!cli.matchedCommand) {
|
|
205
|
+
cli.outputHelp();
|
|
206
|
+
process.exit(1);
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=build.js.map
|
package/esm/build.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sources":["../src/build/dev-server.ts","../src/build/cli.ts"],"sourcesContent":["import { execSync } from 'child_process';\nimport path from 'path';\nimport fs from 'fs';\nimport dotenv from 'dotenv';\n// @ts-ignore — nodemon has no type definitions\nimport nodemon from 'nodemon';\nimport webpack from 'webpack';\nimport WebpackDevServer from 'webpack-dev-server';\nconst projectRoot = process.cwd();\nconst DEVSERVER_RUNTIME_GLOBALS = path.resolve(__dirname, 'dev-server-globals.js');\n\ninterface DevOptions {\n config?: string;\n envFile?: string;\n devHost?: string;\n devPort?: string;\n devListen?: string;\n open?: boolean;\n inspect?: boolean | string;\n inspectBrk?: boolean | string;\n}\n\nexport function runDev(args: DevOptions): void {\n const configPath = args.config;\n const devHost = args.devHost || 'localhost';\n const devPort = args.devPort || '3000';\n const devListen = args.devListen || '0.0.0.0';\n const openBrowser = args.open !== false;\n\n // --inspect-brk takes precedence over --inspect.\n // A bare flag (no port value) resolves to true in cac — treat that as the default port.\n const resolveInspectPort = (val: boolean | string | undefined) =>\n val === true || val === undefined ? '9229' : String(val);\n const inspectNodeArg =\n args.inspectBrk !== undefined\n ? `--inspect-brk=${resolveInspectPort(args.inspectBrk)}`\n : `--inspect=${resolveInspectPort(args.inspect)}`;\n\n // Validate --config option\n if (!configPath) {\n console.error('[crb] ❌ Error: --config option is required');\n console.log(\n 'Usage: crb dev --config <path-to-webpack-config> [--dev-host <host>] [--dev-port <port>] [--dev-listen <host>] [--inspect[=port]] [--inspect-brk[=port]]'\n );\n process.exit(1);\n }\n\n console.info('[crb] 🚀 Starting SSR dev server pipeline');\n\n const resolvedConfigPath = path.resolve(projectRoot, configPath);\n\n // Check config file exists\n if (!fs.existsSync(resolvedConfigPath)) {\n console.error(\n `[crb] ❌ Error: Config file not found: ${resolvedConfigPath}`\n );\n process.exit(1);\n }\n\n // Set default host and port\n process.env.DEV_HOST = devHost;\n process.env.DEV_PORT = devPort;\n\n // Load .env file\n const envFilePath = path.resolve(projectRoot, args.envFile || '.env');\n try {\n dotenv.config({ path: envFilePath });\n } catch (e: unknown) {\n const msg = e instanceof Error ? e.message : String(e);\n console.error(\n `[crb] ❌ Error: Failed to load env file (${envFilePath}): ${msg}`\n );\n process.exit(1);\n }\n\n // Validate required environment variables\n const REQUIRED_ENV: string[] = ['ALIAS', 'PROJECT', 'ACCESS_TOKEN'];\n const missingEnv = REQUIRED_ENV.filter(\n (k) => !process.env[k] || !process.env[k].trim()\n );\n if (missingEnv.length) {\n console.error(\n `[crb] ❌ Error: Cannot start dev server. Missing required env vars: ${missingEnv.join(', ')}. ` +\n `Set them in a .env file at the project root or export them in your shell.`\n );\n process.exit(1);\n }\n\n // Load project webpack config\n let webpackConfig: unknown;\n try {\n webpackConfig = require(resolvedConfigPath);\n } catch (e: unknown) {\n const msg = e instanceof Error ? e.message : String(e);\n console.error(\n `[crb] ❌ Error: Failed to load webpack config: ${msg}`\n );\n process.exit(1);\n }\n\n // Validate webpack config is an array (dual-target mode)\n if (!Array.isArray(webpackConfig)) {\n console.error(\n `[crb] ❌ Error: webpack config must be an array [clientConfig, serverConfig]. ` +\n `The config appears to be a single object (CSR/ANALYZE mode). ` +\n `Use the unified webpack.config.js for SSR dev mode.`\n );\n process.exit(1);\n }\n\n const [clientConfig, serverConfig] = webpackConfig as [webpack.Configuration, webpack.Configuration];\n\n // State flags for orchestration\n let clientReady = false;\n let serverReady = false;\n let nodemonStarted = false;\n let browserOpened = false;\n\n // Nodemon reference for cleanup\n let nodemonInstance: ReturnType<typeof nodemon> | null = null;\n\n // Dev server options\n const devServerOptions = {\n host: devListen,\n port: parseInt(devPort, 10),\n headers: { 'Access-Control-Allow-Origin': '*' },\n hot: true,\n historyApiFallback: true,\n devMiddleware: {\n index: 'index_csr.html',\n writeToDisk: true,\n },\n // TODO: Add proxy config from bundle-info.js (DEVSERVER_PROXIES)\n // to proxy API calls and reverse proxy paths to CMS/IIS\n };\n\n // Create dual webpack compilers (single config each → single Compiler, not MultiCompiler)\n const clientCompiler = webpack(clientConfig);\n const nodeServerCompiler = webpack(serverConfig);\n\n // Start nodemon when both compilers are ready\n function startNodemon(): void {\n if (nodemonStarted) return;\n nodemonStarted = true;\n\n console.info('[crb] 🎯 Starting nodemon...');\n nodemonInstance = nodemon({\n script: 'dist/server-dev.js',\n ext: 'js json',\n watch: ['dist/server-dev.js'],\n nodeArgs: [\n inspectNodeArg,\n '-r',\n DEVSERVER_RUNTIME_GLOBALS,\n ],\n })\n .on('start', () => {\n console.info(\n '[nodemon] started. Now starting local web server at port 3001, with hot-reload enabled.'\n );\n if (openBrowser && !browserOpened) {\n browserOpened = true;\n try {\n const cmd =\n process.platform === 'win32'\n ? 'start'\n : process.platform === 'darwin'\n ? 'open'\n : 'xdg-open';\n execSync(`${cmd} http://${process.env.DEV_HOST}:3001/`, {\n windowsHide: true,\n });\n } catch {\n console.info(\n `Please open http://${process.env.DEV_HOST}:3001/ in your browser`\n );\n }\n }\n })\n .on('crash', () => {\n console.error('[nodemon] crashed');\n });\n }\n\n // Server afterEmit -> start nodemon when both compilers are ready\n nodeServerCompiler.hooks.afterEmit.tap('serverAfterEmitPlugin', () => {\n if (serverReady) return;\n serverReady = true;\n\n if (clientReady) {\n startNodemon();\n }\n });\n\n // Start server compiler watch immediately\n console.info('[crb] 📦 Starting server compiler...');\n nodeServerCompiler.watch({}, (err, stats) => {\n if (err) {\n return console.error(err);\n }\n const statString = stats!.toString();\n process.stdout.write(statString + '\\n');\n });\n\n // Client afterEmit -> start nodemon if server is already ready\n clientCompiler.hooks.afterEmit.tap('clientAfterEmitPlugin', () => {\n if (clientReady) return;\n clientReady = true;\n\n if (serverReady) {\n startNodemon();\n }\n });\n\n // Start webpack dev server\n const devServer = new WebpackDevServer(devServerOptions, clientCompiler);\n\n devServer.startCallback((err) => {\n if (err) {\n console.error('[webpack] devServer listening failed');\n return console.error(err);\n }\n console.info(`[webpack] devServer listening on port ${devPort}`);\n });\n\n // Cleanup on SIGTERM/SIGINT\n function cleanup(): void {\n console.info('[crb] 🛑 Shutting down...');\n if (nodemonInstance) {\n nodemonInstance.emit('quit');\n }\n devServer.stopCallback(() => {\n console.info('[webpack] devServer stopped');\n clientCompiler.close(() => {\n console.info('[webpack] client compiler closed');\n nodeServerCompiler.close(() => {\n console.info('[webpack] server compiler closed');\n process.exit(0);\n });\n });\n });\n }\n\n process.on('SIGTERM', cleanup);\n process.on('SIGINT', cleanup);\n}\n","#!/usr/bin/env node\n\nimport { cac } from 'cac';\nimport { runDev } from './dev-server';\n\nconst cli = cac('crb');\n\n// Dev subcommand\ncli\n .command('dev', 'Start the SSR dev server pipeline')\n .option('--config <path>', 'Path to webpack config file (required)')\n .option('--env-file <path>', 'Path to .env file (default: .env)')\n .option(\n '--dev-host <host>',\n 'webpack publicPath / HMR host (default: localhost)'\n )\n .option('--dev-port <port>', 'webpack-dev-server listen port (default: 3000)')\n .option(\n '--dev-listen <host>',\n 'webpack-dev-server listen host (default: 0.0.0.0)'\n )\n .option(\n '--open',\n 'Open the browser when the SSR server starts. Use --no-open to disable. (default: true)'\n )\n .option(\n '--inspect [port]',\n 'Enable the V8 inspector on the SSR server. Optionally specify a port (default: 9229)'\n )\n .option(\n '--inspect-brk [port]',\n 'Enable the V8 inspector and break before the script starts — useful for debugging server startup. Optionally specify a port (default: 9229). Takes precedence over --inspect.'\n )\n .action(runDev);\n\ncli.help();\n\ncli.parse();\nif (!cli.matchedCommand) {\n cli.outputHelp();\n process.exit(1);\n}\n"],"names":["projectRoot","process","cwd","DEVSERVER_RUNTIME_GLOBALS","path","resolve","__dirname","runDev","args","configPath","config","devHost","devPort","devListen","openBrowser","open","resolveInspectPort","val","undefined","String","inspectNodeArg","inspectBrk","inspect","console","error","log","exit","info","resolvedConfigPath","fs","existsSync","env","DEV_HOST","DEV_PORT","envFilePath","envFile","dotenv","e","msg","Error","message","REQUIRED_ENV","missingEnv","filter","k","trim","length","join","webpackConfig","require","Array","isArray","clientConfig","serverConfig","clientReady","serverReady","nodemonStarted","browserOpened","nodemonInstance","devServerOptions","host","port","parseInt","headers","hot","historyApiFallback","devMiddleware","index","writeToDisk","clientCompiler","webpack","nodeServerCompiler","startNodemon","nodemon","script","ext","watch","nodeArgs","on","cmd","platform","execSync","windowsHide","hooks","afterEmit","tap","err","stats","statString","toString","stdout","write","devServer","WebpackDevServer","startCallback","cleanup","emit","stopCallback","close","cli","cac","command","option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AAM,CACL,mBAAmB,EACnB,oDACF,CAAC,CACAA,MAAM,CAAC,mBAAmB,EAAE,gDAAgD,CAAC,CAC7EA,MAAM,CACL,qBAAqB,EACrB,mDACF,CAAC,CACAA,MAAM,CACL,QAAQ,EACR,wFACF,CAAC,CACAA,MAAM,CACL,kBAAkB,EAClB,sFACF,CAAC,CACAA,MAAM,CACL,sBAAsB,EACtB,+KACF,CAAC,CACAC,MAAM,CAAChG,MAAM,CAAC;AAEjB4F,GAAG,CAACK,IAAI,EAAE;AAEVL,GAAG,CAACM,KAAK,EAAE;AACX,IAAI,CAACN,GAAG,CAACO,cAAc,EAAE;EACvBP,GAAG,CAACQ,UAAU,EAAE;AAChB1G,EAAAA,OAAO,CAACyB,IAAI,CAAC,CAAC,CAAC;AACjB"}
|
package/esm/client.js
CHANGED
|
@@ -7,39 +7,39 @@ import { loadableReady } from '@loadable/component';
|
|
|
7
7
|
import { parse } from 'query-string';
|
|
8
8
|
import { CookiesProvider } from 'react-cookie';
|
|
9
9
|
import { HelmetProvider } from 'react-helmet-async';
|
|
10
|
-
import { c as createLocaleRoutes, b as browserHistory, r as rootSaga, p as pickProject } from './App-
|
|
11
|
-
export { A as ReactApp } from './App-
|
|
10
|
+
import { c as createLocaleRoutes, b as browserHistory, r as rootSaga, p as pickProject } from './App-DvfrUH4b.js';
|
|
11
|
+
export { A as ReactApp } from './App-DvfrUH4b.js';
|
|
12
12
|
import { a as actions } from './slice-C6JLQik8.js';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { d as deliveryApi } from './ContensisDeliveryApi-
|
|
18
|
-
import { S as SSRContextProvider } from './SSRContext-
|
|
13
|
+
import { b as selectVersionStatus } from './version-hQnuV0n7.js';
|
|
14
|
+
import { c as setVersionStatus } from './version-Cy-gb20a.js';
|
|
15
|
+
import { d as createStore } from './store-Cxe7mlLh.js';
|
|
16
|
+
import { a4 as setCurrentProject } from './selectors-Dj45vPZR.js';
|
|
17
|
+
import { d as deliveryApi } from './ContensisDeliveryApi-Czq1gBOi.js';
|
|
18
|
+
import { S as SSRContextProvider } from './SSRContext-DqqZUlqT.js';
|
|
19
19
|
import 'history';
|
|
20
20
|
import '@redux-saga/core/effects';
|
|
21
21
|
import 'loglevel';
|
|
22
22
|
import 'await-to-js';
|
|
23
23
|
import 'redux-saga';
|
|
24
24
|
import 'contensis-delivery-api';
|
|
25
|
-
import './VersionInfo-
|
|
25
|
+
import './VersionInfo-BinQYaU1.js';
|
|
26
26
|
import './_commonjsHelpers-BFTU3MAI.js';
|
|
27
27
|
import 'jsonpath-mapper';
|
|
28
28
|
import 'styled-components';
|
|
29
|
-
import './selectors-
|
|
30
|
-
import './ChangePassword.container-
|
|
31
|
-
import './matchGroups-
|
|
29
|
+
import './selectors-D4ulaTom.js';
|
|
30
|
+
import './ChangePassword.container-BlSy5eHk.js';
|
|
31
|
+
import './matchGroups-C2_rxOIO.js';
|
|
32
32
|
import './CookieConstants-DEmbwzYr.js';
|
|
33
33
|
import './CookieHelper.class-C6rTRl_1.js';
|
|
34
34
|
import './ToJs-BnRRHk6f.js';
|
|
35
|
-
import './sagas-
|
|
35
|
+
import './sagas-BN4gNmmc.js';
|
|
36
36
|
import 'reselect';
|
|
37
|
-
import './util-
|
|
37
|
+
import './util-DHWbLSvO.js';
|
|
38
38
|
import 'contensis-core-api';
|
|
39
39
|
import 'deepmerge';
|
|
40
40
|
import 'immer';
|
|
41
41
|
import 'deep-equal';
|
|
42
|
-
import './RouteLoader-
|
|
42
|
+
import './RouteLoader-CAVJs2rj.js';
|
|
43
43
|
import '@reduxjs/toolkit';
|
|
44
44
|
import 'redux';
|
|
45
45
|
import 'redux-thunk';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { c as cachedSearch, d as deliveryApi } from './ContensisDeliveryApi-
|
|
1
|
+
import { c as cachedSearch, d as deliveryApi } from './ContensisDeliveryApi-Czq1gBOi.js';
|
|
2
2
|
import { Query as Query$1 } from 'contensis-delivery-api';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Provider } from 'react-redux';
|
|
5
5
|
import { a as actions } from './slice-C6JLQik8.js';
|
|
6
6
|
import mapJson from 'jsonpath-mapper';
|
|
7
|
-
import {
|
|
7
|
+
import { p as defaultExpressions, n as contentTypeIdExpression, s as filterExpressions, _ as termExpressions, T as orderByExpression, o as customWhereExpressions, m as cloneDeep } from './sagas-BN4gNmmc.js';
|
|
8
8
|
import 'reselect';
|
|
9
9
|
import 'immer';
|
|
10
10
|
import 'deep-equal';
|
|
@@ -16,8 +16,8 @@ import 'isomorphic-fetch';
|
|
|
16
16
|
import express from 'express';
|
|
17
17
|
import http from 'http';
|
|
18
18
|
import httpProxy from 'http-proxy';
|
|
19
|
-
import { s as shorten, c as createLocaleRoutes, h as history, p as pickProject, r as rootSaga } from './App-
|
|
20
|
-
export { A as ReactApp } from './App-
|
|
19
|
+
import { s as shorten, c as createLocaleRoutes, h as history, p as pickProject, r as rootSaga } from './App-DvfrUH4b.js';
|
|
20
|
+
export { A as ReactApp } from './App-DvfrUH4b.js';
|
|
21
21
|
import fs from 'fs';
|
|
22
22
|
import path from 'path';
|
|
23
23
|
import appRootPath from 'app-root-path';
|
|
@@ -30,10 +30,10 @@ import { noop, identity } from 'lodash';
|
|
|
30
30
|
import { buildCleaner } from 'lodash-clean';
|
|
31
31
|
import { a as Cookies } from './CookieHelper.class-C6rTRl_1.js';
|
|
32
32
|
import cookiesMiddleware from 'universal-cookie-express';
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import { H as HttpContext, m as mergeStaticRoutes } from './RouteLoader-
|
|
33
|
+
import { d as createStore } from './store-Cxe7mlLh.js';
|
|
34
|
+
import { c as setVersionStatus, s as setVersion } from './version-Cy-gb20a.js';
|
|
35
|
+
import { a2 as selectSurrogateKeys, a0 as selectSsrApiCalls, O as selectRouteEntry, I as selectCurrentProject, x as getImmutableOrJS, a4 as setCurrentProject, J as selectCurrentSearch } from './selectors-Dj45vPZR.js';
|
|
36
|
+
import { H as HttpContext, m as mergeStaticRoutes } from './RouteLoader-CAVJs2rj.js';
|
|
37
37
|
import { Transform } from 'stream';
|
|
38
38
|
import { ChunkExtractor, ChunkExtractorManager } from '@loadable/server';
|
|
39
39
|
import chalk from 'chalk';
|
|
@@ -41,21 +41,21 @@ import minifyCssString from 'minify-css-string';
|
|
|
41
41
|
import { CookiesProvider } from 'react-cookie';
|
|
42
42
|
import { HelmetProvider } from 'react-helmet-async';
|
|
43
43
|
import { StaticRouter } from 'react-router-dom/server';
|
|
44
|
-
import { S as SSRContextProvider, g as getSubsitePath } from './SSRContext-
|
|
45
|
-
import './VersionInfo-
|
|
44
|
+
import { S as SSRContextProvider, g as getSubsitePath } from './SSRContext-DqqZUlqT.js';
|
|
45
|
+
import './VersionInfo-BinQYaU1.js';
|
|
46
46
|
import './CookieConstants-DEmbwzYr.js';
|
|
47
47
|
import '@reduxjs/toolkit';
|
|
48
48
|
import 'loglevel';
|
|
49
49
|
import '@redux-saga/core/effects';
|
|
50
|
-
import './version-
|
|
51
|
-
import './util-
|
|
52
|
-
import './selectors-
|
|
50
|
+
import './version-hQnuV0n7.js';
|
|
51
|
+
import './util-DHWbLSvO.js';
|
|
52
|
+
import './selectors-D4ulaTom.js';
|
|
53
53
|
import './_commonjsHelpers-BFTU3MAI.js';
|
|
54
54
|
import 'history';
|
|
55
55
|
import 'await-to-js';
|
|
56
56
|
import 'redux-saga';
|
|
57
|
-
import './ChangePassword.container-
|
|
58
|
-
import './matchGroups-
|
|
57
|
+
import './ChangePassword.container-BlSy5eHk.js';
|
|
58
|
+
import './matchGroups-C2_rxOIO.js';
|
|
59
59
|
import './ToJs-BnRRHk6f.js';
|
|
60
60
|
import 'redux';
|
|
61
61
|
import 'redux-thunk';
|
|
@@ -1089,13 +1089,24 @@ const getBundleTags = (loadableExtractor, scripts, staticRoutePath = 'static') =
|
|
|
1089
1089
|
return startupTag;
|
|
1090
1090
|
};
|
|
1091
1091
|
|
|
1092
|
+
/**
|
|
1093
|
+
* Arguably deprecated functionality driven by a version.json file
|
|
1094
|
+
* injected into the container from the CI build process.
|
|
1095
|
+
* This is used to provide version information for the application
|
|
1096
|
+
* such as the commit id and the build number.
|
|
1097
|
+
* @param staticFolderPath if the app is not built into the `dist/static` folder, we can provide a different path to the static folder.
|
|
1098
|
+
* @returns version.json as a JSON object, or an empty object if the file cannot be read.
|
|
1099
|
+
*/
|
|
1092
1100
|
const getVersionInfo = staticFolderPath => {
|
|
1093
1101
|
try {
|
|
1094
1102
|
const versionData = fs.readFileSync(`dist/${staticFolderPath}/version.json`, 'utf8');
|
|
1095
1103
|
const versionInfo = JSON.parse(versionData);
|
|
1096
1104
|
return versionInfo;
|
|
1097
1105
|
} catch (ex) {
|
|
1098
|
-
|
|
1106
|
+
// We don't need to log this error as it is just noise in the logs
|
|
1107
|
+
// when the version.json file is not constructed and injected into
|
|
1108
|
+
// the build container or a development stub included in the project.
|
|
1109
|
+
// console.error(`Unable to read from "version.json"`, ex);
|
|
1099
1110
|
return {};
|
|
1100
1111
|
}
|
|
1101
1112
|
};
|
|
@@ -1125,7 +1136,7 @@ const addStandardHeaders = (state, response, packagejson, groups) => {
|
|
|
1125
1136
|
try {
|
|
1126
1137
|
const routingSurrogateKeys = selectSurrogateKeys(state);
|
|
1127
1138
|
const apiCalls = selectSsrApiCalls(state);
|
|
1128
|
-
const anyApiError = !!apiCalls.find(
|
|
1139
|
+
const anyApiError = !!apiCalls.find(call => call.statusCode >= 400);
|
|
1129
1140
|
|
|
1130
1141
|
// Check length of surrogate keys and prevent potential header overflow errors in prod
|
|
1131
1142
|
// Check for any error set in the page response
|
|
@@ -1298,7 +1309,10 @@ const webApp = (app, ReactApp, config) => {
|
|
|
1298
1309
|
let isRenderingJsxToString = config.renderToString || false;
|
|
1299
1310
|
const bundleData = getBundleData(config, staticRoutePath);
|
|
1300
1311
|
const attributes = stringifyAttributes(scripts.attributes);
|
|
1301
|
-
scripts.startup =
|
|
1312
|
+
scripts.startup =
|
|
1313
|
+
// We don't need the startup script with SSR in development
|
|
1314
|
+
// as globals are baked into the client-side development bundles
|
|
1315
|
+
process.env.NODE_ENV === 'development' ? undefined : scripts.startup || startupScriptFilename;
|
|
1302
1316
|
let responseHandler = handleResponse;
|
|
1303
1317
|
if (typeof handleResponses === 'function') {
|
|
1304
1318
|
responseHandler = handleResponses;
|
|
@@ -1451,7 +1465,7 @@ const webApp = (app, ReactApp, config) => {
|
|
|
1451
1465
|
|
|
1452
1466
|
// Render the JSX server side and send response as per access method options
|
|
1453
1467
|
if (!accessMethod.DYNAMIC) {
|
|
1454
|
-
store.runSaga(rootSaga(withSagas)).toPromise().then(() => {
|
|
1468
|
+
store.runSaga(rootSaga(withSagas)).toPromise().then(async () => {
|
|
1455
1469
|
var _selectCurrentSearch;
|
|
1456
1470
|
const reduxState = store.getState();
|
|
1457
1471
|
let clonedState = buildCleaner({
|
|
@@ -1531,6 +1545,13 @@ const webApp = (app, ReactApp, config) => {
|
|
|
1531
1545
|
let title = helmet.title.toString().includes('><') ? helmetAsync.title.toString() : helmet.title.toString();
|
|
1532
1546
|
const metadata = helmetAsync.meta.toString().concat(helmetAsync.base.toString()).concat(helmetAsync.priority.toString()).concat(helmetAsync.link.toString()).concat(helmetAsync.script.toString()).concat(helmetAsync.noscript.toString()).concat(helmet.meta.toString()).concat(helmet.base.toString()).concat(helmet.link.toString()).concat(helmet.script.toString()).concat(helmet.noscript.toString());
|
|
1533
1547
|
try {
|
|
1548
|
+
var _config$styles, _loadableExtractor$mo, _loadableExtractor$mo2;
|
|
1549
|
+
// Getting style tags generated by "CSS Modules" because they will be
|
|
1550
|
+
// available to loadable stats if we have built parts of the app with CSS
|
|
1551
|
+
// plugins that are not within styled-components
|
|
1552
|
+
// Render inline styles for CSS Modules if configured
|
|
1553
|
+
const cssModuleStyles = (_config$styles = config.styles) !== null && _config$styles !== void 0 && _config$styles.inline ? await (loadableExtractor === null || loadableExtractor === void 0 || (_loadableExtractor$mo = loadableExtractor.modern) === null || _loadableExtractor$mo === void 0 ? void 0 : _loadableExtractor$mo.getInlineStyleTags()) : loadableExtractor === null || loadableExtractor === void 0 || (_loadableExtractor$mo2 = loadableExtractor.modern) === null || _loadableExtractor$mo2 === void 0 ? void 0 : _loadableExtractor$mo2.getStyleTags();
|
|
1554
|
+
|
|
1534
1555
|
/**
|
|
1535
1556
|
* Loads all page assets into the provided templateHTML
|
|
1536
1557
|
*
|
|
@@ -1541,7 +1562,6 @@ const webApp = (app, ReactApp, config) => {
|
|
|
1541
1562
|
* if the context has requested a redirect
|
|
1542
1563
|
* */
|
|
1543
1564
|
const getContextHtml = (isFinal = false, styleTags, renderedJsxMarkup) => {
|
|
1544
|
-
var _loadableExtractor$mo;
|
|
1545
1565
|
if (context.url) {
|
|
1546
1566
|
response.redirect(context.statusCode || 302, context.url);
|
|
1547
1567
|
return '';
|
|
@@ -1556,18 +1576,13 @@ const webApp = (app, ReactApp, config) => {
|
|
|
1556
1576
|
// Set response.status from React StaticRouter
|
|
1557
1577
|
if (typeof context.statusCode === 'number') response.status(context.statusCode);
|
|
1558
1578
|
const bundleTags = isFinal ? getBundleTags(loadableExtractor, scripts, staticRoutePath) : '';
|
|
1559
|
-
|
|
1560
|
-
// Getting style tags generated by "CSS Modules" because they will be
|
|
1561
|
-
// available to loadable stats if we have built parts of the app with CSS
|
|
1562
|
-
// plugins that are not within styled-components
|
|
1563
|
-
const styles = loadableExtractor === null || loadableExtractor === void 0 || (_loadableExtractor$mo = loadableExtractor.modern) === null || _loadableExtractor$mo === void 0 ? void 0 : _loadableExtractor$mo.getStyleTags();
|
|
1564
1579
|
const html = replaceHtml({
|
|
1565
1580
|
bundleTags,
|
|
1566
1581
|
html: renderedJsxMarkup,
|
|
1567
1582
|
htmlAttributes,
|
|
1568
1583
|
metadata,
|
|
1569
1584
|
state: serialisedReduxData,
|
|
1570
|
-
styleTags: `${styleTags || ''}${
|
|
1585
|
+
styleTags: `${styleTags || ''}${cssModuleStyles || ''}`,
|
|
1571
1586
|
title,
|
|
1572
1587
|
templateHTML,
|
|
1573
1588
|
templateHTMLFragment,
|