Skip to content

Commit

Permalink
chore: Prepare 0.13.0 release (QwikDev#2036)
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat authored Nov 7, 2022
1 parent a95865f commit 096686d
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 36 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-qwik/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-qwik/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/qwik/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
42 changes: 11 additions & 31 deletions packages/qwik/src/qwikloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
Expand Down Expand Up @@ -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());

/**
Expand Down
11 changes: 10 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,16 @@ __metadata:
languageName: unknown
linkType: soft

"@builder.io/[email protected], @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:
Expand Down

0 comments on commit 096686d

Please sign in to comment.