@qwik.dev/core 2.0.0-beta.30 → 2.0.0-beta.31
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 +215 -170
- package/dist/core-internal.d.ts +51 -11
- package/dist/core.min.mjs +2 -2
- package/dist/core.mjs +9314 -8994
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.mjs +5672 -5412
- package/dist/insights/vite/index.mjs +36 -33
- package/dist/loader/index.mjs +2 -2
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.mjs +787 -763
- package/dist/preloader.mjs +210 -112
- package/dist/qwikloader.debug.js +26 -13
- package/dist/qwikloader.js +1 -1
- package/dist/server.mjs +266 -92
- package/dist/server.prod.mjs +552 -364
- package/dist/testing/index.d.ts +4 -1
- package/dist/testing/index.mjs +530 -212
- package/dist/testing/package.json +1 -1
- package/package.json +3 -3
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core/cli 2.0.0-beta.
|
|
3
|
+
* @qwik.dev/core/cli 2.0.0-beta.31-dev+906321a
|
|
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
|
|
@@ -3397,9 +3397,9 @@ var require_json5_parser = __commonJS({
|
|
|
3397
3397
|
|
|
3398
3398
|
// packages/qwik/src/cli/migrate-v2/tools/visit-not-ignored-files.ts
|
|
3399
3399
|
import { existsSync as existsSync2, lstatSync, readFileSync as readFileSync4, readdirSync } from "fs";
|
|
3400
|
-
import ignore from "ignore";
|
|
3401
3400
|
import { join as join8, relative as relative2 } from "path";
|
|
3402
|
-
function visitNotIgnoredFiles(dirPath, visitor) {
|
|
3401
|
+
async function visitNotIgnoredFiles(dirPath, visitor) {
|
|
3402
|
+
const { default: ignore } = await import("ignore");
|
|
3403
3403
|
let ig;
|
|
3404
3404
|
if (existsSync2(".gitignore")) {
|
|
3405
3405
|
ig = ignore();
|
|
@@ -3410,7 +3410,9 @@ function visitNotIgnoredFiles(dirPath, visitor) {
|
|
|
3410
3410
|
if (dirPath !== "" && ig?.ignores(dirPath)) {
|
|
3411
3411
|
return;
|
|
3412
3412
|
}
|
|
3413
|
-
|
|
3413
|
+
const dirResults = readdirSync(join8(process.cwd(), dirPath));
|
|
3414
|
+
for (let i2 = 0; i2 < dirResults.length; i2++) {
|
|
3415
|
+
const child = dirResults[i2];
|
|
3414
3416
|
const fullPath = join8(dirPath, child);
|
|
3415
3417
|
if (ig?.ignores(fullPath)) {
|
|
3416
3418
|
continue;
|
|
@@ -3418,7 +3420,7 @@ function visitNotIgnoredFiles(dirPath, visitor) {
|
|
|
3418
3420
|
if (lstatSync(fullPath).isFile()) {
|
|
3419
3421
|
visitor(fullPath);
|
|
3420
3422
|
} else {
|
|
3421
|
-
visitNotIgnoredFiles(fullPath, visitor);
|
|
3423
|
+
await visitNotIgnoredFiles(fullPath, visitor);
|
|
3422
3424
|
}
|
|
3423
3425
|
}
|
|
3424
3426
|
}
|
|
@@ -3433,42 +3435,52 @@ var rename_import_exports = {};
|
|
|
3433
3435
|
__export(rename_import_exports, {
|
|
3434
3436
|
replaceImportInFiles: () => replaceImportInFiles
|
|
3435
3437
|
});
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
+
async function replaceImportInFiles(changes, library) {
|
|
3439
|
+
const { Project, ts } = await import("ts-morph");
|
|
3438
3440
|
const project = new Project();
|
|
3439
|
-
visitNotIgnoredFiles(".", (path7) => {
|
|
3441
|
+
await visitNotIgnoredFiles(".", (path7) => {
|
|
3440
3442
|
if (!path7.endsWith(".ts") && !path7.endsWith(".tsx")) {
|
|
3441
3443
|
return;
|
|
3442
3444
|
}
|
|
3443
3445
|
project.addSourceFileAtPath(path7);
|
|
3444
3446
|
});
|
|
3445
|
-
project.getSourceFiles()
|
|
3447
|
+
const sourceFiles = project.getSourceFiles();
|
|
3448
|
+
for (let i2 = 0; i2 < sourceFiles.length; i2++) {
|
|
3449
|
+
const sourceFile = sourceFiles[i2];
|
|
3446
3450
|
let hasChanges = false;
|
|
3447
|
-
sourceFile.getImportDeclarations()
|
|
3451
|
+
const importDeclarations = sourceFile.getImportDeclarations();
|
|
3452
|
+
for (let j2 = 0; j2 < importDeclarations.length; j2++) {
|
|
3453
|
+
const importDeclaration = importDeclarations[j2];
|
|
3448
3454
|
if (importDeclaration.getModuleSpecifierValue().startsWith(library)) {
|
|
3449
|
-
for (
|
|
3450
|
-
|
|
3455
|
+
for (let k3 = 0; k3 < changes.length; k3++) {
|
|
3456
|
+
const [oldImport, newImport] = changes[k3];
|
|
3457
|
+
const namedImports = importDeclaration.getNamedImports();
|
|
3458
|
+
for (let l2 = 0; l2 < namedImports.length; l2++) {
|
|
3459
|
+
const namedImport = namedImports[l2];
|
|
3451
3460
|
if (namedImport.getName() === oldImport) {
|
|
3452
3461
|
namedImport.setName(newImport);
|
|
3453
3462
|
hasChanges = true;
|
|
3454
3463
|
}
|
|
3455
|
-
}
|
|
3464
|
+
}
|
|
3456
3465
|
}
|
|
3457
3466
|
}
|
|
3458
|
-
}
|
|
3459
|
-
sourceFile.getDescendantsOfKind(ts.SyntaxKind.Identifier)
|
|
3460
|
-
|
|
3467
|
+
}
|
|
3468
|
+
const descendants = sourceFile.getDescendantsOfKind(ts.SyntaxKind.Identifier);
|
|
3469
|
+
for (let m2 = 0; m2 < descendants.length; m2++) {
|
|
3470
|
+
const identifier = descendants[m2];
|
|
3471
|
+
for (let n2 = 0; n2 < changes.length; n2++) {
|
|
3472
|
+
const [oldImport, newImport] = changes[n2];
|
|
3461
3473
|
if (identifier.getText() === oldImport) {
|
|
3462
3474
|
identifier.replaceWithText(newImport);
|
|
3463
3475
|
hasChanges = true;
|
|
3464
3476
|
}
|
|
3465
3477
|
}
|
|
3466
|
-
}
|
|
3478
|
+
}
|
|
3467
3479
|
if (hasChanges) {
|
|
3468
3480
|
sourceFile.saveSync();
|
|
3469
3481
|
M2.info(`Updated imports in ${sourceFile.getFilePath()}`);
|
|
3470
3482
|
}
|
|
3471
|
-
}
|
|
3483
|
+
}
|
|
3472
3484
|
}
|
|
3473
3485
|
var init_rename_import = __esm({
|
|
3474
3486
|
"packages/qwik/src/cli/migrate-v2/rename-import.ts"() {
|
|
@@ -10471,7 +10483,8 @@ async function getFilesDeep(root) {
|
|
|
10471
10483
|
return;
|
|
10472
10484
|
}
|
|
10473
10485
|
const filesInDirectory = await fs.promises.readdir(directory);
|
|
10474
|
-
for (
|
|
10486
|
+
for (let i2 = 0; i2 < filesInDirectory.length; i2++) {
|
|
10487
|
+
const file = filesInDirectory[i2];
|
|
10475
10488
|
const absolute = join2(directory, file);
|
|
10476
10489
|
if (fs.statSync(absolute).isDirectory()) {
|
|
10477
10490
|
await getFiles(absolute);
|
|
@@ -10616,9 +10629,10 @@ function runInPkg(pkgManager, args, cwd) {
|
|
|
10616
10629
|
function logNextStep(nextSteps, packageManager) {
|
|
10617
10630
|
const outString = [];
|
|
10618
10631
|
if (nextSteps) {
|
|
10619
|
-
nextSteps.lines.
|
|
10620
|
-
|
|
10621
|
-
|
|
10632
|
+
for (let i2 = 0; i2 < nextSteps.lines.length; i2++) {
|
|
10633
|
+
const step = nextSteps.lines[i2];
|
|
10634
|
+
outString.push(`${step.replace(/\bpnpm\b/g, packageManager)}`);
|
|
10635
|
+
}
|
|
10622
10636
|
}
|
|
10623
10637
|
return outString.join("\n");
|
|
10624
10638
|
}
|
|
@@ -10686,9 +10700,10 @@ async function mergePackageJsons(fileUpdates, srcPath, destPath) {
|
|
|
10686
10700
|
const srcPkgJson = JSON.parse(srcContent);
|
|
10687
10701
|
const props = ["scripts", "dependencies", "devDependencies"];
|
|
10688
10702
|
const destPkgJson = JSON.parse(await fs3.promises.readFile(destPath, "utf-8"));
|
|
10689
|
-
props.
|
|
10703
|
+
for (let i2 = 0; i2 < props.length; i2++) {
|
|
10704
|
+
const prop = props[i2];
|
|
10690
10705
|
mergePackageJsonSort(srcPkgJson, destPkgJson, prop);
|
|
10691
|
-
}
|
|
10706
|
+
}
|
|
10692
10707
|
if (destPkgJson.scripts?.qwik) {
|
|
10693
10708
|
const qwikVal = destPkgJson.scripts.qwik;
|
|
10694
10709
|
delete destPkgJson.scripts.qwik;
|
|
@@ -10738,7 +10753,8 @@ function mergePackageJsonSort(src, dest, prop) {
|
|
|
10738
10753
|
}
|
|
10739
10754
|
const sorted = {};
|
|
10740
10755
|
const keys = Object.keys(dest[prop]).sort();
|
|
10741
|
-
for (
|
|
10756
|
+
for (let i2 = 0; i2 < keys.length; i2++) {
|
|
10757
|
+
const key = keys[i2];
|
|
10742
10758
|
sorted[key] = dest[prop][key];
|
|
10743
10759
|
}
|
|
10744
10760
|
dest[prop] = sorted;
|
|
@@ -10772,7 +10788,8 @@ async function mergeIgnoresFile(fileUpdates, srcPath, destPath) {
|
|
|
10772
10788
|
const destContent = await fs3.promises.readFile(destPath, "utf-8");
|
|
10773
10789
|
const srcLines = srcContent.trim().split(/\r?\n/);
|
|
10774
10790
|
const destLines = destContent.trim().split(/\r?\n/);
|
|
10775
|
-
for (
|
|
10791
|
+
for (let i2 = 0; i2 < srcLines.length; i2++) {
|
|
10792
|
+
const srcLine = srcLines[i2];
|
|
10776
10793
|
if (!destLines.includes(srcLine)) {
|
|
10777
10794
|
if (srcLine.startsWith("#")) {
|
|
10778
10795
|
destLines.push("");
|
|
@@ -10818,25 +10835,27 @@ import fs4 from "fs";
|
|
|
10818
10835
|
import { join as join5 } from "path";
|
|
10819
10836
|
|
|
10820
10837
|
// packages/qwik/src/cli/code-mod/code-mod.ts
|
|
10821
|
-
function updateViteConfig(
|
|
10838
|
+
function updateViteConfig(ts, sourceText, updates) {
|
|
10822
10839
|
if (!updates?.imports && !updates?.qwikViteConfig && !updates?.viteConfig && !updates?.vitePlugins && !updates?.vitePluginsPrepend) {
|
|
10823
10840
|
return null;
|
|
10824
10841
|
}
|
|
10825
|
-
sourceText = transformSource(
|
|
10842
|
+
sourceText = transformSource(ts, sourceText, () => (tsSourceFile) => {
|
|
10826
10843
|
if (updates.imports) {
|
|
10827
|
-
for (
|
|
10828
|
-
|
|
10844
|
+
for (let i2 = 0; i2 < updates.imports.length; i2++) {
|
|
10845
|
+
const importData = updates.imports[i2];
|
|
10846
|
+
tsSourceFile = ensureImport(ts, tsSourceFile, importData);
|
|
10829
10847
|
}
|
|
10830
10848
|
}
|
|
10831
10849
|
const statements = [];
|
|
10832
|
-
for (
|
|
10833
|
-
|
|
10834
|
-
|
|
10850
|
+
for (let i2 = 0; i2 < tsSourceFile.statements.length; i2++) {
|
|
10851
|
+
const s2 = tsSourceFile.statements[i2];
|
|
10852
|
+
if (ts.isExportAssignment(s2) && s2.expression && ts.isCallExpression(s2.expression)) {
|
|
10853
|
+
if (ts.isIdentifier(s2.expression.expression) && s2.expression.expression.text === "defineConfig" && (updates.viteConfig || updates.qwikViteConfig || updates.vitePlugins || updates.vitePluginsPrepend)) {
|
|
10835
10854
|
statements.push(
|
|
10836
|
-
|
|
10855
|
+
ts.factory.updateExportAssignment(
|
|
10837
10856
|
s2,
|
|
10838
10857
|
s2.modifiers,
|
|
10839
|
-
updateDefineConfig(
|
|
10858
|
+
updateDefineConfig(ts, s2.expression, updates)
|
|
10840
10859
|
)
|
|
10841
10860
|
);
|
|
10842
10861
|
continue;
|
|
@@ -10844,20 +10863,21 @@ function updateViteConfig(ts2, sourceText, updates) {
|
|
|
10844
10863
|
}
|
|
10845
10864
|
statements.push(s2);
|
|
10846
10865
|
}
|
|
10847
|
-
return
|
|
10866
|
+
return ts.factory.updateSourceFile(tsSourceFile, statements);
|
|
10848
10867
|
});
|
|
10849
10868
|
return sourceText;
|
|
10850
10869
|
}
|
|
10851
|
-
function ensureImport(
|
|
10870
|
+
function ensureImport(ts, tsSourceFile, importData) {
|
|
10852
10871
|
if (importData && importData.importPath) {
|
|
10853
10872
|
if (Array.isArray(importData.namedImports)) {
|
|
10854
|
-
importData.namedImports.
|
|
10855
|
-
|
|
10856
|
-
|
|
10873
|
+
for (let i2 = 0; i2 < importData.namedImports.length; i2++) {
|
|
10874
|
+
const namedImport = importData.namedImports[i2];
|
|
10875
|
+
tsSourceFile = ensureNamedImport(ts, tsSourceFile, namedImport, importData.importPath);
|
|
10876
|
+
}
|
|
10857
10877
|
}
|
|
10858
10878
|
if (typeof importData.defaultImport === "string") {
|
|
10859
10879
|
tsSourceFile = ensureDefaultImport(
|
|
10860
|
-
|
|
10880
|
+
ts,
|
|
10861
10881
|
tsSourceFile,
|
|
10862
10882
|
importData.defaultImport,
|
|
10863
10883
|
importData.importPath
|
|
@@ -10866,36 +10886,36 @@ function ensureImport(ts2, tsSourceFile, importData) {
|
|
|
10866
10886
|
}
|
|
10867
10887
|
return tsSourceFile;
|
|
10868
10888
|
}
|
|
10869
|
-
function ensureNamedImport(
|
|
10870
|
-
if (!hasNamedImport(
|
|
10871
|
-
tsSourceFile = appendImports(
|
|
10889
|
+
function ensureNamedImport(ts, tsSourceFile, namedImport, importPath) {
|
|
10890
|
+
if (!hasNamedImport(ts, tsSourceFile, namedImport, importPath)) {
|
|
10891
|
+
tsSourceFile = appendImports(ts, tsSourceFile, null, namedImport, importPath);
|
|
10872
10892
|
}
|
|
10873
10893
|
return tsSourceFile;
|
|
10874
10894
|
}
|
|
10875
|
-
function ensureDefaultImport(
|
|
10876
|
-
if (!hasDefaultImport(
|
|
10877
|
-
tsSourceFile = appendImports(
|
|
10895
|
+
function ensureDefaultImport(ts, tsSourceFile, defaultImport, importPath) {
|
|
10896
|
+
if (!hasDefaultImport(ts, tsSourceFile, importPath)) {
|
|
10897
|
+
tsSourceFile = appendImports(ts, tsSourceFile, defaultImport, null, importPath);
|
|
10878
10898
|
}
|
|
10879
10899
|
return tsSourceFile;
|
|
10880
10900
|
}
|
|
10881
|
-
function hasNamedImport(
|
|
10882
|
-
return !!findNamedImport(
|
|
10901
|
+
function hasNamedImport(ts, tsSourceFile, namedImport, importPath) {
|
|
10902
|
+
return !!findNamedImport(ts, tsSourceFile, namedImport, importPath);
|
|
10883
10903
|
}
|
|
10884
|
-
function hasDefaultImport(
|
|
10885
|
-
return !!findDefaultImport(
|
|
10904
|
+
function hasDefaultImport(ts, tsSourceFile, importPath) {
|
|
10905
|
+
return !!findDefaultImport(ts, tsSourceFile, importPath);
|
|
10886
10906
|
}
|
|
10887
|
-
function findNamedImport(
|
|
10888
|
-
return findImportDeclarations(
|
|
10889
|
-
if (n2.importClause && n2.moduleSpecifier &&
|
|
10907
|
+
function findNamedImport(ts, tsSourceFile, namedImport, importPath) {
|
|
10908
|
+
return findImportDeclarations(ts, tsSourceFile).find((n2) => {
|
|
10909
|
+
if (n2.importClause && n2.moduleSpecifier && ts.isStringLiteral(n2.moduleSpecifier)) {
|
|
10890
10910
|
if (n2.moduleSpecifier.text !== importPath) {
|
|
10891
10911
|
return false;
|
|
10892
10912
|
}
|
|
10893
10913
|
const namedImports = n2.importClause.namedBindings;
|
|
10894
|
-
if (namedImports &&
|
|
10914
|
+
if (namedImports && ts.isNamedImports(namedImports) && namedImports.elements) {
|
|
10895
10915
|
return namedImports.elements.some((namedImportElement) => {
|
|
10896
|
-
if (
|
|
10916
|
+
if (ts.isImportSpecifier(namedImportElement)) {
|
|
10897
10917
|
const importName = namedImportElement.name;
|
|
10898
|
-
if (importName &&
|
|
10918
|
+
if (importName && ts.isIdentifier(importName)) {
|
|
10899
10919
|
return importName.text === namedImport;
|
|
10900
10920
|
}
|
|
10901
10921
|
}
|
|
@@ -10906,11 +10926,11 @@ function findNamedImport(ts2, tsSourceFile, namedImport, importPath) {
|
|
|
10906
10926
|
return false;
|
|
10907
10927
|
});
|
|
10908
10928
|
}
|
|
10909
|
-
function findDefaultImport(
|
|
10910
|
-
return findImportDeclarations(
|
|
10929
|
+
function findDefaultImport(ts, tsSourceFile, importPath) {
|
|
10930
|
+
return findImportDeclarations(ts, tsSourceFile).find((n2) => {
|
|
10911
10931
|
if (n2.importClause && n2.moduleSpecifier) {
|
|
10912
10932
|
const modulePath = n2.moduleSpecifier;
|
|
10913
|
-
if (
|
|
10933
|
+
if (ts.isStringLiteral(modulePath) && modulePath.text === importPath) {
|
|
10914
10934
|
const moduleDefault = n2.importClause.name;
|
|
10915
10935
|
if (moduleDefault && moduleDefault.text === importPath) {
|
|
10916
10936
|
return true;
|
|
@@ -10920,18 +10940,18 @@ function findDefaultImport(ts2, tsSourceFile, importPath) {
|
|
|
10920
10940
|
return false;
|
|
10921
10941
|
});
|
|
10922
10942
|
}
|
|
10923
|
-
function findImportDeclarations(
|
|
10924
|
-
return tsSourceFile.statements.filter(
|
|
10943
|
+
function findImportDeclarations(ts, tsSourceFile) {
|
|
10944
|
+
return tsSourceFile.statements.filter(ts.isImportDeclaration);
|
|
10925
10945
|
}
|
|
10926
|
-
function appendImports(
|
|
10946
|
+
function appendImports(ts, tsSourceFile, defaultImport, namedImport, importPath) {
|
|
10927
10947
|
const statements = tsSourceFile.statements.slice();
|
|
10928
10948
|
let foundExistingImport = false;
|
|
10929
10949
|
for (let i2 = statements.length - 1; i2 >= 0; i2--) {
|
|
10930
10950
|
const n2 = statements[i2];
|
|
10931
|
-
if (!
|
|
10951
|
+
if (!ts.isImportDeclaration(n2)) {
|
|
10932
10952
|
continue;
|
|
10933
10953
|
}
|
|
10934
|
-
if (!n2.moduleSpecifier || !
|
|
10954
|
+
if (!n2.moduleSpecifier || !ts.isStringLiteral(n2.moduleSpecifier)) {
|
|
10935
10955
|
continue;
|
|
10936
10956
|
}
|
|
10937
10957
|
if (n2.moduleSpecifier.text !== importPath) {
|
|
@@ -10941,13 +10961,13 @@ function appendImports(ts2, tsSourceFile, defaultImport, namedImport, importPath
|
|
|
10941
10961
|
const existingNamedImports = [];
|
|
10942
10962
|
if (n2.importClause) {
|
|
10943
10963
|
const namedImports = n2.importClause.namedBindings;
|
|
10944
|
-
if (namedImports &&
|
|
10964
|
+
if (namedImports && ts.isNamedImports(namedImports) && namedImports.elements) {
|
|
10945
10965
|
existingNamedImports.push(...namedImports.elements);
|
|
10946
10966
|
}
|
|
10947
10967
|
}
|
|
10948
10968
|
if (typeof namedImport === "string") {
|
|
10949
|
-
const identifier =
|
|
10950
|
-
const importSpecifier =
|
|
10969
|
+
const identifier = ts.factory.createIdentifier(namedImport);
|
|
10970
|
+
const importSpecifier = ts.factory.createImportSpecifier(false, void 0, identifier);
|
|
10951
10971
|
existingNamedImports.push(importSpecifier);
|
|
10952
10972
|
}
|
|
10953
10973
|
existingNamedImports.sort((a2, b3) => {
|
|
@@ -10957,16 +10977,16 @@ function appendImports(ts2, tsSourceFile, defaultImport, namedImport, importPath
|
|
|
10957
10977
|
});
|
|
10958
10978
|
let defaultIdentifier = n2.importClause ? n2.importClause.name : void 0;
|
|
10959
10979
|
if (typeof defaultImport === "string") {
|
|
10960
|
-
defaultIdentifier =
|
|
10980
|
+
defaultIdentifier = ts.factory.createIdentifier(defaultImport);
|
|
10961
10981
|
}
|
|
10962
10982
|
let namedBindings = void 0;
|
|
10963
10983
|
if (existingNamedImports.length > 0) {
|
|
10964
|
-
namedBindings =
|
|
10984
|
+
namedBindings = ts.factory.createNamedImports(existingNamedImports);
|
|
10965
10985
|
}
|
|
10966
|
-
statements[i2] =
|
|
10986
|
+
statements[i2] = ts.factory.updateImportDeclaration(
|
|
10967
10987
|
n2,
|
|
10968
10988
|
void 0,
|
|
10969
|
-
|
|
10989
|
+
ts.factory.createImportClause(false, defaultIdentifier, namedBindings),
|
|
10970
10990
|
n2.moduleSpecifier,
|
|
10971
10991
|
void 0
|
|
10972
10992
|
);
|
|
@@ -10975,61 +10995,61 @@ function appendImports(ts2, tsSourceFile, defaultImport, namedImport, importPath
|
|
|
10975
10995
|
let defaultIdentifier = void 0;
|
|
10976
10996
|
let namedBindings = void 0;
|
|
10977
10997
|
if (typeof defaultImport === "string") {
|
|
10978
|
-
defaultIdentifier =
|
|
10998
|
+
defaultIdentifier = ts.factory.createIdentifier(defaultImport);
|
|
10979
10999
|
}
|
|
10980
11000
|
if (typeof namedImport === "string") {
|
|
10981
|
-
namedBindings =
|
|
10982
|
-
|
|
11001
|
+
namedBindings = ts.factory.createNamedImports([
|
|
11002
|
+
ts.factory.createImportSpecifier(
|
|
10983
11003
|
false,
|
|
10984
11004
|
void 0,
|
|
10985
|
-
|
|
11005
|
+
ts.factory.createIdentifier(namedImport)
|
|
10986
11006
|
)
|
|
10987
11007
|
]);
|
|
10988
11008
|
}
|
|
10989
|
-
const newNamedImport =
|
|
11009
|
+
const newNamedImport = ts.factory.createImportDeclaration(
|
|
10990
11010
|
void 0,
|
|
10991
|
-
|
|
10992
|
-
|
|
11011
|
+
ts.factory.createImportClause(false, defaultIdentifier, namedBindings),
|
|
11012
|
+
ts.factory.createStringLiteral(importPath)
|
|
10993
11013
|
);
|
|
10994
|
-
const lastImportIndex = findLastImportIndex(
|
|
11014
|
+
const lastImportIndex = findLastImportIndex(ts, tsSourceFile);
|
|
10995
11015
|
statements.splice(lastImportIndex + 1, 0, newNamedImport);
|
|
10996
11016
|
}
|
|
10997
|
-
return
|
|
11017
|
+
return ts.factory.updateSourceFile(tsSourceFile, statements);
|
|
10998
11018
|
}
|
|
10999
|
-
function findLastImportIndex(
|
|
11019
|
+
function findLastImportIndex(ts, tsSourceFile) {
|
|
11000
11020
|
for (let i2 = tsSourceFile.statements.length - 1; i2 >= 0; i2--) {
|
|
11001
11021
|
const s2 = tsSourceFile.statements[i2];
|
|
11002
|
-
if (
|
|
11022
|
+
if (ts.isImportDeclaration(s2)) {
|
|
11003
11023
|
return i2;
|
|
11004
11024
|
}
|
|
11005
|
-
if (
|
|
11025
|
+
if (ts.isStringLiteral(s2) && s2.text === "use strict") {
|
|
11006
11026
|
return i2;
|
|
11007
11027
|
}
|
|
11008
11028
|
}
|
|
11009
11029
|
return 0;
|
|
11010
11030
|
}
|
|
11011
|
-
function updateDefineConfig(
|
|
11031
|
+
function updateDefineConfig(ts, callExp, updates) {
|
|
11012
11032
|
const args = [];
|
|
11013
11033
|
for (let i2 = 0; i2 < callExp.arguments.length; i2++) {
|
|
11014
11034
|
const exp = callExp.arguments[i2];
|
|
11015
11035
|
if (i2 === 0) {
|
|
11016
|
-
if (
|
|
11036
|
+
if (ts.isArrowFunction(exp) && ts.isBlock(exp.body)) {
|
|
11017
11037
|
args.push(
|
|
11018
|
-
|
|
11038
|
+
ts.factory.updateArrowFunction(
|
|
11019
11039
|
exp,
|
|
11020
11040
|
exp.modifiers,
|
|
11021
11041
|
exp.typeParameters,
|
|
11022
11042
|
exp.parameters,
|
|
11023
11043
|
exp.type,
|
|
11024
11044
|
exp.equalsGreaterThanToken,
|
|
11025
|
-
updateDefineConfigFnReturn(
|
|
11045
|
+
updateDefineConfigFnReturn(ts, exp.body, updates)
|
|
11026
11046
|
)
|
|
11027
11047
|
);
|
|
11028
11048
|
continue;
|
|
11029
11049
|
}
|
|
11030
|
-
if (
|
|
11050
|
+
if (ts.isFunctionExpression(exp) && ts.isBlock(exp.body)) {
|
|
11031
11051
|
args.push(
|
|
11032
|
-
|
|
11052
|
+
ts.factory.updateFunctionExpression(
|
|
11033
11053
|
exp,
|
|
11034
11054
|
exp.modifiers,
|
|
11035
11055
|
exp.asteriskToken,
|
|
@@ -11037,53 +11057,55 @@ function updateDefineConfig(ts2, callExp, updates) {
|
|
|
11037
11057
|
exp.typeParameters,
|
|
11038
11058
|
exp.parameters,
|
|
11039
11059
|
exp.type,
|
|
11040
|
-
updateDefineConfigFnReturn(
|
|
11060
|
+
updateDefineConfigFnReturn(ts, exp.body, updates)
|
|
11041
11061
|
)
|
|
11042
11062
|
);
|
|
11043
11063
|
continue;
|
|
11044
11064
|
}
|
|
11045
|
-
if (
|
|
11046
|
-
args.push(updateVitConfigObj(
|
|
11065
|
+
if (ts.isObjectLiteralExpression(exp)) {
|
|
11066
|
+
args.push(updateVitConfigObj(ts, exp, updates));
|
|
11047
11067
|
continue;
|
|
11048
11068
|
}
|
|
11049
11069
|
}
|
|
11050
11070
|
args.push(exp);
|
|
11051
11071
|
}
|
|
11052
|
-
return
|
|
11072
|
+
return ts.factory.updateCallExpression(callExp, callExp.expression, callExp.typeArguments, args);
|
|
11053
11073
|
}
|
|
11054
|
-
function updateDefineConfigFnReturn(
|
|
11074
|
+
function updateDefineConfigFnReturn(ts, fnBody, updates) {
|
|
11055
11075
|
const statements = [];
|
|
11056
|
-
for (
|
|
11057
|
-
|
|
11076
|
+
for (let i2 = 0; i2 < fnBody.statements.length; i2++) {
|
|
11077
|
+
const s2 = fnBody.statements[i2];
|
|
11078
|
+
if (ts.isReturnStatement(s2) && s2.expression && ts.isObjectLiteralExpression(s2.expression)) {
|
|
11058
11079
|
statements.push(
|
|
11059
|
-
|
|
11080
|
+
ts.factory.updateReturnStatement(s2, updateVitConfigObj(ts, s2.expression, updates))
|
|
11060
11081
|
);
|
|
11061
11082
|
} else {
|
|
11062
11083
|
statements.push(s2);
|
|
11063
11084
|
}
|
|
11064
11085
|
}
|
|
11065
|
-
return
|
|
11086
|
+
return ts.factory.updateBlock(fnBody, statements);
|
|
11066
11087
|
}
|
|
11067
|
-
function updateVitConfigObj(
|
|
11088
|
+
function updateVitConfigObj(ts, obj, updates) {
|
|
11068
11089
|
if (updates.viteConfig) {
|
|
11069
|
-
obj = updateObjectLiteralExpression(
|
|
11090
|
+
obj = updateObjectLiteralExpression(ts, obj, updates.viteConfig);
|
|
11070
11091
|
}
|
|
11071
11092
|
if (updates.vitePlugins || updates.vitePluginsPrepend || updates.qwikViteConfig) {
|
|
11072
|
-
obj = updatePlugins(
|
|
11093
|
+
obj = updatePlugins(ts, obj, updates);
|
|
11073
11094
|
}
|
|
11074
11095
|
return obj;
|
|
11075
11096
|
}
|
|
11076
|
-
function updatePlugins(
|
|
11097
|
+
function updatePlugins(ts, obj, updates) {
|
|
11077
11098
|
const properties = [];
|
|
11078
|
-
for (
|
|
11079
|
-
|
|
11080
|
-
|
|
11081
|
-
|
|
11099
|
+
for (let i2 = 0; i2 < obj.properties.length; i2++) {
|
|
11100
|
+
const p2 = obj.properties[i2];
|
|
11101
|
+
if (ts.isPropertyAssignment(p2)) {
|
|
11102
|
+
if (p2.name && ts.isIdentifier(p2.name) && p2.name.text === "plugins") {
|
|
11103
|
+
if (ts.isArrayLiteralExpression(p2.initializer)) {
|
|
11082
11104
|
properties.push(
|
|
11083
|
-
|
|
11105
|
+
ts.factory.updatePropertyAssignment(
|
|
11084
11106
|
p2,
|
|
11085
11107
|
p2.name,
|
|
11086
|
-
updatePluginsArray(
|
|
11108
|
+
updatePluginsArray(ts, p2.initializer, updates)
|
|
11087
11109
|
)
|
|
11088
11110
|
);
|
|
11089
11111
|
continue;
|
|
@@ -11092,16 +11114,17 @@ function updatePlugins(ts2, obj, updates) {
|
|
|
11092
11114
|
}
|
|
11093
11115
|
properties.push(p2);
|
|
11094
11116
|
}
|
|
11095
|
-
return
|
|
11117
|
+
return ts.factory.updateObjectLiteralExpression(obj, properties);
|
|
11096
11118
|
}
|
|
11097
|
-
function updatePluginsArray(
|
|
11119
|
+
function updatePluginsArray(ts, arr, updates) {
|
|
11098
11120
|
const elms = [...arr.elements];
|
|
11099
11121
|
if (updates.vitePlugins) {
|
|
11100
|
-
for (
|
|
11101
|
-
const
|
|
11122
|
+
for (let i2 = 0; i2 < updates.vitePlugins.length; i2++) {
|
|
11123
|
+
const vitePlugin = updates.vitePlugins[i2];
|
|
11124
|
+
const pluginExp = createPluginCall(ts, vitePlugin);
|
|
11102
11125
|
const pluginName = pluginExp?.expression?.escapedText;
|
|
11103
11126
|
const alreadyDefined = elms.some(
|
|
11104
|
-
(el) =>
|
|
11127
|
+
(el) => ts.isCallExpression(el) && ts.isIdentifier(el.expression) && el.expression.escapedText === pluginName
|
|
11105
11128
|
);
|
|
11106
11129
|
if (pluginExp && !alreadyDefined) {
|
|
11107
11130
|
elms.push(pluginExp);
|
|
@@ -11109,11 +11132,12 @@ function updatePluginsArray(ts2, arr, updates) {
|
|
|
11109
11132
|
}
|
|
11110
11133
|
}
|
|
11111
11134
|
if (updates.vitePluginsPrepend) {
|
|
11112
|
-
for (
|
|
11113
|
-
const
|
|
11135
|
+
for (let i2 = 0; i2 < updates.vitePluginsPrepend.length; i2++) {
|
|
11136
|
+
const vitePlugin = updates.vitePluginsPrepend[i2];
|
|
11137
|
+
const pluginExp = createPluginCall(ts, vitePlugin);
|
|
11114
11138
|
const pluginName = pluginExp?.expression?.escapedText;
|
|
11115
11139
|
const alreadyDefined = elms.some(
|
|
11116
|
-
(el) =>
|
|
11140
|
+
(el) => ts.isCallExpression(el) && ts.isIdentifier(el.expression) && el.expression.escapedText === pluginName
|
|
11117
11141
|
);
|
|
11118
11142
|
if (pluginExp && !alreadyDefined) {
|
|
11119
11143
|
elms.unshift(pluginExp);
|
|
@@ -11123,68 +11147,73 @@ function updatePluginsArray(ts2, arr, updates) {
|
|
|
11123
11147
|
if (updates.qwikViteConfig) {
|
|
11124
11148
|
for (let i2 = 0; i2 < elms.length; i2++) {
|
|
11125
11149
|
const elm = elms[i2];
|
|
11126
|
-
if (
|
|
11150
|
+
if (ts.isCallExpression(elm) && ts.isIdentifier(elm.expression)) {
|
|
11127
11151
|
if (elm.expression.escapedText === "qwikVite") {
|
|
11128
|
-
elms[i2] = updateQwikRouterPlugin(
|
|
11152
|
+
elms[i2] = updateQwikRouterPlugin(ts, elm, updates.qwikViteConfig);
|
|
11129
11153
|
}
|
|
11130
11154
|
}
|
|
11131
11155
|
}
|
|
11132
11156
|
}
|
|
11133
|
-
return
|
|
11157
|
+
return ts.factory.updateArrayLiteralExpression(arr, elms);
|
|
11134
11158
|
}
|
|
11135
|
-
function createPluginCall(
|
|
11159
|
+
function createPluginCall(ts, vitePlugin) {
|
|
11136
11160
|
if (typeof vitePlugin === "string") {
|
|
11137
|
-
const tmp =
|
|
11161
|
+
const tmp = ts.createSourceFile(
|
|
11138
11162
|
"tmp.ts",
|
|
11139
11163
|
"export default " + vitePlugin,
|
|
11140
|
-
|
|
11164
|
+
ts.ScriptTarget.Latest
|
|
11141
11165
|
);
|
|
11142
|
-
for (
|
|
11143
|
-
|
|
11166
|
+
for (let i2 = 0; i2 < tmp.statements.length; i2++) {
|
|
11167
|
+
const s2 = tmp.statements[i2];
|
|
11168
|
+
if (ts.isExportAssignment(s2)) {
|
|
11144
11169
|
return s2.expression;
|
|
11145
11170
|
}
|
|
11146
11171
|
}
|
|
11147
11172
|
}
|
|
11148
11173
|
return null;
|
|
11149
11174
|
}
|
|
11150
|
-
function updateQwikRouterPlugin(
|
|
11175
|
+
function updateQwikRouterPlugin(ts, callExp, qwikViteConfig) {
|
|
11151
11176
|
const args = callExp.arguments.slice();
|
|
11152
|
-
const config = args[0] &&
|
|
11153
|
-
args[0] = updateObjectLiteralExpression(
|
|
11154
|
-
return
|
|
11155
|
-
}
|
|
11156
|
-
function updateObjectLiteralExpression(
|
|
11157
|
-
|
|
11177
|
+
const config = args[0] && ts.isObjectLiteralExpression(args[0]) ? args[0] : ts.factory.createObjectLiteralExpression();
|
|
11178
|
+
args[0] = updateObjectLiteralExpression(ts, config, qwikViteConfig);
|
|
11179
|
+
return ts.factory.updateCallExpression(callExp, callExp.expression, callExp.typeArguments, args);
|
|
11180
|
+
}
|
|
11181
|
+
function updateObjectLiteralExpression(ts, obj, updateObj) {
|
|
11182
|
+
const properties = Object.entries(updateObj);
|
|
11183
|
+
for (let i2 = 0; i2 < properties.length; i2++) {
|
|
11184
|
+
const [propName, value] = properties[i2];
|
|
11158
11185
|
if (typeof value === "string") {
|
|
11159
|
-
const tmp =
|
|
11160
|
-
for (
|
|
11161
|
-
|
|
11186
|
+
const tmp = ts.createSourceFile("tmp.ts", "export default " + value, ts.ScriptTarget.Latest);
|
|
11187
|
+
for (let j2 = 0; j2 < tmp.statements.length; j2++) {
|
|
11188
|
+
const s2 = tmp.statements[j2];
|
|
11189
|
+
if (ts.isExportAssignment(s2)) {
|
|
11162
11190
|
const exp = s2.expression;
|
|
11163
11191
|
let added = false;
|
|
11164
|
-
const
|
|
11165
|
-
for (
|
|
11166
|
-
|
|
11167
|
-
|
|
11192
|
+
const properties2 = [];
|
|
11193
|
+
for (let k3 = 0; k3 < obj.properties.length; k3++) {
|
|
11194
|
+
const p2 = obj.properties[k3];
|
|
11195
|
+
if (p2.name && ts.isIdentifier(p2.name) && p2.name.text === propName) {
|
|
11196
|
+
properties2.push(ts.factory.createPropertyAssignment(propName, exp));
|
|
11168
11197
|
added = true;
|
|
11169
11198
|
} else {
|
|
11170
|
-
|
|
11199
|
+
properties2.push(p2);
|
|
11171
11200
|
}
|
|
11172
11201
|
}
|
|
11173
11202
|
if (!added) {
|
|
11174
|
-
|
|
11203
|
+
properties2.unshift(ts.factory.createPropertyAssignment(propName, exp));
|
|
11175
11204
|
}
|
|
11176
|
-
obj =
|
|
11205
|
+
obj = ts.factory.updateObjectLiteralExpression(obj, properties2);
|
|
11177
11206
|
}
|
|
11178
11207
|
}
|
|
11179
11208
|
}
|
|
11180
11209
|
}
|
|
11181
11210
|
return obj;
|
|
11182
11211
|
}
|
|
11183
|
-
function transformSource(
|
|
11184
|
-
const t =
|
|
11212
|
+
function transformSource(ts, sourceText, transformer) {
|
|
11213
|
+
const t = ts.transform(ts.createSourceFile("/tmp.ts", sourceText, ts.ScriptTarget.Latest), [
|
|
11185
11214
|
transformer
|
|
11186
11215
|
]);
|
|
11187
|
-
const p2 =
|
|
11216
|
+
const p2 = ts.createPrinter({
|
|
11188
11217
|
removeComments: false,
|
|
11189
11218
|
omitTrailingSemicolon: false,
|
|
11190
11219
|
noEmitHelpers: true
|
|
@@ -11205,8 +11234,8 @@ async function updateViteConfigs(fileUpdates, integration, rootDir) {
|
|
|
11205
11234
|
throw new Error(`Could not find vite.config.ts or vite.config.ts in ${rootDir}`);
|
|
11206
11235
|
}
|
|
11207
11236
|
const destContent = await fs4.promises.readFile(viteConfigPath, "utf-8");
|
|
11208
|
-
const
|
|
11209
|
-
let updatedContent = updateViteConfig(
|
|
11237
|
+
const ts = (await import("typescript")).default;
|
|
11238
|
+
let updatedContent = updateViteConfig(ts, destContent, viteConfig);
|
|
11210
11239
|
if (updatedContent) {
|
|
11211
11240
|
try {
|
|
11212
11241
|
const prettier = (await import("prettier")).default;
|
|
@@ -11272,7 +11301,9 @@ async function updateApp(pkgManager, opts) {
|
|
|
11272
11301
|
let passed = true;
|
|
11273
11302
|
try {
|
|
11274
11303
|
const dirs = new Set(fileUpdates.files.map((f) => dirname3(f.path)));
|
|
11275
|
-
|
|
11304
|
+
const dirsArray = Array.from(dirs);
|
|
11305
|
+
for (let i2 = 0; i2 < dirsArray.length; i2++) {
|
|
11306
|
+
const dir = dirsArray[i2];
|
|
11276
11307
|
try {
|
|
11277
11308
|
fs5.mkdirSync(dir, { recursive: true });
|
|
11278
11309
|
} catch (e2) {
|
|
@@ -11589,7 +11620,8 @@ async function printNewHelp() {
|
|
|
11589
11620
|
);
|
|
11590
11621
|
outString.push(``);
|
|
11591
11622
|
outString.push(`${cyan("Available templates")}`);
|
|
11592
|
-
for (
|
|
11623
|
+
for (let i2 = 0; i2 < templates2.length; i2++) {
|
|
11624
|
+
const t = templates2[i2];
|
|
11593
11625
|
let postfix = "";
|
|
11594
11626
|
if (t.id === "qwik") {
|
|
11595
11627
|
postfix = " (default)";
|
|
@@ -11774,7 +11806,8 @@ async function writeToFile(name, slug, template, outDir) {
|
|
|
11774
11806
|
}
|
|
11775
11807
|
function inject(raw, vars) {
|
|
11776
11808
|
let output = raw;
|
|
11777
|
-
for (
|
|
11809
|
+
for (let i2 = 0; i2 < vars.length; i2++) {
|
|
11810
|
+
const v2 = vars[i2];
|
|
11778
11811
|
output = output.replaceAll(v2[0], v2[1]);
|
|
11779
11812
|
}
|
|
11780
11813
|
return output;
|
|
@@ -11917,18 +11950,22 @@ async function runBuildCommand(app) {
|
|
|
11917
11950
|
);
|
|
11918
11951
|
}
|
|
11919
11952
|
console.log(``);
|
|
11920
|
-
for (
|
|
11953
|
+
for (let i2 = 0; i2 < prebuildScripts.length; i2++) {
|
|
11954
|
+
const script = prebuildScripts[i2];
|
|
11921
11955
|
console.log(dim(script));
|
|
11922
11956
|
}
|
|
11923
|
-
for (
|
|
11957
|
+
for (let i2 = 0; i2 < scripts.length; i2++) {
|
|
11958
|
+
const script = scripts[i2];
|
|
11924
11959
|
console.log(dim(script));
|
|
11925
11960
|
}
|
|
11926
|
-
for (
|
|
11961
|
+
for (let i2 = 0; i2 < postbuildScripts.length; i2++) {
|
|
11962
|
+
const script = postbuildScripts[i2];
|
|
11927
11963
|
console.log(dim(script));
|
|
11928
11964
|
}
|
|
11929
11965
|
console.log(``);
|
|
11930
11966
|
let typecheck = null;
|
|
11931
|
-
for (
|
|
11967
|
+
for (let i2 = 0; i2 < prebuildScripts.length; i2++) {
|
|
11968
|
+
const script = prebuildScripts[i2];
|
|
11932
11969
|
try {
|
|
11933
11970
|
await execaCommand(script, {
|
|
11934
11971
|
cwd: app.rootDir,
|
|
@@ -12103,13 +12140,14 @@ async function runBuildCommand(app) {
|
|
|
12103
12140
|
}
|
|
12104
12141
|
if (step2.length > 0) {
|
|
12105
12142
|
await Promise.all(step2).then((steps) => {
|
|
12106
|
-
steps.
|
|
12143
|
+
for (let i2 = 0; i2 < steps.length; i2++) {
|
|
12144
|
+
const step = steps[i2];
|
|
12107
12145
|
if (step.stdout) {
|
|
12108
12146
|
console.log("");
|
|
12109
12147
|
console.log(step.stdout);
|
|
12110
12148
|
}
|
|
12111
12149
|
console.log(`${cyan("\u2713")} ${step.title}`);
|
|
12112
|
-
}
|
|
12150
|
+
}
|
|
12113
12151
|
if (!isPreviewBuild && !buildServerScript && !buildStaticScript && !isLibraryBuild) {
|
|
12114
12152
|
const pmRun = pmRunCmd();
|
|
12115
12153
|
console.log(``);
|
|
@@ -12139,7 +12177,8 @@ async function runBuildCommand(app) {
|
|
|
12139
12177
|
}
|
|
12140
12178
|
}).catch((error) => console.log(red(error)));
|
|
12141
12179
|
}
|
|
12142
|
-
for (
|
|
12180
|
+
for (let i2 = 0; i2 < postbuildScripts.length; i2++) {
|
|
12181
|
+
const script = postbuildScripts[i2];
|
|
12143
12182
|
try {
|
|
12144
12183
|
await execaCommand(script, {
|
|
12145
12184
|
stdout: "inherit",
|
|
@@ -12474,12 +12513,14 @@ function replacePackageInDependencies(oldPackageName, newPackageName) {
|
|
|
12474
12513
|
}
|
|
12475
12514
|
try {
|
|
12476
12515
|
const packageJson = JSON.parse(readFileSync5(path7, "utf-8"));
|
|
12477
|
-
|
|
12516
|
+
const dependencies = [
|
|
12478
12517
|
packageJson.dependencies ?? {},
|
|
12479
12518
|
packageJson.devDependencies ?? {},
|
|
12480
12519
|
packageJson.peerDependencies ?? {},
|
|
12481
12520
|
packageJson.optionalDependencies ?? {}
|
|
12482
|
-
]
|
|
12521
|
+
];
|
|
12522
|
+
for (let i2 = 0; i2 < dependencies.length; i2++) {
|
|
12523
|
+
const deps = dependencies[i2];
|
|
12483
12524
|
if (oldPackageName in deps) {
|
|
12484
12525
|
deps[newPackageName] = deps[oldPackageName];
|
|
12485
12526
|
delete deps[oldPackageName];
|
|
@@ -12534,18 +12575,19 @@ var packageNames = [
|
|
|
12534
12575
|
|
|
12535
12576
|
// packages/qwik/src/cli/migrate-v2/update-dependencies.ts
|
|
12536
12577
|
init_dist2();
|
|
12537
|
-
import { major } from "semver";
|
|
12538
12578
|
async function updateDependencies() {
|
|
12539
12579
|
const packageJson = await readPackageJson(process.cwd());
|
|
12540
|
-
const version = getPackageTag();
|
|
12580
|
+
const version = await getPackageTag();
|
|
12541
12581
|
const dependencyNames = [
|
|
12542
12582
|
"dependencies",
|
|
12543
12583
|
"devDependencies",
|
|
12544
12584
|
"peerDependencies",
|
|
12545
12585
|
"optionalDependencies"
|
|
12546
12586
|
];
|
|
12547
|
-
for (
|
|
12548
|
-
|
|
12587
|
+
for (let i2 = 0; i2 < packageNames.length; i2++) {
|
|
12588
|
+
const name = packageNames[i2];
|
|
12589
|
+
for (let j2 = 0; j2 < dependencyNames.length; j2++) {
|
|
12590
|
+
const propName = dependencyNames[j2];
|
|
12549
12591
|
const prop = packageJson[propName];
|
|
12550
12592
|
if (prop && prop[name]) {
|
|
12551
12593
|
prop[name] = version;
|
|
@@ -12558,7 +12600,8 @@ async function updateDependencies() {
|
|
|
12558
12600
|
await runInstall();
|
|
12559
12601
|
loading.stop("Dependencies have been updated");
|
|
12560
12602
|
}
|
|
12561
|
-
function getPackageTag() {
|
|
12603
|
+
async function getPackageTag() {
|
|
12604
|
+
const { major } = await import("semver");
|
|
12562
12605
|
const tags = execSync("npm dist-tag @qwik.dev/core", {
|
|
12563
12606
|
encoding: "utf-8"
|
|
12564
12607
|
})?.split("\n").filter(Boolean).map(
|
|
@@ -12573,7 +12616,8 @@ function getPackageTag() {
|
|
|
12573
12616
|
}
|
|
12574
12617
|
return aIndex - bIndex;
|
|
12575
12618
|
});
|
|
12576
|
-
for (
|
|
12619
|
+
for (let i2 = 0; i2 < tags.length; i2++) {
|
|
12620
|
+
const [, version] = tags[i2];
|
|
12577
12621
|
if (major(version) === 2) {
|
|
12578
12622
|
return version;
|
|
12579
12623
|
}
|
|
@@ -12628,7 +12672,7 @@ ${bold(bgRed('Warning: migration tool is experimental and will migrate your appl
|
|
|
12628
12672
|
try {
|
|
12629
12673
|
const installedTsMorph = await installTsMorph();
|
|
12630
12674
|
const { replaceImportInFiles: replaceImportInFiles2 } = await Promise.resolve().then(() => (init_rename_import(), rename_import_exports));
|
|
12631
|
-
replaceImportInFiles2(
|
|
12675
|
+
await replaceImportInFiles2(
|
|
12632
12676
|
[
|
|
12633
12677
|
["QwikCityProvider", "QwikRouterProvider"],
|
|
12634
12678
|
["qwikCity", "qwikRouter"],
|
|
@@ -12639,12 +12683,12 @@ ${bold(bgRed('Warning: migration tool is experimental and will migrate your appl
|
|
|
12639
12683
|
],
|
|
12640
12684
|
"@builder.io/qwik-city"
|
|
12641
12685
|
);
|
|
12642
|
-
replaceImportInFiles2(
|
|
12686
|
+
await replaceImportInFiles2(
|
|
12643
12687
|
[["qwikCityPlan", "qwikRouterConfig"]],
|
|
12644
12688
|
"@qwik-city-plan"
|
|
12645
12689
|
// using old name, package name will be updated in the next step
|
|
12646
12690
|
);
|
|
12647
|
-
replaceImportInFiles2([["jsxs", "jsx"]], "@builder.io/qwik/jsx-runtime");
|
|
12691
|
+
await replaceImportInFiles2([["jsxs", "jsx"]], "@builder.io/qwik/jsx-runtime");
|
|
12648
12692
|
replacePackage("@qwik-city-plan", "@qwik-router-config", true);
|
|
12649
12693
|
replacePackage("@builder.io/qwik-city", "@qwik.dev/router");
|
|
12650
12694
|
replacePackage("@builder.io/qwik-react", "@qwik.dev/react");
|
|
@@ -12733,7 +12777,8 @@ async function hasNewer(srcPath, timestamp) {
|
|
|
12733
12777
|
} catch (err) {
|
|
12734
12778
|
return;
|
|
12735
12779
|
}
|
|
12736
|
-
for (
|
|
12780
|
+
for (let i2 = 0; i2 < items.length; i2++) {
|
|
12781
|
+
const item = items[i2];
|
|
12737
12782
|
if (returnValue) {
|
|
12738
12783
|
return;
|
|
12739
12784
|
}
|
|
@@ -12908,7 +12953,7 @@ async function printHelp(app) {
|
|
|
12908
12953
|
await runCommand2(Object.assign(app, { task: args[0], args }));
|
|
12909
12954
|
}
|
|
12910
12955
|
function printVersion() {
|
|
12911
|
-
console.log("2.0.0-beta.
|
|
12956
|
+
console.log("2.0.0-beta.31-dev+906321a");
|
|
12912
12957
|
}
|
|
12913
12958
|
export {
|
|
12914
12959
|
runCli,
|