Skip to content

Commit e867947

Browse files
authored
feat: use @builder.io/qwik-dom (#161)
1 parent 70bcbec commit e867947

File tree

14 files changed

+160
-94
lines changed

14 files changed

+160
-94
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"@typescript-eslint/parser": "^4.19.0",
7070
"concurrently": "^6.2.0",
7171
"cross-spawn": "^7.0.3",
72-
"domino": "^2.1.6",
72+
"@builder.io/qwik-dom": "2.1.7",
7373
"esbuild": "^0.12.13",
7474
"esbuild-register": "^2.6.0",
7575
"eslint": "^7.23.0",

scripts/package_build.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def package_build(
1616
"@npm//@types/prettier",
1717
"@npm//@types/source-map-support",
1818
"@npm//kleur",
19-
"@npm//domino",
19+
"@npm//@builder.io/qwik-dom",
2020
"@npm//esbuild",
2121
"@npm//esbuild-register",
2222
"@npm//express",

scripts/submodule-core.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ async function submoduleCoreProd(config: BuildConfig) {
8181
ecma: 2018,
8282
passes: 2,
8383
},
84-
keep_fnames: true,
85-
keep_classnames: true,
8684
format: {
8785
comments: false,
8886
preamble: banner.js,

scripts/submodule-optimizer.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@ export async function submoduleOptimizer(config: BuildConfig) {
9898
beautify: true,
9999
indent_level: 2,
100100
},
101-
keep_fnames: true,
102-
keep_classnames: true,
103101
mangle: false,
104102
});
105103
await writeFile(p, result.code!);

scripts/submodule-prefetch.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ export async function submodulePrefetch(config: BuildConfig) {
4141
plugins: minifyCode
4242
? [
4343
terser({
44-
keep_fnames: true,
45-
keep_classnames: true,
4644
compress: {
4745
module: true,
4846
keep_fargs: false,
@@ -97,8 +95,6 @@ export async function submodulePrefetch(config: BuildConfig) {
9795
exports: 'none',
9896
plugins: [
9997
terser({
100-
keep_fnames: true,
101-
keep_classnames: true,
10298
compress: {
10399
module: true,
104100
keep_fargs: false,
@@ -125,8 +121,6 @@ export async function submodulePrefetch(config: BuildConfig) {
125121
exports: 'none',
126122
plugins: [
127123
terser({
128-
keep_fnames: true,
129-
keep_classnames: true,
130124
compress: {
131125
inline: false,
132126
join_vars: false,

scripts/submodule-qwikloader.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ export async function submoduleQwikLoader(config: BuildConfig) {
4444
outro: `})()`,
4545
plugins: [
4646
terser({
47-
keep_fnames: true,
48-
keep_classnames: true,
4947
compress: {
5048
global_defs: {
5149
'window.BuildEvents': false,
@@ -71,8 +69,6 @@ export async function submoduleQwikLoader(config: BuildConfig) {
7169
outro: `})()`,
7270
plugins: [
7371
terser({
74-
keep_fnames: true,
75-
keep_classnames: true,
7672
compress: {
7773
global_defs: {
7874
'window.BuildEvents': false,
@@ -102,8 +98,6 @@ export async function submoduleQwikLoader(config: BuildConfig) {
10298
outro: `})()`,
10399
plugins: [
104100
terser({
105-
keep_fnames: true,
106-
keep_classnames: true,
107101
compress: {
108102
global_defs: {
109103
'window.BuildEvents': true,
@@ -129,8 +123,6 @@ export async function submoduleQwikLoader(config: BuildConfig) {
129123
outro: `})()`,
130124
plugins: [
131125
terser({
132-
keep_fnames: true,
133-
keep_classnames: true,
134126
compress: {
135127
global_defs: {
136128
'window.BuildEvents': true,

scripts/submodule-server.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { readPackageJson, writePackageJson } from './package-json';
2424
export async function submoduleServer(config: BuildConfig) {
2525
const submodule = 'server';
2626

27-
const dominoPlugin = await bundleDomino(config);
27+
const qwikDomPlugin = await bundleQwikDom(config);
2828

2929
const opts: BuildOptions = {
3030
entryPoints: [join(config.srcDir, submodule, 'index.ts')],
@@ -33,7 +33,7 @@ export async function submoduleServer(config: BuildConfig) {
3333
bundle: true,
3434
target,
3535
banner,
36-
external: [...nodeBuiltIns, 'domino'],
36+
external: [...nodeBuiltIns, '@builder.io/qwik-dom'],
3737
define: {
3838
...(await inlineQwikScripts(config)),
3939
'globalThis.QWIK_VERSION': JSON.stringify(config.distVersion),
@@ -48,7 +48,7 @@ export async function submoduleServer(config: BuildConfig) {
4848
plugins: [
4949
importPath(/^@builder\.io\/qwik$/, '../core.mjs'),
5050
importPath(/^@builder\.io\/qwik\/optimizer$/, '../optimizer.mjs'),
51-
dominoPlugin,
51+
qwikDomPlugin,
5252
],
5353
watch: watcher(config, submodule),
5454
inject: [injectGlobalPoly(config)],
@@ -61,7 +61,7 @@ export async function submoduleServer(config: BuildConfig) {
6161
plugins: [
6262
importPath(/^@builder\.io\/qwik$/, '../core.cjs'),
6363
importPath(/^@builder\.io\/qwik\/optimizer$/, '../optimizer.cjs'),
64-
dominoPlugin,
64+
qwikDomPlugin,
6565
],
6666
watch: watcher(config),
6767
platform: 'node',
@@ -115,11 +115,11 @@ async function inlineQwikScripts(config: BuildConfig) {
115115
return define;
116116
}
117117

118-
async function bundleDomino(config: BuildConfig) {
119-
const outfile = join(config.distDir, 'domino.mjs');
118+
async function bundleQwikDom(config: BuildConfig) {
119+
const outfile = join(config.distDir, 'qwikdom.mjs');
120120

121121
const opts: BuildOptions = {
122-
entryPoints: [require.resolve('domino')],
122+
entryPoints: [require.resolve('@builder.io/qwik-dom')],
123123
sourcemap: false,
124124
minify: true,
125125
bundle: true,
@@ -148,22 +148,22 @@ async function bundleDomino(config: BuildConfig) {
148148

149149
await build(opts);
150150

151-
const dominoPlugin: Plugin = {
152-
name: 'dominoPlugin',
151+
const qwikDomPlugin: Plugin = {
152+
name: 'domiqwikDomPluginnoPlugin',
153153
setup(build) {
154-
build.onResolve({ filter: /domino/ }, () => {
154+
build.onResolve({ filter: /@builder.io\/qwik-dom/ }, () => {
155155
return {
156156
path: outfile,
157157
};
158158
});
159159
},
160160
};
161161

162-
return dominoPlugin;
162+
return qwikDomPlugin;
163163
}
164164

165165
async function getDominoVersion() {
166-
const indexPath = require.resolve('domino');
166+
const indexPath = require.resolve('@builder.io/qwik-dom');
167167
const pkgJsonPath = join(indexPath, '..', '..');
168168
const pkgJson = await readPackageJson(pkgJsonPath);
169169
return pkgJson.version;

src/server/api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export function setServerPlatform(document: any, opts: DocumentOptions): Promise
107107
// @alpha (undocumented)
108108
export const versions: {
109109
readonly qwik: string;
110-
readonly domino: string;
110+
readonly qwikDom: string;
111111
};
112112

113113
// (No @packageDocumentation comment for this package)

src/server/document.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { dehydrate, render } from '@builder.io/qwik';
2-
import domino from 'domino';
2+
import qwikDom from '@builder.io/qwik-dom';
33
import { setServerPlatform } from './platform';
44
import { serializeDocument } from './serialize';
55
import type {
@@ -21,7 +21,7 @@ import { createTimer } from './utils';
2121
export function createGlobal(opts?: GlobalOptions): QwikGlobal {
2222
opts = opts || {};
2323

24-
const doc: QwikDocument = domino.createDocument() as any;
24+
const doc: QwikDocument = qwikDom.createDocument() as any;
2525
const baseURI = opts.url === undefined ? BASE_URI : opts.url.href;
2626
const loc = new URL(baseURI, BASE_URI);
2727

src/server/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ export { setServerPlatform } from './platform';
2121
*/
2222
export const versions = {
2323
qwik: (globalThis as any).QWIK_VERSION as string,
24-
domino: (globalThis as any).DOMINO_VERSION as string,
24+
qwikDom: (globalThis as any).DOMINO_VERSION as string,
2525
} as const;

0 commit comments

Comments
 (0)