@reliverse/dler 1.7.150 → 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.150";
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.150";
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,15 +39,15 @@ 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
+ biome: "biome";
48
49
  none: "none";
49
50
  tauri: "tauri";
50
- biome: "biome";
51
51
  starlight: "starlight";
52
52
  turborepo: "turborepo";
53
53
  pwa: "pwa";
@@ -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,11 +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
11
  prepareDependenciesForUpdate,
11
- runInstallCommand,
12
- updatePackageJsonFile
12
+ runInstallCommand
13
13
  } from "./utils.js";
14
14
  export async function validatePackageJson() {
15
15
  const packageJsonPath = path.resolve(process.cwd(), "package.json");
@@ -19,7 +19,7 @@ export async function validatePackageJson() {
19
19
  }
20
20
  return packageJsonPath;
21
21
  }
22
- export async function prepareAllUpdateCandidates(args) {
22
+ export async function prepareAllUpdateCandidates() {
23
23
  const packageJsonFiles = await glob("**/package.json", {
24
24
  cwd: process.cwd(),
25
25
  absolute: true,
@@ -38,31 +38,15 @@ export async function prepareAllUpdateCandidates(args) {
38
38
  });
39
39
  if (packageJsonFiles.length === 0) {
40
40
  relinka("warn", "No package.json files found");
41
- return { candidates: [], allDepsMap: {}, packageJsonFiles: [], fileDepsMap: /* @__PURE__ */ new Map() };
41
+ return { packageJsonFiles: [], fileDepsMap: /* @__PURE__ */ new Map() };
42
42
  }
43
43
  relinka("verbose", `Found ${packageJsonFiles.length} package.json files`);
44
- const allDepsMap = {};
45
- const allCandidates = /* @__PURE__ */ new Set();
46
44
  const fileDepsMap = /* @__PURE__ */ new Map();
47
45
  for (const packageJsonPath of packageJsonFiles) {
48
46
  try {
49
47
  const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf8"));
50
48
  const { map } = collectTargetDependencies(packageJson);
51
- const candidates2 = prepareDependenciesForUpdate(map, args);
52
49
  fileDepsMap.set(packageJsonPath, map);
53
- for (const [dep, info] of Object.entries(map)) {
54
- if (!allDepsMap[dep]) {
55
- allDepsMap[dep] = { ...info, locations: new Set(info.locations) };
56
- } else {
57
- for (const location of info.locations) {
58
- allDepsMap[dep].locations.add(location);
59
- }
60
- allDepsMap[dep].versionSpec = info.versionSpec;
61
- }
62
- }
63
- for (const candidate of candidates2) {
64
- allCandidates.add(candidate);
65
- }
66
50
  } catch (error) {
67
51
  relinka(
68
52
  "warn",
@@ -70,25 +54,24 @@ export async function prepareAllUpdateCandidates(args) {
70
54
  );
71
55
  }
72
56
  }
73
- const candidates = Array.from(allCandidates);
74
- if (candidates.length === 0) {
75
- relinka("warn", "No dependencies to update");
76
- return { candidates: [], allDepsMap: {}, packageJsonFiles, fileDepsMap };
77
- }
78
57
  relinka("verbose", `Processing ${packageJsonFiles.length} package.json files`);
79
- return { candidates, allDepsMap, packageJsonFiles, fileDepsMap };
58
+ return { packageJsonFiles, fileDepsMap };
80
59
  }
81
- export async function checkPackageUpdates(candidates, allDepsMap, args) {
60
+ export async function checkPackageUpdatesForFile(fileDepsMap, args) {
82
61
  const options = {
83
62
  allowMajor: !!args.allowMajor,
84
63
  savePrefix: "^",
85
64
  // Use default prefix
86
65
  concurrency: args.concurrency || 5
87
66
  };
67
+ const candidates = prepareDependenciesForUpdate(fileDepsMap, args);
68
+ if (candidates.length === 0) {
69
+ return [];
70
+ }
88
71
  return await pMap(
89
72
  candidates,
90
73
  async (dep) => {
91
- const depInfo = allDepsMap[dep];
74
+ const depInfo = fileDepsMap[dep];
92
75
  if (!depInfo?.versionSpec) {
93
76
  return {
94
77
  package: dep,
@@ -105,38 +88,43 @@ export async function checkPackageUpdates(candidates, allDepsMap, args) {
105
88
  { concurrency: args.concurrency || 5 }
106
89
  );
107
90
  }
108
- export async function updateAllPackageJsonFiles(packageJsonFiles, toUpdate, savePrefix, fieldsToIgnore = []) {
109
- if (packageJsonFiles.length === 0 || toUpdate.length === 0) {
110
- return 0;
111
- }
112
- let totalUpdated = 0;
113
- for (const packageJsonPath of packageJsonFiles) {
114
- try {
115
- const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf8"));
116
- const { map: fileDepsMap } = collectTargetDependencies(packageJson);
117
- const fileSpecificUpdates = toUpdate.filter((update) => fileDepsMap[update.package]);
118
- if (fileSpecificUpdates.length > 0) {
119
- const updated = await updatePackageJsonFile(
120
- packageJsonPath,
121
- fileDepsMap,
122
- fileSpecificUpdates,
123
- savePrefix,
124
- fieldsToIgnore
125
- );
126
- totalUpdated += updated;
127
- if (updated > 0) {
128
- const relativePath = path.relative(process.cwd(), packageJsonPath);
129
- 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}`;
130
113
  }
114
+ } else {
115
+ newVersion = savePrefix === "none" ? update.latestVersion : `${savePrefix}${update.latestVersion}`;
131
116
  }
132
- } catch (error) {
133
- relinka(
134
- "warn",
135
- `Failed to process ${packageJsonPath}: ${error instanceof Error ? error.message : String(error)}`
136
- );
117
+ applyVersionUpdate(updatedPackageJson, update.package, newVersion, locations);
137
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;
138
127
  }
139
- return totalUpdated;
140
128
  }
141
129
  export async function handleInstallation() {
142
130
  const packageManager = await detectPackageManager(process.cwd());
@@ -270,9 +270,6 @@ export async function updatePackageJsonFile(packageJsonPath, dependencies, updat
270
270
  const depInfo = dependencies[update.package];
271
271
  if (!depInfo) continue;
272
272
  const locations = depInfo.locations || /* @__PURE__ */ new Set();
273
- if (isNonSemverSpecifier(depInfo.versionSpec)) {
274
- continue;
275
- }
276
273
  const shouldIgnore = Array.from(locations).some(
277
274
  (location) => fieldsToIgnore.includes(location)
278
275
  );
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.150",
126
+ "version": "1.7.152",
127
127
  "author": "reliverse",
128
128
  "bugs": {
129
129
  "email": "blefnk@gmail.com",