diff --git a/package.json b/package.json index f6f0f83a45c..393f286daf1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "qwik-monorepo", - "version": "0.12.1", + "version": "0.13.0", "scripts": { "build": "tsm scripts/index.ts --tsc --build --qwikcity --api --platform-binding-wasm-copy", "build.full": "tsm scripts/index.ts --tsc --build --api --eslint --qwikcity --qwikreact --cli --platform-binding --wasm", diff --git a/packages/create-qwik/package.json b/packages/create-qwik/package.json index bb917075f9d..521404c4b8d 100644 --- a/packages/create-qwik/package.json +++ b/packages/create-qwik/package.json @@ -1,6 +1,6 @@ { "name": "create-qwik", - "version": "0.12.1", + "version": "0.13.0", "description": "Interactive CLI for create Qwik projects and adding features.", "bin": "./create-qwik.cjs", "main": "./index.cjs", diff --git a/packages/eslint-plugin-qwik/package.json b/packages/eslint-plugin-qwik/package.json index 04f324f512c..32f56e19e0e 100644 --- a/packages/eslint-plugin-qwik/package.json +++ b/packages/eslint-plugin-qwik/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-qwik", - "version": "0.12.1", + "version": "0.13.0", "description": "An Open-Source sub-framework designed with a focus on server-side-rendering, lazy-loading, and styling/animation.", "main": "index.js", "author": "Builder Team", diff --git a/packages/qwik/package.json b/packages/qwik/package.json index 1c3c047eff8..da611ce6a9b 100644 --- a/packages/qwik/package.json +++ b/packages/qwik/package.json @@ -1,6 +1,6 @@ { "name": "@builder.io/qwik", - "version": "0.12.1", + "version": "0.13.0", "description": "An Open-Source sub-framework designed with a focus on server-side-rendering, lazy-loading, and styling/animation.", "main": "./dist/core.mjs", "types": "./dist/core.d.ts", diff --git a/packages/qwik/src/qwikloader.ts b/packages/qwik/src/qwikloader.ts index ba6acc10313..919dfead16f 100644 --- a/packages/qwik/src/qwikloader.ts +++ b/packages/qwik/src/qwikloader.ts @@ -28,32 +28,20 @@ export const qwikLoader = (doc: Document, hasInitialized?: number) => { return el.getAttribute(name); }; - const getQwikJSON = (parentElm: Element): HTMLScriptElement | undefined => { - let child = parentElm.lastElementChild; - while (child) { - if (child.tagName === 'SCRIPT' && getAttribute(child, 'type') === 'qwik/json') { - return child as HTMLScriptElement; - } - child = child.previousElementSibling; - } - return undefined; - }; - const resolveContainer = (containerEl: Element) => { - const isDocElement = containerEl === doc.documentElement; - const parentJSON = isDocElement ? doc.body : containerEl; - const script = getQwikJSON(parentJSON); - if (script) { - (containerEl as any)['_qwikjson_'] = JSON.parse( - unescapeText((script.firstChild as any).data) - ); + const parentJSON = containerEl === doc.documentElement ? doc.body : containerEl; + let script = parentJSON.lastElementChild; + while (script) { + if (script.tagName === 'SCRIPT' && getAttribute(script, 'type') === 'qwik/json') { + (containerEl as any)['_qwikjson_'] = JSON.parse( + script.textContent!.replace(/\\x3C(\/?script)/g, '<$1') + ); + break; + } + script = script.previousElementSibling; } }; - const unescapeText = (str: string) => { - return str.replace(/\\x3C(\/?script)/g, '<$1'); - }; - const createEvent = (eventName: string, detail?: any) => new CustomEvent(eventName, { detail, @@ -78,7 +66,7 @@ export const qwikLoader = (doc: Document, hasInitialized?: number) => { const base = new URL(getAttribute(container, 'q:base')!, doc.baseURI); for (const qrl of attrValue.split('\n')) { const url = new URL(qrl, base); - const symbolName = getSymbolName(url); + const symbolName = url.hash.replace(/^#?([^?[|]*).*$/, '$1'); const reqTime = performance.now(); const module = import(url.href.split('#')[0]); resolveContainer(container); @@ -116,14 +104,6 @@ export const qwikLoader = (doc: Document, hasInitialized?: number) => { } }; - const getSymbolName = (url: URL) => - // 1 - optional `#` at the start. - // 2 - capture group `$1` containing the export name, stopping at the first `?`. - // 3 - the rest from the first `?` to the end. - // The hash string is replaced by the captured group that contains only the export name. - // This is the same as in the `qExport()` function. - url.hash.replace(/^#?([^?[|]*).*$/, '$1') || 'default'; - const camelToKebab = (str: string) => str.replace(/([A-Z])/g, (a) => '-' + a.toLowerCase()); /** diff --git a/yarn.lock b/yarn.lock index 9bb2452318c..85fd21a21cf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -271,7 +271,16 @@ __metadata: languageName: unknown linkType: soft -"@builder.io/qwik@0.12.1, @builder.io/qwik@workspace:*, @builder.io/qwik@workspace:packages/qwik": +"@builder.io/qwik@npm:0.12.1": + version: 0.12.1 + resolution: "@builder.io/qwik@npm:0.12.1" + bin: + qwik: qwik.cjs + checksum: 65bb5a84c43318db5f39a5282e9fbb183d94b2c7c61b3b1675a38f8b5bd47a81d4a0a3107d0190dafba2cf5fe93e8ffac41d6aa9fd74461b90f3d2c002bbfcfb + languageName: node + linkType: hard + +"@builder.io/qwik@workspace:*, @builder.io/qwik@workspace:packages/qwik": version: 0.0.0-use.local resolution: "@builder.io/qwik@workspace:packages/qwik" bin: