golar 0.1.5 → 0.1.6
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/codegen-plugin.js +0 -1
- package/dist/config.js +32 -15
- package/dist/packages/golar/package.js +3 -2
- package/package.json +10 -9
package/dist/codegen-plugin.js
CHANGED
|
@@ -20,7 +20,6 @@ const stateSymbol = Symbol.for("golar-global-state");
|
|
|
20
20
|
const globalTyped = globalThis;
|
|
21
21
|
const globalState = globalTyped[stateSymbol] ??= { codegenPlugins: /* @__PURE__ */ new Map() };
|
|
22
22
|
function registerCodegenPlugin(plugin) {
|
|
23
|
-
if (globalState.codegenPlugins.get(plugin.id)) throw new Error(`Duplicate ${plugin.id} codegen plugin`);
|
|
24
23
|
globalState.codegenPlugins.set(plugin.id, plugin);
|
|
25
24
|
}
|
|
26
25
|
var JsCodegenPlugin = class JsCodegenPlugin {
|
package/dist/config.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { globalState } from "./codegen-plugin.js";
|
|
2
|
-
import
|
|
2
|
+
import { execSync } from "node:child_process";
|
|
3
3
|
import url from "node:url";
|
|
4
|
-
import fs from "node:fs";
|
|
5
4
|
import util from "node:util";
|
|
5
|
+
import { escapePath, globSync } from "tinyglobby";
|
|
6
6
|
import { Debug } from "@golar/util";
|
|
7
7
|
|
|
8
8
|
//#region src/config.ts
|
|
@@ -19,10 +19,10 @@ function resolveConfig(cwd, config) {
|
|
|
19
19
|
const builtinEffectiveRulesByFile = /* @__PURE__ */ new Map();
|
|
20
20
|
const jsEffectiveRulesByFile = /* @__PURE__ */ new Map();
|
|
21
21
|
const nativeEffectiveRulesByFile = /* @__PURE__ */ new Map();
|
|
22
|
-
for (const group of config.lint?.use ?? []) for (const file of
|
|
22
|
+
for (const group of config.lint?.use ?? []) for (const file of globSync(group.files, {
|
|
23
23
|
cwd,
|
|
24
|
-
|
|
25
|
-
})
|
|
24
|
+
absolute: true
|
|
25
|
+
})) {
|
|
26
26
|
allFiles.add(file);
|
|
27
27
|
for (const rule of group.rules) {
|
|
28
28
|
let rulesByFile;
|
|
@@ -44,17 +44,19 @@ function resolveConfig(cwd, config) {
|
|
|
44
44
|
const nativeRulesByFile = new Map(nativeEffectiveRulesByFile.entries().map(([file, rulesById]) => [file, Array.from(rulesById.values())]));
|
|
45
45
|
let typecheckFiles = null;
|
|
46
46
|
const typecheckInclude = config.typecheck == null ? ["**/*.{ts,tsx}", ...globalState.codegenPlugins.values().flatMap((plugin) => plugin.extensions).map(({ extension }) => `**/*${extension}`).toArray()] : config.typecheck.include;
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"**/.git",
|
|
51
|
-
"**/.jj"
|
|
52
|
-
];
|
|
53
|
-
typecheckFiles = fs.globSync(typecheckInclude, {
|
|
47
|
+
const gitignorePaths = lsGitignorePaths(cwd);
|
|
48
|
+
debug.print(".gitignore paths:", gitignorePaths.join(", ") || "(none)");
|
|
49
|
+
typecheckFiles = globSync(typecheckInclude, {
|
|
54
50
|
cwd,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
ignore: [
|
|
52
|
+
...gitignorePaths,
|
|
53
|
+
...config.typecheck?.exclude ?? [],
|
|
54
|
+
"**/node_modules",
|
|
55
|
+
"**/.git",
|
|
56
|
+
"**/.jj"
|
|
57
|
+
],
|
|
58
|
+
absolute: true
|
|
59
|
+
});
|
|
58
60
|
for (const file of typecheckFiles) allFiles.add(file);
|
|
59
61
|
debug.print("typecheck files:\n" + typecheckFiles.join("\n"));
|
|
60
62
|
return {
|
|
@@ -66,6 +68,21 @@ function resolveConfig(cwd, config) {
|
|
|
66
68
|
typecheckFiles
|
|
67
69
|
};
|
|
68
70
|
}
|
|
71
|
+
function lsGitignorePaths(cwd) {
|
|
72
|
+
try {
|
|
73
|
+
return execSync("git ls-files --others --ignored --exclude-standard --directory", {
|
|
74
|
+
cwd,
|
|
75
|
+
encoding: "utf-8",
|
|
76
|
+
stdio: [
|
|
77
|
+
"ignore",
|
|
78
|
+
"pipe",
|
|
79
|
+
"ignore"
|
|
80
|
+
]
|
|
81
|
+
}).split("\n").filter(Boolean).map((p) => escapePath(p));
|
|
82
|
+
} catch {
|
|
83
|
+
return [];
|
|
84
|
+
}
|
|
85
|
+
}
|
|
69
86
|
|
|
70
87
|
//#endregion
|
|
71
88
|
export { defineConfig, loadConfig, resolveConfig };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "golar",
|
|
4
|
-
version: "0.1.
|
|
4
|
+
version: "0.1.6",
|
|
5
5
|
type: "module",
|
|
6
6
|
engines: { "node": ">=22.12.0" },
|
|
7
7
|
bin: "./src/bin.ts",
|
|
@@ -30,7 +30,8 @@ var package_default = {
|
|
|
30
30
|
},
|
|
31
31
|
dependencies: {
|
|
32
32
|
"@golar/util": "workspace:*",
|
|
33
|
-
"detect-libc": "^2.1.2"
|
|
33
|
+
"detect-libc": "^2.1.2",
|
|
34
|
+
"tinyglobby": "^0.2.15"
|
|
34
35
|
},
|
|
35
36
|
optionalDependencies: {
|
|
36
37
|
"@golar/darwin-arm64": "workspace:*",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "golar",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22.12.0"
|
|
@@ -30,15 +30,16 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"detect-libc": "^2.1.2",
|
|
33
|
-
"
|
|
33
|
+
"tinyglobby": "^0.2.15",
|
|
34
|
+
"@golar/util": "0.1.6"
|
|
34
35
|
},
|
|
35
36
|
"optionalDependencies": {
|
|
36
|
-
"@golar/darwin-x64": "0.1.
|
|
37
|
-
"@golar/linux-arm64": "0.1.
|
|
38
|
-
"@golar/
|
|
39
|
-
"@golar/
|
|
40
|
-
"@golar/linux-arm64-musl": "0.1.
|
|
41
|
-
"@golar/linux-x64-musl": "0.1.
|
|
42
|
-
"@golar/win32-x64": "0.1.
|
|
37
|
+
"@golar/darwin-x64": "0.1.6",
|
|
38
|
+
"@golar/linux-arm64": "0.1.6",
|
|
39
|
+
"@golar/linux-x64": "0.1.6",
|
|
40
|
+
"@golar/darwin-arm64": "0.1.6",
|
|
41
|
+
"@golar/linux-arm64-musl": "0.1.6",
|
|
42
|
+
"@golar/linux-x64-musl": "0.1.6",
|
|
43
|
+
"@golar/win32-x64": "0.1.6"
|
|
43
44
|
}
|
|
44
45
|
}
|