@qwik.dev/core 2.0.0-alpha.2 → 2.0.0-alpha.4

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qwik.dev/core/build",
3
- "version": "2.0.0-alpha.2-dev+58b6f8d",
3
+ "version": "2.0.0-alpha.4-dev+374e0d6",
4
4
  "main": "index.mjs",
5
5
  "types": "index.d.ts",
6
6
  "private": true,
package/dist/cli.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core/cli 2.0.0-alpha.2-dev+58b6f8d
3
+ * @qwik.dev/core/cli 2.0.0-alpha.4-dev+374e0d6
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
@@ -5177,8 +5177,10 @@ function updateFileContent(path3, content) {
5177
5177
  (0, import_fs3.writeFileSync)(path3, content);
5178
5178
  f2.info(`"${path3}" has been updated`);
5179
5179
  }
5180
- function replacePackage(oldPackageName, newPackageName) {
5181
- replacePackageInDependencies(oldPackageName, newPackageName);
5180
+ function replacePackage(oldPackageName, newPackageName, skipDependencies = false) {
5181
+ if (!skipDependencies) {
5182
+ replacePackageInDependencies(oldPackageName, newPackageName);
5183
+ }
5182
5184
  replaceMentions(oldPackageName, newPackageName);
5183
5185
  }
5184
5186
  function replacePackageInDependencies(oldPackageName, newPackageName) {
@@ -5316,6 +5318,27 @@ async function removeTsMorphFromPackageJson() {
5316
5318
  const packageJson = await readPackageJson(process.cwd());
5317
5319
  (_a = packageJson.dependencies) == null ? true : delete _a["ts-morph"];
5318
5320
  (_b = packageJson.devDependencies) == null ? true : delete _b["ts-morph"];
5321
+ await writePackageJson(process.cwd(), packageJson);
5322
+ }
5323
+
5324
+ // packages/qwik/src/cli/migrate-v2/update-configurations.ts
5325
+ var import_fs4 = require("fs");
5326
+ init_dist2();
5327
+ function updateConfigurations() {
5328
+ try {
5329
+ updateTsconfig();
5330
+ } catch (error) {
5331
+ f2.error("Failed to update tsconfig.json configuration.");
5332
+ }
5333
+ }
5334
+ function updateTsconfig() {
5335
+ const tsConfigPath = "tsconfig.json";
5336
+ const tsConfig = JSON.parse((0, import_fs4.readFileSync)(tsConfigPath, "utf-8"));
5337
+ if (!tsConfig) {
5338
+ return;
5339
+ }
5340
+ tsConfig.compilerOptions.moduleResolution = "bundler";
5341
+ (0, import_fs4.writeFileSync)(tsConfigPath, JSON.stringify(tsConfig, null, 2));
5319
5342
  }
5320
5343
 
5321
5344
  // packages/qwik/src/cli/migrate-v2/run-migration.ts
@@ -5349,12 +5372,19 @@ ${bold(bgRed('Warning: migration tool is experimental and will migrate your appl
5349
5372
  ],
5350
5373
  "@builder.io/qwik-city"
5351
5374
  );
5375
+ replaceImportInFiles2(
5376
+ [["qwikCityPlan", "qwikRouterConfig"]],
5377
+ "@qwik-city-plan"
5378
+ // using old name, package name will be updated in the next step
5379
+ );
5380
+ replacePackage("@qwik-city-plan", "@qwik-router-config", true);
5352
5381
  replacePackage("@builder.io/qwik-city", "@qwik.dev/router");
5353
5382
  replacePackage("@builder.io/qwik-react", "@qwik.dev/react");
5354
5383
  replacePackage("@builder.io/qwik", "@qwik.dev/core");
5355
5384
  if (installedTsMorph) {
5356
5385
  await removeTsMorphFromPackageJson();
5357
5386
  }
5387
+ updateConfigurations();
5358
5388
  await updateDependencies();
5359
5389
  f2.success(`${green(`Your application has been successfully migrated to v2!`)}`);
5360
5390
  } catch (error) {
@@ -5504,7 +5534,7 @@ async function printHelp(app) {
5504
5534
  await runCommand2(Object.assign(app, { task: args[0], args }));
5505
5535
  }
5506
5536
  function printVersion() {
5507
- console.log("2.0.0-alpha.2-dev+58b6f8d");
5537
+ console.log("2.0.0-alpha.4-dev+374e0d6");
5508
5538
  }
5509
5539
  // Annotate the CommonJS export names for ESM import in node:
5510
5540
  0 && (module.exports = {
@@ -1,4 +1,7 @@
1
1
  import * as CSS_2 from 'csstype';
2
+ import { isBrowser } from './build';
3
+ import { isDev } from './build';
4
+ import { isServer } from './build';
2
5
  import type { StreamWriter as StreamWriter_2 } from '.';
3
6
 
4
7
  /**
@@ -370,7 +373,7 @@ declare type BivariantQrlFn<ARGS extends any[], RETURN> = {
370
373
  declare type Booleanish = boolean | `${boolean}`;
371
374
 
372
375
  declare const enum ChoreType {
373
- MACRO = 112,
376
+ MACRO = 240,
374
377
  MICRO = 15,
375
378
  /** Ensure tha the QRL promise is resolved before processing next chores in the queue */
376
379
  QRL_RESOLVE = 1,
@@ -380,11 +383,11 @@ declare const enum ChoreType {
380
383
  NODE_PROP = 5,
381
384
  COMPONENT_SSR = 6,
382
385
  COMPONENT = 7,
383
- WAIT_FOR_COMPONENTS = 16,
384
- JOURNAL_FLUSH = 48,
385
- VISIBLE = 64,
386
- CLEANUP_VISIBLE = 80,
387
- WAIT_FOR_ALL = 127
386
+ RECOMPUTE_AND_SCHEDULE_EFFECTS = 8,
387
+ JOURNAL_FLUSH = 16,
388
+ VISIBLE = 32,
389
+ CLEANUP_VISIBLE = 48,
390
+ WAIT_FOR_ALL = 255
388
391
  }
389
392
 
390
393
  /**
@@ -530,7 +533,6 @@ declare interface Container {
530
533
  readonly $getObjectById$: (id: number | string) => any;
531
534
  readonly $serverData$: Record<string, any>;
532
535
  $currentUniqueId$: number;
533
- processJsx(host: HostElement, jsx: JSXOutput): ValueOrPromise<void>;
534
536
  handleError(err: any, $host$: HostElement): void;
535
537
  getParentHost(host: HostElement): HostElement | null;
536
538
  setContext<T>(host: HostElement, context: ContextId<T>, value: T): void;
@@ -554,7 +556,7 @@ declare interface Container {
554
556
  };
555
557
  } | null, DomRefConstructor: {
556
558
  new (...rest: any[]): {
557
- id: string;
559
+ $ssrNode$: ISsrNode;
558
560
  };
559
561
  } | null, symbolToChunkResolver: SymbolToChunkResolver, writer?: StreamWriter): SerializationContext;
560
562
  }
@@ -783,7 +785,7 @@ declare const createScheduler: (container: Container, scheduleDrain: () => void,
783
785
  (type: ChoreType.QRL_RESOLVE, ignore: null, target: QRLInternal<(...args: unknown[]) => unknown>): ValueOrPromise<void>;
784
786
  (type: ChoreType.JOURNAL_FLUSH): ValueOrPromise<void>;
785
787
  (type: ChoreType.WAIT_FOR_ALL): ValueOrPromise<void>;
786
- (type: ChoreType.WAIT_FOR_COMPONENTS): ValueOrPromise<void>;
788
+ (type: ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS, host: HostElement | null, target: Signal): ValueOrPromise<void>;
787
789
  (type: ChoreType.TASK | ChoreType.VISIBLE | ChoreType.RESOURCE, task: Task): ValueOrPromise<void>;
788
790
  (type: ChoreType.COMPONENT, host: HostElement, qrl: QRLInternal<OnRenderFn<unknown>>, props: Props | null): ValueOrPromise<JSXOutput>;
789
791
  (type: ChoreType.COMPONENT_SSR, host: HostElement, qrl: QRLInternal<OnRenderFn<unknown>>, props: Props | null): ValueOrPromise<JSXOutput>;
@@ -872,7 +874,6 @@ declare class DomContainer extends _SharedContainer implements ClientContainer {
872
874
  constructor(element: _ContainerElement);
873
875
  $setRawState$(id: number, vParent: _ElementVNode | _VirtualVNode): void;
874
876
  parseQRL<T = unknown>(qrl: string): QRL<T>;
875
- processJsx(host: HostElement, jsx: JSXOutput): ValueOrPromise<void>;
876
877
  handleError(err: any, host: HostElement): void;
877
878
  setContext<T>(host: HostElement, context: ContextId<T>, value: T): void;
878
879
  resolveContext<T>(host: HostElement, contextId: ContextId<T>): T | undefined;
@@ -890,7 +891,7 @@ export { DomContainer }
890
891
  export { DomContainer as _DomContainer }
891
892
 
892
893
  declare type DomRef = {
893
- id: string;
894
+ $ssrNode$: SsrNode;
894
895
  };
895
896
 
896
897
  /** @public */
@@ -908,9 +909,9 @@ export declare type EagernessOptions = 'visible' | 'load' | 'idle';
908
909
  declare type Effect = Task | _VNode | ISsrNode | Signal_2;
909
910
 
910
911
  /** @internal */
911
- export declare class _EffectData<T extends Record<string, any> = Record<string, any>> {
912
- data: T;
913
- constructor(data: T);
912
+ export declare class _EffectData {
913
+ data: NodePropData;
914
+ constructor(data: NodePropData);
914
915
  }
915
916
 
916
917
  /**
@@ -1265,6 +1266,10 @@ declare type IsAcceptableDOMValue<T> = T extends boolean | number | string | nul
1265
1266
 
1266
1267
  declare type IsAny<T> = 0 extends T & 1 ? true : false;
1267
1268
 
1269
+ export { isBrowser }
1270
+
1271
+ export { isDev }
1272
+
1268
1273
  /** @internal */
1269
1274
  export declare const _isJSXNode: <T>(n: unknown) => n is JSXNodeInternal<T>;
1270
1275
 
@@ -1274,6 +1279,8 @@ declare type IsReadOnlyKey<T, K extends keyof T> = IfEquals<{
1274
1279
  -readonly [Q in K]: T[K];
1275
1280
  }, false, true>;
1276
1281
 
1282
+ export { isServer }
1283
+
1277
1284
  /** @public */
1278
1285
  export declare const isSignal: (value: any) => value is Signal<unknown>;
1279
1286
 
@@ -1497,6 +1504,11 @@ export declare type NativeUIEvent = UIEvent;
1497
1504
  /** @public @deprecated Use `WheelEvent` and use the second argument to the handler function for the current event target */
1498
1505
  export declare type NativeWheelEvent = WheelEvent;
1499
1506
 
1507
+ declare interface NodePropData {
1508
+ $scopedStyleIdPrefix$: string | null;
1509
+ $isConst$: boolean;
1510
+ }
1511
+
1500
1512
  /** @internal */
1501
1513
  export declare const _noopQrl: <T>(symbolName: string, lexicalScopeCapture?: any[]) => QRL<T>;
1502
1514
 
@@ -2330,7 +2342,7 @@ export declare abstract class _SharedContainer implements Container {
2330
2342
  $currentUniqueId$: number;
2331
2343
  $instanceHash$: string | null;
2332
2344
  constructor(scheduleDrain: () => void, journalFlush: () => void, serverData: Record<string, any>, locale: string);
2333
- trackSignalValue<T>(signal: Signal, subscriber: Effect, property: string, data: _EffectData): T;
2345
+ trackSignalValue<T>(signal: Signal, subscriber: HostElement, property: string, data: _EffectData): T;
2334
2346
  serializationCtxFactory(NodeConstructor: {
2335
2347
  new (...rest: any[]): {
2336
2348
  nodeType: number;
@@ -2338,11 +2350,10 @@ export declare abstract class _SharedContainer implements Container {
2338
2350
  };
2339
2351
  } | null, DomRefConstructor: {
2340
2352
  new (...rest: any[]): {
2341
- id: string;
2353
+ $ssrNode$: ISsrNode;
2342
2354
  };
2343
2355
  } | null, symbolToChunkResolver: SymbolToChunkResolver, writer?: StreamWriter, prepVNodeData?: (vNode: any) => void): SerializationContext;
2344
2356
  abstract ensureProjectionResolved(host: HostElement): void;
2345
- abstract processJsx(host: HostElement, jsx: JSXOutput): ValueOrPromise<void>;
2346
2357
  abstract handleError(err: any, $host$: HostElement): void;
2347
2358
  abstract getParentHost(host: HostElement): HostElement | null;
2348
2359
  abstract setContext<T>(host: HostElement, context: ContextId<T>, value: T): void;
@@ -2378,7 +2389,7 @@ declare class Signal_2<T = any> implements Signal<T> {
2378
2389
  set untrackedValue(value: T);
2379
2390
  get value(): T;
2380
2391
  set value(value: T);
2381
- valueOf(): undefined;
2392
+ valueOf(): void;
2382
2393
  toString(): string;
2383
2394
  toJSON(): {
2384
2395
  value: T;
@@ -3721,7 +3732,7 @@ export declare const _VAR_PROPS: unique symbol;
3721
3732
  export declare const _verifySerializable: <T>(value: T, preMessage?: string) => T;
3722
3733
 
3723
3734
  /**
3724
- * 2.0.0-alpha.2-dev+58b6f8d
3735
+ * 2.0.0-alpha.4-dev+374e0d6
3725
3736
  *
3726
3737
  * @public
3727
3738
  */
@@ -3780,12 +3791,18 @@ export declare type _VNode = _ElementVNode | _TextVNode | _VirtualVNode;
3780
3791
  */
3781
3792
  declare type VNodeData = [VNodeDataFlag, ...(SsrAttrs | number)[]];
3782
3793
 
3794
+ /**
3795
+ * Flags for VNodeData (Flags con be bitwise combined)
3796
+ *
3797
+ * @internal
3798
+ */
3783
3799
  declare const enum VNodeDataFlag {
3784
3800
  NONE = 0,
3785
3801
  TEXT_DATA = 1,
3786
3802
  VIRTUAL_NODE = 2,
3787
- REFERENCE = 4,
3788
- SERIALIZE = 8
3803
+ ELEMENT_NODE = 4,
3804
+ REFERENCE = 8,
3805
+ SERIALIZE = 16
3789
3806
  }
3790
3807
 
3791
3808
  /**
@@ -3876,6 +3893,8 @@ declare class WrappedSignal<T> extends Signal_2<T> implements Subscriber {
3876
3893
  $funcStr$: string | null;
3877
3894
  $invalid$: boolean;
3878
3895
  $effectDependencies$: Subscriber[] | null;
3896
+ $hostElement$: HostElement | null;
3897
+ $forceRunEffects$: boolean;
3879
3898
  constructor(container: Container | null, fn: (...args: any[]) => T, args: any[], fnStr: string | null);
3880
3899
  $invalidate$(): void;
3881
3900
  /**
@@ -3884,7 +3903,7 @@ declare class WrappedSignal<T> extends Signal_2<T> implements Subscriber {
3884
3903
  */
3885
3904
  force(): void;
3886
3905
  get untrackedValue(): T;
3887
- private $computeIfNeeded$;
3906
+ $computeIfNeeded$(): boolean;
3888
3907
  get value(): any;
3889
3908
  set value(_: any);
3890
3909
  }