@gracefullight/validate-branch 1.1.1 → 1.1.2

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.
Files changed (3) hide show
  1. package/dist/cli.js +13 -7
  2. package/dist/index.js +13 -7
  3. package/package.json +10 -10
package/dist/cli.js CHANGED
@@ -8,6 +8,7 @@ import { Command, Option } from "commander";
8
8
  import { readFile } from "fs/promises";
9
9
  import { resolve } from "path";
10
10
  import { cwd } from "process";
11
+ import { pathToFileURL } from "url";
11
12
  var CONFIG_FILES = [
12
13
  "branch.config.ts",
13
14
  "branch.config.mts",
@@ -20,16 +21,21 @@ async function loadConfig() {
20
21
  const configPath = resolve(cwd(), file);
21
22
  try {
22
23
  await readFile(configPath, "utf-8");
23
- if (file.endsWith(".ts") || file.endsWith(".mts")) {
24
- const { default: config } = await import(`file://${configPath}?ts=${Date.now()}`);
25
- return config;
26
- }
27
- if (file.endsWith(".mjs")) {
28
- const { default: config } = await import(`file://${configPath}?ts=${Date.now()}`);
24
+ if (file.endsWith(".ts") || file.endsWith(".mts") || file.endsWith(".mjs")) {
25
+ const fileUrl = pathToFileURL(configPath);
26
+ fileUrl.searchParams.set("ts", Date.now().toString());
27
+ const { default: config } = await import(
28
+ /* @vite-ignore */
29
+ fileUrl.href
30
+ );
29
31
  return config;
30
32
  }
31
33
  if (file.endsWith(".js") || file.endsWith(".cjs")) {
32
- const { default: config } = await import(configPath);
34
+ const fileUrl = pathToFileURL(configPath);
35
+ const { default: config } = await import(
36
+ /* @vite-ignore */
37
+ fileUrl.href
38
+ );
33
39
  return config;
34
40
  }
35
41
  } catch (error) {
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import { readFile } from "fs/promises";
3
3
  import { resolve } from "path";
4
4
  import { cwd } from "process";
5
+ import { pathToFileURL } from "url";
5
6
  var CONFIG_FILES = [
6
7
  "branch.config.ts",
7
8
  "branch.config.mts",
@@ -14,16 +15,21 @@ async function loadConfig() {
14
15
  const configPath = resolve(cwd(), file);
15
16
  try {
16
17
  await readFile(configPath, "utf-8");
17
- if (file.endsWith(".ts") || file.endsWith(".mts")) {
18
- const { default: config } = await import(`file://${configPath}?ts=${Date.now()}`);
19
- return config;
20
- }
21
- if (file.endsWith(".mjs")) {
22
- const { default: config } = await import(`file://${configPath}?ts=${Date.now()}`);
18
+ if (file.endsWith(".ts") || file.endsWith(".mts") || file.endsWith(".mjs")) {
19
+ const fileUrl = pathToFileURL(configPath);
20
+ fileUrl.searchParams.set("ts", Date.now().toString());
21
+ const { default: config } = await import(
22
+ /* @vite-ignore */
23
+ fileUrl.href
24
+ );
23
25
  return config;
24
26
  }
25
27
  if (file.endsWith(".js") || file.endsWith(".cjs")) {
26
- const { default: config } = await import(configPath);
28
+ const fileUrl = pathToFileURL(configPath);
29
+ const { default: config } = await import(
30
+ /* @vite-ignore */
31
+ fileUrl.href
32
+ );
27
33
  return config;
28
34
  }
29
35
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gracefullight/validate-branch",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Git branch name validation tool with custom regexp support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -19,14 +19,6 @@
19
19
  "files": [
20
20
  "dist"
21
21
  ],
22
- "scripts": {
23
- "build": "tsup",
24
- "dev": "tsx src/cli.ts",
25
- "test": "vitest",
26
- "lint": "biome check src",
27
- "lint:fix": "biome check --write src",
28
- "format": "biome format --write src"
29
- },
30
22
  "keywords": [
31
23
  "git",
32
24
  "branch",
@@ -74,5 +66,13 @@
74
66
  "chalk": "^5.6.2",
75
67
  "commander": "^14.0.2",
76
68
  "isomorphic-git": "^1.36.1"
69
+ },
70
+ "scripts": {
71
+ "build": "tsup",
72
+ "dev": "tsx src/cli.ts",
73
+ "test": "vitest",
74
+ "lint": "biome check src",
75
+ "lint:fix": "biome check --write src",
76
+ "format": "biome format --write src"
77
77
  }
78
- }
78
+ }