@slim-lang/core 1.2.0 → 1.2.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.
- package/package.json +1 -1
- package/packages/slim/helpers/string.js +43 -0
- package/packages/slim/types/hash.js +11 -0
- package/run-dev-slim.js +7 -1
- package/run-slim.js +4 -2
- package/src/bin/cli.js +13 -4
- package/src/compile.js +4 -2
- package/src/modulePaths.js +28 -6
package/package.json
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import "./C:/Users/zeral/AppData/Local/Temp/claude/D--dev-slim-github/72243d74-23bd-4f88-a955-b7ed76b7e749/scratchpad/myapp/dist/external/core.js";
|
|
2
|
+
import * as crypto from "node:crypto";
|
|
3
|
+
import { SHA256, QuickHash } from "../types/hash.js";
|
|
4
|
+
let _slimType = {};
|
|
5
|
+
export const StringHelper = __typed_variable__({
|
|
6
|
+
len(str) {
|
|
7
|
+
let _slimType2 = {};
|
|
8
|
+
__typed_parameter__(str, __type_spec__(__type_ref__("string")), _slimType2, "str", false, `function "len": argument<0> "str" expected string, got ${type(str)}`);
|
|
9
|
+
if (type(str) == "string") return __typed_return__(str.length, __type_spec__(__type_ref__("int")), "len");
|
|
10
|
+
},
|
|
11
|
+
truncate(str, maxLength) {
|
|
12
|
+
let _slimType3 = {},
|
|
13
|
+
_slimType4 = {};
|
|
14
|
+
__typed_parameter__(str, __type_spec__(__type_ref__("string")), _slimType3, "str", false, `function "truncate": argument<0> "str" expected string, got ${type(str)}`);
|
|
15
|
+
__typed_parameter__(maxLength, __type_spec__(__type_ref__("int")), _slimType4, "maxLength", false, `function "truncate": argument<1> "maxLength" expected int, got ${type(maxLength)}`);
|
|
16
|
+
if (str.length > maxLength) {
|
|
17
|
+
return __typed_return__(str.slice(0, maxLength) + '...', __type_spec__(__type_ref__("string")), "truncate");
|
|
18
|
+
}
|
|
19
|
+
return __typed_return__(str, __type_spec__(__type_ref__("string")), "truncate");
|
|
20
|
+
},
|
|
21
|
+
hash(str) {
|
|
22
|
+
let _slimType5 = {};
|
|
23
|
+
__typed_parameter__(str, __type_spec__(__type_ref__("string")), _slimType5, "str", false, `function "hash": argument<0> "str" expected string, got ${type(str)}`);
|
|
24
|
+
return __typed_return__(crypto.createHash("sha256").update(str).digest("hex"), __type_spec__(__type_ref__("SHA256", () => SHA256)), "hash");
|
|
25
|
+
},
|
|
26
|
+
quickHash(str) {
|
|
27
|
+
let _slimType6 = {};
|
|
28
|
+
__typed_parameter__(str, __type_spec__(__type_ref__("string")), _slimType6, "str", false, `function "quickHash": argument<0> "str" expected string, got ${type(str)}`);
|
|
29
|
+
let hash = 0;
|
|
30
|
+
for (let i = 0; i < str.length; i++) {
|
|
31
|
+
hash = (hash << 5) - hash + str.charCodeAt(i);
|
|
32
|
+
hash |= 0;
|
|
33
|
+
}
|
|
34
|
+
return __typed_return__(hash, __type_spec__(__type_ref__("QuickHash", () => QuickHash)), "quickHash");
|
|
35
|
+
}
|
|
36
|
+
}, __type_spec__(__type_ref__("object")), _slimType, "StringHelper");
|
|
37
|
+
export { StringHelper as default };
|
|
38
|
+
try {
|
|
39
|
+
__lock_object__(StringHelper);
|
|
40
|
+
} catch (__err__) {
|
|
41
|
+
__handle_sync_error__(__err__);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJtYXBwaW5ncyI6Ijs7OztBQUdBLGFBQUFBLFlBQUEsR0FBQUMsa0JBQUEsQ0FBNEM7RUFDNUNDLElBQUFDLEdBQUE7SUFBQSxJQUFBQyxVQUFBO0lBQUFDLG1CQUFBLENBQUFGLEdBQUEsRUFBQUcsYUFBQSxDQUFBQyxZQUFBLGFBQUFILFVBQUEsMEVBQUFJLElBQUEsQ0FBQUwsR0FBQTtJQUNBLElBQUFLLElBQUEsQ0FBQUwsR0FBQSxDQUFxQixxQkFBQU0sZ0JBQUEsQ0FBQU4sR0FBQSxDQUFBTyxNQUFBLEVBQUFKLGFBQU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TtcclxuICAgICAgICAgICAgaGFzaCB8PSAwO1xyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4gaGFzaDtcclxuICAgIH1cclxufVxyXG5cclxubG9jayBTdHJpbmdIZWxwZXI7Il19
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "./C:/Users/zeral/AppData/Local/Temp/claude/D--dev-slim-github/72243d74-23bd-4f88-a955-b7ed76b7e749/scratchpad/myapp/dist/external/core.js";
|
|
2
|
+
export const SHA256 = __type_def__("SHA256", v => {
|
|
3
|
+
return __sizeof__(v) == 64;
|
|
4
|
+
}, {});
|
|
5
|
+
export const QuickHash = __type_def__("QuickHash", v => {
|
|
6
|
+
return __sizeof__(v) == 8;
|
|
7
|
+
}, {});
|
|
8
|
+
try {} catch (__err__) {
|
|
9
|
+
__handle_sync_error__(__err__);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJtYXBwaW5ncyI6IjtBQUFBLGFBQUFBLE1BQUEsR0FBQUMsWUFBQSxXQUFBQyxDQUFBO0VBQUEsT0FBQUMsVUFBQSxDQUFBRCxDQUFBO0FBQUEsTUFFQztBQUNELGFBQUFFLFNBQUEsR0FBQUgsWUFBQSxjQUFBQyxDQUFBO0VBQUEsT0FBQUMsVUFBQSxDQUFBRCxDQUFBO0FBQUE7QUFBQSxjQUFBRyxPQUFBO0VBQUFDLHFCQUFBLENBQUFELE9BQUE7QUFBQSIsIm5hbWVzIjpbIlNIQTI1NiIsIl9fdHlwZV9kZWZfXyIsInYiLCJfX3NpemVvZl9fIiwiUXVpY2tIYXNoIiwiX19lcnJfXyIsIl9faGFuZGxlX3N5bmNfZXJyb3JfXyJdLCJpZ25vcmVMaXN0IjpbXSwic291cmNlcyI6WyJEOlxcZGV2XFxzbGltLWdpdGh1YlxccGFja2FnZXNcXHNsaW1cXHR5cGVzXFxoYXNoLnNsaW0iXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHR5cGUgU0hBMjU2KHYpIHtcclxuICAgIHJldHVybiBzaXplb2YgdiA9PSA2NFxyXG59XHJcbmV4cG9ydCB0eXBlIFF1aWNrSGFzaCh2KSB7XHJcbiAgICByZXR1cm4gc2l6ZW9mIHYgPT0gOFxyXG59Il19
|
package/run-dev-slim.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
2
4
|
import chokidar from "chokidar";
|
|
3
5
|
import { spawn } from "child_process";
|
|
4
6
|
|
|
7
|
+
// This script ships in the package; the compiler sits next to it there.
|
|
8
|
+
const packageRoot = path.dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
const compileScript = path.join(packageRoot, "src", "compile.js");
|
|
10
|
+
|
|
5
11
|
const config = JSON.parse(
|
|
6
12
|
fs.readFileSync("slimconfig.json", "utf8")
|
|
7
13
|
);
|
|
@@ -68,7 +74,7 @@ function stop() {
|
|
|
68
74
|
|
|
69
75
|
function compile() {
|
|
70
76
|
return new Promise(resolve => {
|
|
71
|
-
const compiler = spawn("node", [
|
|
77
|
+
const compiler = spawn("node", [compileScript], {
|
|
72
78
|
stdio: "inherit"
|
|
73
79
|
});
|
|
74
80
|
|
package/run-slim.js
CHANGED
|
@@ -7,10 +7,12 @@ import { fileURLToPath } from 'url';
|
|
|
7
7
|
const __filename = fileURLToPath(import.meta.url);
|
|
8
8
|
const __dirname = path.dirname(__filename);
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const root = process.cwd();
|
|
11
|
+
|
|
12
|
+
const config = JSON.parse(readFileSync(path.join(root, 'slimconfig.json'), 'utf8'));
|
|
11
13
|
const mainFile = config.main;
|
|
12
14
|
|
|
13
|
-
const dist = path.join(
|
|
15
|
+
const dist = path.join(root, 'dist', `${mainFile}.js`);
|
|
14
16
|
const args = ['--enable-source-maps', '--no-warnings', dist];
|
|
15
17
|
|
|
16
18
|
const proc = spawn('node', args, { stdio: 'inherit' });
|
package/src/bin/cli.js
CHANGED
|
@@ -5,6 +5,7 @@ import { execSync } from "child_process";
|
|
|
5
5
|
import { readFile } from 'node:fs/promises';
|
|
6
6
|
import path from "node:path"
|
|
7
7
|
import fs from "node:fs"
|
|
8
|
+
import { fileURLToPath } from "node:url"
|
|
8
9
|
|
|
9
10
|
import { log, error, parseValue } from "./helpers.js"
|
|
10
11
|
import { runTests } from "../test-runner.js"
|
|
@@ -14,6 +15,14 @@ import pkg from "../../package.json" with { type: "json" };
|
|
|
14
15
|
import defaultConfig from "./config.default.json" with { type: "json" };
|
|
15
16
|
|
|
16
17
|
const root = process.cwd()
|
|
18
|
+
// Toolchain scripts (compiler, runners) live inside the package, which is only
|
|
19
|
+
// the same as the project root during local development. Resolve them from this
|
|
20
|
+
// file's location so the commands work when installed from npm too.
|
|
21
|
+
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..")
|
|
22
|
+
const compileScript = JSON.stringify(path.join(packageRoot, "src", "compile.js"))
|
|
23
|
+
const runScript = JSON.stringify(path.join(packageRoot, "run-slim.js"))
|
|
24
|
+
const devScript = JSON.stringify(path.join(packageRoot, "run-dev-slim.js"))
|
|
25
|
+
|
|
17
26
|
const program = new Command();
|
|
18
27
|
const slimConfigPath = path.join(root, "slimconfig.json")
|
|
19
28
|
const packagePath = path.join(root, "package.json")
|
|
@@ -72,7 +81,7 @@ program
|
|
|
72
81
|
if(!params.check) process.env.SLIM_NO_CHECK = "1"
|
|
73
82
|
|
|
74
83
|
if(!params.silent) log("Building...")
|
|
75
|
-
execSync(
|
|
84
|
+
execSync(`node ${compileScript}`, { stdio: "inherit" });
|
|
76
85
|
if(!params.silent) log("Ready!")
|
|
77
86
|
});
|
|
78
87
|
|
|
@@ -90,7 +99,7 @@ program
|
|
|
90
99
|
if(params.dev) process.env.SLIM_DEV = "1"
|
|
91
100
|
if(!params.check) process.env.SLIM_NO_CHECK = "1"
|
|
92
101
|
if(!params.silent) log(params.dev ? "Building and running (dev)..." : "Building and running...")
|
|
93
|
-
execSync(
|
|
102
|
+
execSync(`node ${compileScript} && node ${runScript}`, { stdio: "inherit" });
|
|
94
103
|
});
|
|
95
104
|
|
|
96
105
|
program
|
|
@@ -143,11 +152,11 @@ program
|
|
|
143
152
|
|
|
144
153
|
if(dev) {
|
|
145
154
|
log("Starting Slim dev server (watch + live reload)...")
|
|
146
|
-
execSync(`node
|
|
155
|
+
execSync(`node ${devScript}${params.hot ? " --hot" : ""}`, { stdio: "inherit" });
|
|
147
156
|
}
|
|
148
157
|
else {
|
|
149
158
|
log("Starting Slim server...")
|
|
150
|
-
execSync(
|
|
159
|
+
execSync(`node ${compileScript} && node ${runScript}`, { stdio: "inherit" });
|
|
151
160
|
}
|
|
152
161
|
});
|
|
153
162
|
|
package/src/compile.js
CHANGED
|
@@ -7,7 +7,7 @@ import { readFile } from 'fs/promises';
|
|
|
7
7
|
import { Debug } from "./external/core.js";
|
|
8
8
|
import { stripComments } from "./parser.js";
|
|
9
9
|
import { UseError } from "./external/classErrors.js";
|
|
10
|
-
import { getDistPath, resolveSlimSource } from "./modulePaths.js";
|
|
10
|
+
import { getDistPath, resolveSlimSource, PACKAGE_ROOT } from "./modulePaths.js";
|
|
11
11
|
|
|
12
12
|
const compiled = new Set()
|
|
13
13
|
|
|
@@ -18,7 +18,9 @@ let check = true
|
|
|
18
18
|
let useStyle = "import"
|
|
19
19
|
|
|
20
20
|
function syncExternal() {
|
|
21
|
-
|
|
21
|
+
// The runtime ships inside the package; the compiled output goes to the
|
|
22
|
+
// project's own dist/ (so this works both locally and when installed).
|
|
23
|
+
const srcExternal = path.join(PACKAGE_ROOT, "src/external")
|
|
22
24
|
const distExternal = path.resolve("dist/external")
|
|
23
25
|
|
|
24
26
|
if (!fs.existsSync(srcExternal)) return
|
package/src/modulePaths.js
CHANGED
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
import fs from "node:fs"
|
|
2
2
|
import path from "node:path"
|
|
3
3
|
import { isBuiltin } from "node:module"
|
|
4
|
+
import { fileURLToPath } from "node:url"
|
|
4
5
|
|
|
5
6
|
const slimExtension = ".slim"
|
|
6
7
|
|
|
8
|
+
// Root of the installed toolchain package (…/src/modulePaths.js -> package root).
|
|
9
|
+
// Locally this equals the project root; when installed it points into
|
|
10
|
+
// node_modules/@slim-lang/core, where the shipped stdlib (@slim/*) lives.
|
|
11
|
+
export const PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..")
|
|
12
|
+
|
|
13
|
+
// `@`-imports resolve against the project's own packages/ (spm installs) first,
|
|
14
|
+
// then the stdlib shipped inside the package. When run locally the two are the
|
|
15
|
+
// same directory.
|
|
16
|
+
function packageRoots() {
|
|
17
|
+
const projectPackages = path.resolve("packages")
|
|
18
|
+
const shippedPackages = path.join(PACKAGE_ROOT, "packages")
|
|
19
|
+
|
|
20
|
+
return projectPackages === shippedPackages
|
|
21
|
+
? [projectPackages]
|
|
22
|
+
: [projectPackages, shippedPackages]
|
|
23
|
+
}
|
|
24
|
+
|
|
7
25
|
function isWithin(parent, target) {
|
|
8
26
|
const relative = path.relative(parent, target)
|
|
9
27
|
return relative !== "" && !relative.startsWith("..") && !path.isAbsolute(relative)
|
|
@@ -36,18 +54,22 @@ export function resolveSlimSource(raw, fromFile) {
|
|
|
36
54
|
if (isBuiltin(raw)) return null
|
|
37
55
|
|
|
38
56
|
if (raw.startsWith("@")) {
|
|
39
|
-
const packagesRoot = path.resolve("packages")
|
|
40
57
|
const packageName = raw.slice("@".length)
|
|
41
|
-
const
|
|
58
|
+
const roots = packageRoots()
|
|
42
59
|
|
|
43
|
-
|
|
60
|
+
for (const packagesRoot of roots) {
|
|
61
|
+
const fileSource = path.join(packagesRoot, packageName + slimExtension)
|
|
62
|
+
if (fs.existsSync(fileSource)) return fileSource
|
|
44
63
|
|
|
45
|
-
|
|
46
|
-
|
|
64
|
+
const directorySource = path.join(packagesRoot, packageName, "main.slim")
|
|
65
|
+
if (fs.existsSync(directorySource)) return directorySource
|
|
66
|
+
}
|
|
47
67
|
|
|
48
68
|
if (isNodeModule(raw)) return null
|
|
49
69
|
|
|
50
|
-
return
|
|
70
|
+
// Not found in any root: return the project-local path so errors point
|
|
71
|
+
// at the user's own packages/ directory.
|
|
72
|
+
return path.join(roots[0], packageName + slimExtension)
|
|
51
73
|
}
|
|
52
74
|
|
|
53
75
|
if (raw.endsWith(".js")) return null
|