@reliverse/dler 1.7.151 → 1.7.152

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.
@@ -146,8 +146,8 @@ export declare const optionsSchema: z.ZodObject<{
146
146
  cwd: z.ZodString;
147
147
  config: z.ZodOptional<z.ZodString>;
148
148
  database: z.ZodOptional<z.ZodEnum<{
149
- sqlite: "sqlite";
150
149
  mysql: "mysql";
150
+ sqlite: "sqlite";
151
151
  mongodb: "mongodb";
152
152
  postgres: "postgres";
153
153
  mssql: "mssql";
@@ -1,5 +1,5 @@
1
1
  export declare const PROJECT_ROOT: string;
2
- export declare const cliVersion = "1.7.151";
2
+ export declare const cliVersion = "1.7.152";
3
3
  export declare const cliName = "@reliverse/rse";
4
4
  export declare const rseName = "@reliverse/rse";
5
5
  export declare const dlerName = "@reliverse/dler";
@@ -1,7 +1,7 @@
1
1
  import os from "node:os";
2
2
  import path from "@reliverse/pathkit";
3
3
  export const PROJECT_ROOT = path.resolve(process.cwd());
4
- const version = "1.7.151";
4
+ const version = "1.7.152";
5
5
  export const cliVersion = version;
6
6
  export const cliName = "@reliverse/rse";
7
7
  export const rseName = "@reliverse/rse";
@@ -1,8 +1,8 @@
1
1
  import { z } from "zod";
2
2
  export declare const DatabaseSchema: z.ZodEnum<{
3
3
  none: "none";
4
- sqlite: "sqlite";
5
4
  mysql: "mysql";
5
+ sqlite: "sqlite";
6
6
  mongodb: "mongodb";
7
7
  postgres: "postgres";
8
8
  }>;
@@ -18,15 +18,15 @@ export declare const BackendSchema: z.ZodEnum<{
18
18
  none: "none";
19
19
  hono: "hono";
20
20
  next: "next";
21
+ convex: "convex";
21
22
  express: "express";
22
23
  fastify: "fastify";
23
24
  elysia: "elysia";
24
- convex: "convex";
25
25
  }>;
26
26
  export type Backend = z.infer<typeof BackendSchema>;
27
27
  export declare const RuntimeSchema: z.ZodEnum<{
28
- none: "none";
29
28
  bun: "bun";
29
+ none: "none";
30
30
  node: "node";
31
31
  workers: "workers";
32
32
  }>;
@@ -39,14 +39,14 @@ export declare const FrontendSchema: z.ZodEnum<{
39
39
  next: "next";
40
40
  "react-router": "react-router";
41
41
  "tanstack-router": "tanstack-router";
42
- "tanstack-start": "tanstack-start";
43
42
  "native-nativewind": "native-nativewind";
44
43
  "native-unistyles": "native-unistyles";
44
+ "tanstack-start": "tanstack-start";
45
45
  }>;
46
46
  export type Frontend = z.infer<typeof FrontendSchema>;
47
47
  export declare const AddonsSchema: z.ZodEnum<{
48
- none: "none";
49
48
  biome: "biome";
49
+ none: "none";
50
50
  tauri: "tauri";
51
51
  starlight: "starlight";
52
52
  turborepo: "turborepo";
@@ -11,13 +11,11 @@ interface UpdateArgs {
11
11
  ignoreFields?: string[];
12
12
  }
13
13
  export declare function validatePackageJson(): Promise<string>;
14
- export declare function prepareAllUpdateCandidates(args: UpdateArgs): Promise<{
15
- candidates: string[];
16
- allDepsMap: Record<string, any>;
14
+ export declare function prepareAllUpdateCandidates(): Promise<{
17
15
  packageJsonFiles: string[];
18
16
  fileDepsMap: Map<string, Record<string, any>>;
19
17
  }>;
20
- export declare function checkPackageUpdates(candidates: string[], allDepsMap: Record<string, any>, args: UpdateArgs): Promise<UpdateResult[]>;
21
- export declare function updateAllPackageJsonFiles(packageJsonFiles: string[], toUpdate: UpdateResult[], savePrefix: string, fieldsToIgnore?: string[]): Promise<number>;
18
+ export declare function checkPackageUpdatesForFile(fileDepsMap: Record<string, any>, args: UpdateArgs): Promise<UpdateResult[]>;
19
+ export declare function updatePackageJsonFileDirectly(packageJsonPath: string, fileDepsMap: Record<string, any>, updatesToApply: UpdateResult[], savePrefix: string, fieldsToIgnore?: string[]): Promise<number>;
22
20
  export declare function handleInstallation(): Promise<void>;
23
21
  export {};
@@ -5,12 +5,11 @@ import pMap from "p-map";
5
5
  import { glob } from "tinyglobby";
6
6
  import { detectPackageManager } from "../utils/pm/pm-detect.js";
7
7
  import {
8
+ applyVersionUpdate,
8
9
  checkPackageUpdate,
9
10
  collectTargetDependencies,
10
- isNonSemverSpecifier,
11
11
  prepareDependenciesForUpdate,
12
- runInstallCommand,
13
- updatePackageJsonFile
12
+ runInstallCommand
14
13
  } from "./utils.js";
15
14
  export async function validatePackageJson() {
16
15
  const packageJsonPath = path.resolve(process.cwd(), "package.json");
@@ -20,7 +19,7 @@ export async function validatePackageJson() {
20
19
  }
21
20
  return packageJsonPath;
22
21
  }
23
- export async function prepareAllUpdateCandidates(args) {
22
+ export async function prepareAllUpdateCandidates() {
24
23
  const packageJsonFiles = await glob("**/package.json", {
25
24
  cwd: process.cwd(),
26
25
  absolute: true,
@@ -39,31 +38,15 @@ export async function prepareAllUpdateCandidates(args) {
39
38
  });
40
39
  if (packageJsonFiles.length === 0) {
41
40
  relinka("warn", "No package.json files found");
42
- return { candidates: [], allDepsMap: {}, packageJsonFiles: [], fileDepsMap: /* @__PURE__ */ new Map() };
41
+ return { packageJsonFiles: [], fileDepsMap: /* @__PURE__ */ new Map() };
43
42
  }
44
43
  relinka("verbose", `Found ${packageJsonFiles.length} package.json files`);
45
- const allDepsMap = {};
46
- const allCandidates = /* @__PURE__ */ new Set();
47
44
  const fileDepsMap = /* @__PURE__ */ new Map();
48
45
  for (const packageJsonPath of packageJsonFiles) {
49
46
  try {
50
47
  const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf8"));
51
48
  const { map } = collectTargetDependencies(packageJson);
52
- const candidates2 = prepareDependenciesForUpdate(map, args);
53
49
  fileDepsMap.set(packageJsonPath, map);
54
- for (const [dep, info] of Object.entries(map)) {
55
- if (!allDepsMap[dep]) {
56
- allDepsMap[dep] = { ...info, locations: new Set(info.locations) };
57
- } else {
58
- for (const location of info.locations) {
59
- allDepsMap[dep].locations.add(location);
60
- }
61
- allDepsMap[dep].versionSpec = info.versionSpec;
62
- }
63
- }
64
- for (const candidate of candidates2) {
65
- allCandidates.add(candidate);
66
- }
67
50
  } catch (error) {
68
51
  relinka(
69
52
  "warn",
@@ -71,25 +54,24 @@ export async function prepareAllUpdateCandidates(args) {
71
54
  );
72
55
  }
73
56
  }
74
- const candidates = Array.from(allCandidates);
75
- if (candidates.length === 0) {
76
- relinka("warn", "No dependencies to update");
77
- return { candidates: [], allDepsMap: {}, packageJsonFiles, fileDepsMap };
78
- }
79
57
  relinka("verbose", `Processing ${packageJsonFiles.length} package.json files`);
80
- return { candidates, allDepsMap, packageJsonFiles, fileDepsMap };
58
+ return { packageJsonFiles, fileDepsMap };
81
59
  }
82
- export async function checkPackageUpdates(candidates, allDepsMap, args) {
60
+ export async function checkPackageUpdatesForFile(fileDepsMap, args) {
83
61
  const options = {
84
62
  allowMajor: !!args.allowMajor,
85
63
  savePrefix: "^",
86
64
  // Use default prefix
87
65
  concurrency: args.concurrency || 5
88
66
  };
67
+ const candidates = prepareDependenciesForUpdate(fileDepsMap, args);
68
+ if (candidates.length === 0) {
69
+ return [];
70
+ }
89
71
  return await pMap(
90
72
  candidates,
91
73
  async (dep) => {
92
- const depInfo = allDepsMap[dep];
74
+ const depInfo = fileDepsMap[dep];
93
75
  if (!depInfo?.versionSpec) {
94
76
  return {
95
77
  package: dep,
@@ -106,45 +88,43 @@ export async function checkPackageUpdates(candidates, allDepsMap, args) {
106
88
  { concurrency: args.concurrency || 5 }
107
89
  );
108
90
  }
109
- export async function updateAllPackageJsonFiles(packageJsonFiles, toUpdate, savePrefix, fieldsToIgnore = []) {
110
- if (packageJsonFiles.length === 0 || toUpdate.length === 0) {
111
- return 0;
112
- }
113
- let totalUpdated = 0;
114
- for (const packageJsonPath of packageJsonFiles) {
115
- try {
116
- const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf8"));
117
- const { map: fileDepsMap } = collectTargetDependencies(packageJson);
118
- const fileSpecificUpdates = toUpdate.filter((update) => {
119
- const depInfo = fileDepsMap[update.package];
120
- if (!depInfo) return false;
121
- if (isNonSemverSpecifier(depInfo.versionSpec)) {
122
- return false;
123
- }
124
- return true;
125
- });
126
- if (fileSpecificUpdates.length > 0) {
127
- const updated = await updatePackageJsonFile(
128
- packageJsonPath,
129
- fileDepsMap,
130
- fileSpecificUpdates,
131
- savePrefix,
132
- fieldsToIgnore
133
- );
134
- totalUpdated += updated;
135
- if (updated > 0) {
136
- const relativePath = path.relative(process.cwd(), packageJsonPath);
137
- relinka("verbose", `Updated ${updated} dependencies in ${relativePath}`);
91
+ export async function updatePackageJsonFileDirectly(packageJsonPath, fileDepsMap, updatesToApply, savePrefix, fieldsToIgnore = []) {
92
+ if (updatesToApply.length === 0) return 0;
93
+ try {
94
+ const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf8"));
95
+ const updatedPackageJson = { ...packageJson };
96
+ for (const update of updatesToApply) {
97
+ const depInfo = fileDepsMap[update.package];
98
+ if (!depInfo) continue;
99
+ const locations = depInfo.locations || /* @__PURE__ */ new Set();
100
+ const shouldIgnore = Array.from(locations).some(
101
+ (location) => fieldsToIgnore.includes(String(location))
102
+ );
103
+ if (shouldIgnore) {
104
+ continue;
105
+ }
106
+ let newVersion;
107
+ if (locations.has("peerDependencies")) {
108
+ const currentVersion = String(fileDepsMap[update.package]?.versionSpec || "");
109
+ if (currentVersion.startsWith(">=")) {
110
+ newVersion = `>=${update.latestVersion}`;
111
+ } else {
112
+ newVersion = savePrefix === "none" ? update.latestVersion : `${savePrefix}${update.latestVersion}`;
138
113
  }
114
+ } else {
115
+ newVersion = savePrefix === "none" ? update.latestVersion : `${savePrefix}${update.latestVersion}`;
139
116
  }
140
- } catch (error) {
141
- relinka(
142
- "warn",
143
- `Failed to process ${packageJsonPath}: ${error instanceof Error ? error.message : String(error)}`
144
- );
117
+ applyVersionUpdate(updatedPackageJson, update.package, newVersion, locations);
145
118
  }
119
+ await fs.writeFile(packageJsonPath, JSON.stringify(updatedPackageJson, null, 2) + "\n", "utf8");
120
+ return updatesToApply.length;
121
+ } catch (error) {
122
+ relinka(
123
+ "warn",
124
+ `Failed to update ${packageJsonPath}: ${error instanceof Error ? error.message : String(error)}`
125
+ );
126
+ return 0;
146
127
  }
147
- return totalUpdated;
148
128
  }
149
129
  export async function handleInstallation() {
150
130
  const packageManager = await detectPackageManager(process.cwd());
package/bin/mod.d.ts CHANGED
@@ -312,7 +312,7 @@ export { openVercelTools } from "./impl/toolbox/toolbox-vercel";
312
312
  export type { BundleSource, IndentOptions, MagicStringOptions, OverwriteOptions, StringTransformer, TransformResult, UpdateOptions, } from "./impl/transform/transform-impl-mod";
313
313
  export { append, compose, createBundle, createTransformer, createTransformerFromMagicString, indent, insertAt, overwrite, pipe, prepend, readAndTransform, remove, replace, replaceAll, slice, template, transformAndWrite, transformMultiple, trim, update, wrapWith, } from "./impl/transform/transform-impl-mod";
314
314
  export type { AppParams, ArgTypeShared, BaseBuildEntry, BaseConfig, Behavior, BiomeConfig, BiomeConfigResult, BuildContext, BuildEntry, BuildHooks, BuildOptions, BuildPreset, CamelCase, CheckIssue, CheckResult, ColumnType, CommonCliArgs, CopyBuildEntry, CopyHooks, CreateLoaderOptions, DatabasePostgresProvider, DatabaseProvider, DeploymentService, DetectedProject, DirectoryType, DistDirs, DistDirsAll, EsbuildOptions, GitModParams, HyphenatedStringToCamelCase, IconName, InputFile, IntegrationCategory, IntegrationConfig, IntegrationOption, IntegrationOptions, IterableError, Loader, LoaderContext, LoaderResult, LoadFile, MkdistBuildEntry, MkdistHooks, MkdistOptions, ModernReplacement, MonorepoType, NavItem, NavItemWithChildren, NavigationEntry, OutputFile, ParamsOmitReli, ParamsOmitSkipPN, PerfTimer, PrismaField, PrismaModel, ProjectConfigReturn, ProjectSelectionResult, RemovalConfig, RollupBuildEntry, RollupBuildOptions, RollupHooks, RollupOptions, RulesCheckOptions, ShadcnConfig, SubOption, TableSchema, Theme, UnifiedBuildConfig, UntypedBuildEntry, UntypedHooks, UntypedOutput, UntypedOutputs, VSCodeSettings, } from "./impl/types/mod";
315
- export { checkPackageUpdates, handleInstallation, prepareAllUpdateCandidates, updateAllPackageJsonFiles, validatePackageJson, } from "./impl/update/impl";
315
+ export { checkPackageUpdatesForFile, handleInstallation, prepareAllUpdateCandidates, updatePackageJsonFileDirectly, validatePackageJson, } from "./impl/update/impl";
316
316
  export type { DependencyInfo, PackageCheckOptions, UpdateResult, } from "./impl/update/utils";
317
317
  export { applyVersionUpdate, checkPackageUpdate, collectTargetDependencies, displayStructuredUpdateResults, fetchVersionFromRegistry, getLatestVersion, getPmOptions, isCatalogReference, isNonSemverSpecifier, isNpmAlias, isSemverCompatible, isWorkspaceDependency, prepareDependenciesForUpdate, runInstallCommand, updatePackageJsonFile, } from "./impl/update/utils";
318
318
  export type { UploadFile, UploadResult } from "./impl/upload/providers/providers-mod";
package/bin/mod.js CHANGED
@@ -767,10 +767,10 @@ export {
767
767
  wrapWith
768
768
  } from "./impl/transform/transform-impl-mod.js";
769
769
  export {
770
- checkPackageUpdates,
770
+ checkPackageUpdatesForFile,
771
771
  handleInstallation,
772
772
  prepareAllUpdateCandidates,
773
- updateAllPackageJsonFiles,
773
+ updatePackageJsonFileDirectly,
774
774
  validatePackageJson
775
775
  } from "./impl/update/impl.js";
776
776
  export {
package/package.json CHANGED
@@ -123,7 +123,7 @@
123
123
  "license": "MIT",
124
124
  "name": "@reliverse/dler",
125
125
  "type": "module",
126
- "version": "1.7.151",
126
+ "version": "1.7.152",
127
127
  "author": "reliverse",
128
128
  "bugs": {
129
129
  "email": "blefnk@gmail.com",