@qwik.dev/core 2.0.0-beta.18 → 2.0.0-beta.19
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/dist/backpatch/package.json +1 -1
- package/dist/build/package.json +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/core-internal.d.ts +10 -3
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +107 -91
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.mjs +64 -61
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.mjs +889 -884
- package/dist/server.mjs +4 -3
- package/dist/starters/adapters/cloudflare-workers/README.md +52 -0
- package/dist/starters/adapters/cloudflare-workers/adapters/cloudflare-workers/vite.config.ts +15 -0
- package/dist/starters/adapters/cloudflare-workers/gitignore +3 -0
- package/dist/starters/adapters/cloudflare-workers/package.json +31 -0
- package/dist/starters/adapters/cloudflare-workers/public/.assetsignore +4 -0
- package/dist/starters/adapters/cloudflare-workers/public/_headers +11 -0
- package/dist/starters/adapters/cloudflare-workers/public/_redirects +1 -0
- package/dist/starters/adapters/cloudflare-workers/src/entry.cloudflare-pages.tsx +23 -0
- package/dist/starters/adapters/cloudflare-workers/worker-configuration.d.ts +5 -0
- package/dist/starters/adapters/cloudflare-workers/wrangler.jsonc +41 -0
- package/dist/starters/adapters/express/package.json +1 -1
- package/dist/starters/features/compiled-i18n/package.json +37 -0
- package/dist/starters/features/compiled-i18n/src/components/locale-selector/locale-selector.tsx +30 -0
- package/dist/starters/features/{localize → compiled-i18n}/src/entry.ssr.tsx +7 -2
- package/dist/starters/features/compiled-i18n/src/routes/plugin@compiled-i18n.ts +28 -0
- package/dist/starters/features/cypress/src/actions/example.action.ts +5 -0
- package/dist/starters/features/cypress/src/components/example/example.cy.tsx +50 -8
- package/dist/starters/features/cypress/src/components/example/example.tsx +13 -3
- package/dist/starters/features/cypress/src/loaders/example.loader.ts +5 -0
- package/dist/testing/index.mjs +71 -44
- package/dist/testing/package.json +1 -1
- package/package.json +2 -2
- package/dist/starters/features/localize/package.json +0 -37
- package/dist/starters/features/localize/src/locales/message.en.json +0 -8
- package/dist/starters/features/localize/src/locales/message.it.json +0 -8
- package/dist/starters/features/localize/src/routes/[locale]/i18n-utils.ts +0 -94
- package/dist/starters/features/localize/src/routes/[locale]/index.tsx +0 -52
- package/dist/starters/features/localize/src/routes/[locale]/layout.tsx +0 -12
package/dist/core.prod.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core 2.0.0-beta.
|
|
3
|
+
* @qwik.dev/core 2.0.0-beta.19-dev+0d046fb
|
|
4
4
|
* Copyright QwikDev. All Rights Reserved.
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
|
|
@@ -11,7 +11,7 @@ export { isBrowser, isDev, isServer } from "@qwik.dev/core/build";
|
|
|
11
11
|
|
|
12
12
|
import { p } from "@qwik.dev/core/preloader";
|
|
13
13
|
|
|
14
|
-
const version = "2.0.0-beta.
|
|
14
|
+
const version = "2.0.0-beta.19-dev+0d046fb";
|
|
15
15
|
|
|
16
16
|
const qDev = !1;
|
|
17
17
|
|
|
@@ -311,50 +311,6 @@ function assertNumber() {
|
|
|
311
311
|
qDev;
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
-
let _locale;
|
|
315
|
-
|
|
316
|
-
let localAsyncStore;
|
|
317
|
-
|
|
318
|
-
function getLocale(defaultLocale) {
|
|
319
|
-
if (localAsyncStore) {
|
|
320
|
-
const locale = localAsyncStore.getStore();
|
|
321
|
-
if (locale) {
|
|
322
|
-
return locale;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
if (void 0 === _locale) {
|
|
326
|
-
const ctx = tryGetInvokeContext();
|
|
327
|
-
if (ctx && ctx.$locale$) {
|
|
328
|
-
return ctx.$locale$;
|
|
329
|
-
}
|
|
330
|
-
if (void 0 !== defaultLocale) {
|
|
331
|
-
return defaultLocale;
|
|
332
|
-
}
|
|
333
|
-
throw new Error("Reading `locale` outside of context.");
|
|
334
|
-
}
|
|
335
|
-
return _locale;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
function withLocale(locale, fn) {
|
|
339
|
-
if (localAsyncStore) {
|
|
340
|
-
return localAsyncStore.run(locale, fn);
|
|
341
|
-
}
|
|
342
|
-
const previousLang = _locale;
|
|
343
|
-
try {
|
|
344
|
-
return _locale = locale, fn();
|
|
345
|
-
} finally {
|
|
346
|
-
_locale = previousLang;
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
function setLocale(locale) {
|
|
351
|
-
localAsyncStore ? localAsyncStore.enterWith(locale) : _locale = locale;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
isServer && import("node:async_hooks").then(module => {
|
|
355
|
-
localAsyncStore = new module.AsyncLocalStorage;
|
|
356
|
-
}).catch(() => {});
|
|
357
|
-
|
|
358
314
|
const DEBUG_TYPE = "q:type";
|
|
359
315
|
|
|
360
316
|
const VirtualTypeName = {
|
|
@@ -1328,10 +1284,10 @@ function clearEffectSubscription(container, effect) {
|
|
|
1328
1284
|
const backRefs = effect.backRef;
|
|
1329
1285
|
if (backRefs) {
|
|
1330
1286
|
for (const producer of backRefs) {
|
|
1331
|
-
if (producer instanceof
|
|
1332
|
-
clearSignal(container, producer, effect);
|
|
1333
|
-
} else if (producer instanceof AsyncComputedSignalImpl) {
|
|
1287
|
+
if (producer instanceof AsyncComputedSignalImpl) {
|
|
1334
1288
|
clearAsyncComputedSignal(producer, effect);
|
|
1289
|
+
} else if (producer instanceof SignalImpl) {
|
|
1290
|
+
clearSignal(container, producer, effect);
|
|
1335
1291
|
} else if (isPropsProxy(producer)) {
|
|
1336
1292
|
clearStoreOrProps(producer[_PROPS_HANDLER], effect);
|
|
1337
1293
|
} else if (container.$storeProxyMap$.has(producer)) {
|
|
@@ -1345,7 +1301,7 @@ function clearEffectSubscription(container, effect) {
|
|
|
1345
1301
|
|
|
1346
1302
|
function clearSignal(container, producer, effect) {
|
|
1347
1303
|
const effects = producer.$effects$;
|
|
1348
|
-
effects && effects.has(effect) && effects.delete(effect), producer instanceof WrappedSignalImpl && (producer.$hostElement$ = void 0,
|
|
1304
|
+
effects && effects.has(effect) && effects.delete(effect), producer instanceof WrappedSignalImpl && !effects?.size && (producer.$hostElement$ = void 0,
|
|
1349
1305
|
clearAllEffects(container, producer));
|
|
1350
1306
|
}
|
|
1351
1307
|
|
|
@@ -2896,7 +2852,7 @@ function getResourceValueAsPromise(props) {
|
|
|
2896
2852
|
const state = resource._state;
|
|
2897
2853
|
if (!isServerPlatform()) {
|
|
2898
2854
|
if ("pending" === state && props.onPending) {
|
|
2899
|
-
return Promise.resolve().then(useBindInvokeContext(props.onPending));
|
|
2855
|
+
return resource.value.catch(() => {}), Promise.resolve().then(useBindInvokeContext(props.onPending));
|
|
2900
2856
|
}
|
|
2901
2857
|
if ("rejected" === state && props.onRejected) {
|
|
2902
2858
|
return Promise.resolve(resource._error).then(useBindInvokeContext(props.onRejected));
|
|
@@ -4468,8 +4424,52 @@ const vnode_getProjectionParentComponent = vHost => {
|
|
|
4468
4424
|
return vHost;
|
|
4469
4425
|
};
|
|
4470
4426
|
|
|
4427
|
+
let _locale;
|
|
4428
|
+
|
|
4429
|
+
let localAsyncStore;
|
|
4430
|
+
|
|
4431
|
+
function getLocale(defaultLocale) {
|
|
4432
|
+
if (localAsyncStore) {
|
|
4433
|
+
const locale = localAsyncStore.getStore();
|
|
4434
|
+
if (locale) {
|
|
4435
|
+
return locale;
|
|
4436
|
+
}
|
|
4437
|
+
}
|
|
4438
|
+
if (void 0 === _locale) {
|
|
4439
|
+
const ctx = tryGetInvokeContext();
|
|
4440
|
+
if (ctx && ctx.$locale$) {
|
|
4441
|
+
return ctx.$locale$;
|
|
4442
|
+
}
|
|
4443
|
+
if (void 0 !== defaultLocale) {
|
|
4444
|
+
return defaultLocale;
|
|
4445
|
+
}
|
|
4446
|
+
throw new Error("Reading `locale` outside of context.");
|
|
4447
|
+
}
|
|
4448
|
+
return _locale;
|
|
4449
|
+
}
|
|
4450
|
+
|
|
4451
|
+
function withLocale(locale, fn) {
|
|
4452
|
+
if (localAsyncStore) {
|
|
4453
|
+
return localAsyncStore.run(locale, fn);
|
|
4454
|
+
}
|
|
4455
|
+
const previousLang = _locale;
|
|
4456
|
+
try {
|
|
4457
|
+
return _locale = locale, fn();
|
|
4458
|
+
} finally {
|
|
4459
|
+
_locale = previousLang;
|
|
4460
|
+
}
|
|
4461
|
+
}
|
|
4462
|
+
|
|
4463
|
+
function setLocale(locale) {
|
|
4464
|
+
localAsyncStore ? localAsyncStore.enterWith(locale) : _locale = locale;
|
|
4465
|
+
}
|
|
4466
|
+
|
|
4471
4467
|
let _context;
|
|
4472
4468
|
|
|
4469
|
+
isServer && import("node:async_hooks").then(module => {
|
|
4470
|
+
localAsyncStore = new module.AsyncLocalStorage;
|
|
4471
|
+
}).catch(() => {});
|
|
4472
|
+
|
|
4473
4473
|
const tryGetInvokeContext = () => {
|
|
4474
4474
|
if (!_context) {
|
|
4475
4475
|
const context = "undefined" != typeof document && document && document.__q_context__;
|
|
@@ -4558,18 +4558,21 @@ function newInvokeContext(locale, hostElement, event, url) {
|
|
|
4558
4558
|
return seal(), ctx;
|
|
4559
4559
|
}
|
|
4560
4560
|
|
|
4561
|
-
const untrack =
|
|
4562
|
-
if (
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4561
|
+
const untrack = (expr, ...args) => {
|
|
4562
|
+
if ("function" == typeof expr) {
|
|
4563
|
+
if (!_context) {
|
|
4564
|
+
return expr(...args);
|
|
4565
|
+
}
|
|
4566
|
+
{
|
|
4567
|
+
const sub = _context.$effectSubscriber$;
|
|
4568
|
+
try {
|
|
4569
|
+
return _context.$effectSubscriber$ = void 0, expr(...args);
|
|
4570
|
+
} finally {
|
|
4571
|
+
_context.$effectSubscriber$ = sub;
|
|
4572
|
+
}
|
|
4571
4573
|
}
|
|
4572
4574
|
}
|
|
4575
|
+
return isSignal(expr) ? expr.untrackedValue : unwrapStore(expr);
|
|
4573
4576
|
};
|
|
4574
4577
|
|
|
4575
4578
|
const trackInvocation = /*#__PURE__*/ newRenderInvokeContext(void 0, void 0, void 0);
|