MCPcopy
hub / github.com/QwikDev/qwik / submoduleServer

Function submoduleServer

scripts/submodule-server.ts:13–85  ·  view source on GitHub ↗
(config: BuildConfig)

Source from the content-addressed store, hash-verified

11 * utilities for prerendering and unit testing.
12 */
13export async function submoduleServer(config: BuildConfig) {
14 const submodule = 'server';
15
16 const qwikDomPlugin = await bundleQwikDom(config);
17 const qwikDomVersion = await getQwikDomVersion(config);
18
19 const opts: BuildOptions = {
20 entryPoints: [join(config.srcQwikDir, submodule, 'index.ts')],
21 entryNames: 'server',
22 outdir: config.distQwikPkgDir,
23 sourcemap: config.dev,
24 bundle: true,
25 platform: 'node',
26 target,
27 external: [
28 /* no Node.js built-in externals allowed! */
29 '@builder.io/qwik/build',
30 '@builder.io/qwik/preloader',
31 '@qwik-client-manifest',
32 ],
33 };
34
35 const esm = build({
36 ...opts,
37 format: 'esm',
38 banner: { js: getBanner('@builder.io/qwik/server', config.distVersion) },
39 outExtension: { '.js': '.mjs' },
40 plugins: [importPath(/^@builder\.io\/qwik$/, '@builder.io/qwik'), qwikDomPlugin],
41 define: {
42 ...(await inlineQwikScriptsEsBuild(config)),
43 'globalThis.IS_CJS': 'false',
44 'globalThis.IS_ESM': 'true',
45 'globalThis.QWIK_VERSION': JSON.stringify(config.distVersion),
46 'globalThis.QWIK_DOM_VERSION': JSON.stringify(qwikDomVersion),
47 },
48 });
49
50 const cjsBanner = [
51 getBanner('@builder.io/qwik/server', config.distVersion),
52 `globalThis.qwikServer = (function (module) {`,
53 browserCjsRequireShim,
54 ].join('\n');
55
56 const cjs = build({
57 ...opts,
58 format: 'cjs',
59 banner: {
60 js: cjsBanner,
61 },
62 footer: {
63 js: `return module.exports; })(typeof module === 'object' && module.exports ? module : { exports: {} });`,
64 },
65 outExtension: { '.js': '.cjs' },
66 plugins: [importPath(/^@builder\.io\/qwik$/, '@builder.io/qwik'), qwikDomPlugin],
67 target: nodeTarget,
68 define: {
69 ...(await inlineQwikScriptsEsBuild(config)),
70 'globalThis.IS_CJS': 'true',

Callers 1

buildFunction · 0.90

Calls 8

getBannerFunction · 0.90
importPathFunction · 0.90
inlineQwikScriptsEsBuildFunction · 0.90
bundleQwikDomFunction · 0.85
getQwikDomVersionFunction · 0.85
joinFunction · 0.85
buildFunction · 0.70
joinMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…