@reliverse/dler 1.7.23 → 1.7.25

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.
@@ -13,6 +13,7 @@ import { checkFileExtensions } from "../../libs/sdk/sdk-impl/rules/reliverse/fil
13
13
  import { analyzeDependencies } from "../../libs/sdk/sdk-impl/rules/reliverse/missing-deps/analyzer.js";
14
14
  import { checkMissingDependencies } from "../../libs/sdk/sdk-impl/rules/reliverse/missing-deps/deps-mod.js";
15
15
  import { formatOutput } from "../../libs/sdk/sdk-impl/rules/reliverse/missing-deps/formatter.js";
16
+ import { checkNoDynamicImports } from "../../libs/sdk/sdk-impl/rules/reliverse/no-dynamic-imports/no-dynamic-imports.js";
16
17
  import { checkNoIndexFiles } from "../../libs/sdk/sdk-impl/rules/reliverse/no-index-files/no-index-files.js";
17
18
  import { checkPackageJsonHealth } from "../../libs/sdk/sdk-impl/rules/reliverse/package-json-health/package-json-health.js";
18
19
  import { checkPathExtensions } from "../../libs/sdk/sdk-impl/rules/reliverse/path-extensions/path-extensions.js";
@@ -175,6 +176,10 @@ export default defineCommand({
175
176
  {
176
177
  label: "no index files",
177
178
  value: "no-index-files"
179
+ },
180
+ {
181
+ label: "no dynamic imports",
182
+ value: "no-dynamic-imports"
178
183
  }
179
184
  ]
180
185
  });
@@ -282,6 +287,12 @@ checking directory: ${directory}`);
282
287
  process.stdout.write("\r");
283
288
  displayCheckResults("no index files", directory, result);
284
289
  }
290
+ if (checks.includes("no-dynamic-imports")) {
291
+ process.stdout.write(" checking for dynamic imports...\n");
292
+ const result = await checkNoDynamicImports(directory);
293
+ process.stdout.write("\r");
294
+ displayCheckResults("no dynamic imports", directory, result);
295
+ }
285
296
  } catch (error) {
286
297
  relinka(
287
298
  "error",
@@ -1,5 +1,5 @@
1
1
  import { defineArgs, defineCommand } from "@reliverse/rempts";
2
- import { applyMagicSpells } from "../../libs/sdk/sdk-impl/magic/apply.js";
2
+ import { applyMagicSpells } from "../../libs/sdk/sdk-impl/magic/ms-apply.js";
3
3
  import { formatError } from "../../libs/sdk/sdk-impl/utils/utils-error-cwd.js";
4
4
  export default defineCommand({
5
5
  meta: {
@@ -4,7 +4,7 @@ import fs from "@reliverse/relifso";
4
4
  import { relinka } from "@reliverse/relinka";
5
5
  import { getConfigDler } from "../../libs/sdk/sdk-impl/config/load.js";
6
6
  import { processLibraryFlow } from "../../libs/sdk/sdk-impl/library-flow.js";
7
- import { applyMagicSpells } from "../../libs/sdk/sdk-impl/magic/apply.js";
7
+ import { applyMagicSpells } from "../../libs/sdk/sdk-impl/magic/ms-apply.js";
8
8
  import { processRegularFlow } from "../../libs/sdk/sdk-impl/regular-flow.js";
9
9
  import { finalizeBuildPub } from "../../libs/sdk/sdk-impl/utils/finalize.js";
10
10
  import { resolveAllCrossLibs } from "../../libs/sdk/sdk-impl/utils/resolve-cross-libs.js";
File without changes
File without changes
@@ -11,10 +11,10 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
11
11
  projectGitService?: "none" | "github" | "gitlab" | "bitbucket" | undefined;
12
12
  projectDeployService?: "none" | "vercel" | "netlify" | "railway" | "deno" | undefined;
13
13
  projectPackageManager?: "npm" | "bun" | "pnpm" | "yarn" | undefined;
14
- projectState?: "creating" | "created" | undefined;
15
- projectCategory?: "browser" | "cli" | "unknown" | "website" | "vscode" | "library" | "mobile" | undefined;
14
+ projectState?: "created" | "creating" | undefined;
15
+ projectCategory?: "cli" | "unknown" | "browser" | "website" | "vscode" | "library" | "mobile" | undefined;
16
16
  projectSubcategory?: "unknown" | "e-commerce" | "tool" | undefined;
17
- projectFramework?: "npm-jsr" | "unknown" | "vscode" | "nextjs" | "vite" | "svelte" | "remix" | "astro" | "nuxt" | "solid" | "qwik" | "vue" | "wxt" | "lynx" | "react-native" | "expo" | "capacitor" | "ionic" | "electron" | "tauri" | "neutralino" | "rempts" | "citty" | "commander" | "cac" | "meow" | "yargs" | "webextension" | "browser-extension" | undefined;
17
+ projectFramework?: "rempts" | "npm-jsr" | "unknown" | "vscode" | "nextjs" | "vite" | "svelte" | "remix" | "astro" | "nuxt" | "solid" | "qwik" | "vue" | "wxt" | "lynx" | "react-native" | "expo" | "capacitor" | "ionic" | "electron" | "tauri" | "neutralino" | "citty" | "commander" | "cac" | "meow" | "yargs" | "webextension" | "browser-extension" | undefined;
18
18
  projectTemplate?: "unknown" | "blefnk/relivator-nextjs-template" | "blefnk/relivator-docker-template" | "blefnk/next-react-ts-src-minimal" | "blefnk/all-in-one-nextjs-template" | "blefnk/create-t3-app" | "blefnk/create-next-app" | "blefnk/astro-starlight-template" | "blefnk/versator-nextjs-template" | "blefnk/relivator-lynxjs-template" | "blefnk/relivator-react-native-template" | "reliverse/template-browser-extension" | "microsoft/vscode-extension-samples" | "microsoft/vscode-extension-template" | "rsetarter-template" | "blefnk/deno-cli-tutorial" | undefined;
19
19
  projectTemplateDate?: string | undefined;
20
20
  features?: {
@@ -38,7 +38,7 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
38
38
  analytics?: "unknown" | "vercel" | undefined;
39
39
  authentication?: "unknown" | "better-auth" | "clerk" | "next-auth" | "supabase-auth" | "auth0" | undefined;
40
40
  api?: "unknown" | "hono" | "trpc" | "graphql" | "rest" | undefined;
41
- testing?: "bun" | "unknown" | "vitest" | "jest" | "playwright" | "cypress" | undefined;
41
+ testing?: "unknown" | "bun" | "vitest" | "jest" | "playwright" | "cypress" | undefined;
42
42
  stateManagement?: "unknown" | "zustand" | "jotai" | "redux-toolkit" | undefined;
43
43
  formManagement?: "unknown" | "react-hook-form" | "formik" | undefined;
44
44
  styling?: "unknown" | "tailwind" | "styled-components" | "css-modules" | "sass" | undefined;
@@ -1,63 +1,112 @@
1
- /**
2
- * inject-impl-mod.ts
3
- * -----------
4
- * Utility for injecting content into files at specific line/column positions.
5
- *
6
- * Fully async -– works with Node, Bun, and other
7
- * runtimes that support the `fs/promises` API.
8
- *
9
- * @author blefnk
10
- */
11
- export interface InjectionConfig {
12
- /** Absolute or relative path to target file. */
13
- filePath: string;
14
- /** 1-based line number (1 == first visible line in editors) */
1
+ export interface InjectionLocation {
15
2
  line: number;
16
- /** 1-based column number (1 == first visible column in editors) */
17
3
  column?: number;
18
- /** String or array of strings to inject. */
4
+ }
5
+ export interface SingleInjection {
6
+ filePath: string;
7
+ location?: InjectionLocation;
19
8
  content: string | string[];
20
- /** If `true`, inserts string (or first element of array) content on a new line AFTER the target line. */
21
- createNewLine?: boolean;
22
- /** Configuration for comment wrapping. */
23
- commentsMode?: {
24
- /** Whether to wrap content in comments. */
25
- activate: boolean;
26
- /** Whether to use JSDoc style for multiline comments. */
27
- useJsdocForMultiline?: boolean;
28
- };
9
+ injectBefore?: string | string[];
10
+ injectAfter?: string | string[];
29
11
  }
30
12
  export interface InjectionResult {
31
- /** Absolute or relative path to target file. */
32
- filePath: string;
33
- /** Whether the injection was successful. */
34
13
  success: boolean;
35
- /** Error message if injection failed. */
14
+ filePath: string;
15
+ location?: InjectionLocation;
16
+ injectBefore?: string | string[];
17
+ injectAfter?: string | string[];
36
18
  error?: string;
37
- /** Generated source map if available. */
38
- sourcemap?: string;
19
+ code?: string;
20
+ hasChanged?: boolean;
21
+ /**
22
+ * TODO: format results as {"path/to/file1": {}, "path/to/file2": {}} instead of [{filePath: "path/to/file1", ...}, {filePath: "path/to/file2", ...}]
23
+ *
24
+ * TODO: matchesFound will be more useful in this case (because currently we always have 1 matchFound for each injection)
25
+ */
26
+ matchesFound?: number;
27
+ }
28
+ export interface InjectionOptions {
29
+ generateSourceMap?: boolean;
30
+ sourceMapPath?: string;
31
+ preserveOriginal?: boolean;
32
+ writeToFile?: boolean;
33
+ revert?: boolean;
34
+ based?: "0-based" | "1-based";
35
+ logCode?: boolean;
36
+ strict?: boolean;
37
+ arrayBeforeAfter?: "array-means-multiline" | "append-to-each-element";
39
38
  }
40
39
  /**
41
- * Injects content into the given file at the requested location.
42
- *
43
- * @param filePath Absolute or relative path to target file.
44
- * @param line 1-based line number (1 == first visible line in editors, internally == 0).
45
- * @param column 1-based column number (optional, 1 == first visible column in editors, internally == 0).
46
- * @param content String or array of strings to inject.
47
- * @param createNewLine If `true`, inserts string (or first element of array) content on a new line AFTER the target line.
48
- * @param commentsMode If `true`, wraps injected content in file-type comments.
49
- * @param generateSourceMap If `true`, generates a source map for the transformation.
50
- *
51
- * @returns `true` on success, `false` on failure (errors are logged).
40
+ * Injects or reverts content at a specific location in a single file
52
41
  */
53
- export declare function injectAtLocation(filePath: string, line: number, column: number | undefined, content: string | string[], createNewLine?: boolean, commentsMode?: {
54
- activate: boolean;
55
- }, generateSourceMap?: boolean): Promise<boolean>;
42
+ export declare const injectAtLocation: (injection: SingleInjection, options?: InjectionOptions) => Promise<InjectionResult>;
56
43
  /**
57
- * Processes multiple injections efficiently by grouping by file and applying in reverse order.
44
+ * Injects or reverts content at multiple locations across multiple files
45
+ * Processes injections efficiently by grouping by file
58
46
  *
59
- * @param configs Array of {@link InjectionConfig}.
60
- * @param generateSourceMaps If `true`, generates source maps for transformations.
61
- * @returns Array of {@link InjectionResult} in the same order as `configs`.
47
+ * Supports automatic line-offset handling:
48
+ * Whenever an earlier injection adds newline characters, subsequent
49
+ * location-based injections will transparently subtract the cumulative
50
+ * newline count so users can keep writing “line: N” without manual fixes.
51
+ */
52
+ export declare const injectMultiple: (injections: SingleInjection[], options?: InjectionOptions) => Promise<InjectionResult[]>;
53
+ /**
54
+ * Creates a single injection object with validation
55
+ */
56
+ export declare const createInjection: (filePath: string, content: string | string[], positioning: {
57
+ line: number;
58
+ column?: number;
59
+ } | {
60
+ injectBefore: string | string[];
61
+ } | {
62
+ injectAfter: string | string[];
63
+ }) => SingleInjection;
64
+ /**
65
+ * Validates a single injection configuration
66
+ */
67
+ export declare const validateInjection: (injection: SingleInjection, based?: "0-based" | "1-based") => string | null;
68
+ /**
69
+ * Batch validates multiple injections
70
+ */
71
+ export declare const validateMultipleInjections: (injections: SingleInjection[], based?: "0-based" | "1-based") => {
72
+ index: number;
73
+ error: string;
74
+ }[];
75
+ /**
76
+ * Preview injection without writing to file
77
+ */
78
+ export declare const previewInjection: (injection: SingleInjection, options?: Omit<InjectionOptions, "writeToFile">) => Promise<InjectionResult>;
79
+ /**
80
+ * Preview multiple injections without writing to files
81
+ */
82
+ export declare const previewMultipleInjections: (injections: SingleInjection[], options?: Omit<InjectionOptions, "writeToFile">) => Promise<InjectionResult[]>;
83
+ /**
84
+ * Preview revert operation without writing to file
85
+ */
86
+ export declare const previewRevert: (injection: SingleInjection, options?: Omit<InjectionOptions, "writeToFile" | "revert">) => Promise<InjectionResult>;
87
+ /**
88
+ * Preview multiple revert operations without writing to files
62
89
  */
63
- export declare function injectMultiple(configs: InjectionConfig[], generateSourceMaps?: boolean): Promise<InjectionResult[]>;
90
+ export declare const previewMultipleReverts: (injections: SingleInjection[], options?: Omit<InjectionOptions, "writeToFile" | "revert">) => Promise<InjectionResult[]>;
91
+ declare const _default: {
92
+ injectAtLocation: (injection: SingleInjection, options?: InjectionOptions) => Promise<InjectionResult>;
93
+ injectMultiple: (injections: SingleInjection[], options?: InjectionOptions) => Promise<InjectionResult[]>;
94
+ createInjection: (filePath: string, content: string | string[], positioning: {
95
+ line: number;
96
+ column?: number;
97
+ } | {
98
+ injectBefore: string | string[];
99
+ } | {
100
+ injectAfter: string | string[];
101
+ }) => SingleInjection;
102
+ validateInjection: (injection: SingleInjection, based?: "0-based" | "1-based") => string | null;
103
+ validateMultipleInjections: (injections: SingleInjection[], based?: "0-based" | "1-based") => {
104
+ index: number;
105
+ error: string;
106
+ }[];
107
+ previewInjection: (injection: SingleInjection, options?: Omit<InjectionOptions, "writeToFile">) => Promise<InjectionResult>;
108
+ previewMultipleInjections: (injections: SingleInjection[], options?: Omit<InjectionOptions, "writeToFile">) => Promise<InjectionResult[]>;
109
+ previewRevert: (injection: SingleInjection, options?: Omit<InjectionOptions, "writeToFile" | "revert">) => Promise<InjectionResult>;
110
+ previewMultipleReverts: (injections: SingleInjection[], options?: Omit<InjectionOptions, "writeToFile" | "revert">) => Promise<InjectionResult[]>;
111
+ };
112
+ export default _default;