looble 0.0.0-stage → 1.0.0

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 (4) hide show
  1. package/LICENSE +11 -0
  2. package/README.md +51 -2
  3. package/bin/looble.js +235 -0
  4. package/package.json +27 -4
package/LICENSE ADDED
@@ -0,0 +1,11 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Looble contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
package/README.md CHANGED
@@ -1,3 +1,52 @@
1
- # Temporary Holding Version
1
+ # Looble Ultra v1.0.0
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A Windows-first JavaScript project CLI with npm ecosystem compatibility.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install looble
9
+ ```
10
+
11
+ For a global CLI:
12
+
13
+ ```bash
14
+ npm install -g looble
15
+ ```
16
+
17
+ ## Commands
18
+
19
+ ```bash
20
+ looble main.js
21
+ looble run dev
22
+ looble run build
23
+ looble start
24
+ looble install
25
+ looble install express
26
+ looble add typescript
27
+ looble remove express
28
+ looble update
29
+ looble outdated
30
+ looble list
31
+ looble create react my-app
32
+ looble create vue my-app
33
+ looble create vite my-app
34
+ looble create node my-app
35
+ looble cache
36
+ looble benchmark
37
+ looble doctor
38
+ ```
39
+
40
+ ## Compatibility
41
+
42
+ Looble delegates package resolution and installation to npm.
43
+ It supports packages available from npm registries, subject to each
44
+ package's platform, Node.js version, native dependencies and license.
45
+
46
+ Version 1.0 uses Node.js as its execution backend. It is not yet
47
+ an independent JavaScript engine.
48
+
49
+ ## Performance
50
+
51
+ Use `looble benchmark` for a local JavaScript-loop microbenchmark.
52
+ Do not interpret it as application startup or package download speed.
package/bin/looble.js ADDED
@@ -0,0 +1,235 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const fs = require("node:fs");
5
+ const path = require("node:path");
6
+ const os = require("node:os");
7
+ const { spawnSync } = require("node:child_process");
8
+ const { performance } = require("node:perf_hooks");
9
+
10
+ const VERSION = "1.0.0";
11
+ const args = process.argv.slice(2);
12
+ const command = args.shift();
13
+
14
+ function info(s) {
15
+ console.log("\x1b[92m[LOOBLE]\x1b[0m " + s);
16
+ }
17
+ function fail(s) {
18
+ console.error("\x1b[91m[LOOBLE ERROR]\x1b[0m " + s);
19
+ process.exitCode = 1;
20
+ }
21
+ function npm(args) {
22
+ const executable = process.platform === "win32" ? "npm.cmd" : "npm";
23
+ const result = spawnSync(executable, args, {
24
+ stdio: "inherit",
25
+ shell: process.platform === "win32",
26
+ cwd: process.cwd()
27
+ });
28
+ if (result.error) {
29
+ fail(result.error.message);
30
+ return;
31
+ }
32
+ if (result.status !== 0) process.exitCode = result.status || 1;
33
+ }
34
+ function readPackage() {
35
+ const file = path.join(process.cwd(), "package.json");
36
+ if (!fs.existsSync(file)) return null;
37
+ try {
38
+ return JSON.parse(fs.readFileSync(file, "utf8"));
39
+ } catch {
40
+ return null;
41
+ }
42
+ }
43
+ function runScript(name, extra = []) {
44
+ const pkg = readPackage();
45
+ if (!pkg) return fail("Cannot find a valid package.json.");
46
+ if (!pkg.scripts || !pkg.scripts[name]) {
47
+ return fail(`Script "${name}" is not defined in package.json.`);
48
+ }
49
+ info(`Running ${name}...`);
50
+ npm(["run", name, ...(extra.length ? ["--", ...extra] : [])]);
51
+ }
52
+ function runFile(file, extra = []) {
53
+ const target = path.resolve(file);
54
+ if (!fs.existsSync(target)) return fail(`File not found: ${target}`);
55
+ info(`Executing ${target}`);
56
+ const result = spawnSync(process.execPath, [target, ...extra], {
57
+ stdio: "inherit",
58
+ cwd: process.cwd()
59
+ });
60
+ if (result.error) fail(result.error.message);
61
+ else if (result.status !== 0) process.exitCode = result.status || 1;
62
+ }
63
+ function start() {
64
+ const pkg = readPackage();
65
+ if (!pkg) return fail("No package.json found.");
66
+ if (pkg.scripts && pkg.scripts.start) return runScript("start");
67
+ const entry = pkg.main || "index.js";
68
+ return runFile(entry);
69
+ }
70
+ function help() {
71
+ console.log(`
72
+ LOOBLE ULTRA v${VERSION}
73
+
74
+ Usage:
75
+ looble <file.js> Execute JavaScript
76
+ looble run Run dev script, or main entry
77
+ looble run dev Start development server
78
+ looble run build Build production
79
+ looble start Start production application
80
+
81
+ Packages:
82
+ looble install Install all dependencies
83
+ looble install <package> Install npm package
84
+ looble add <package> Add dependency
85
+ looble remove <package> Remove dependency
86
+ looble update Update dependencies
87
+ looble outdated Check outdated packages
88
+ looble list List installed packages
89
+
90
+ Projects:
91
+ looble create react <name> Create React/Vite project
92
+ looble create vue <name> Create Vue/Vite project
93
+ looble create vite <name> Create Vite project
94
+ looble create node <name> Create Node project
95
+
96
+ Tools:
97
+ looble cache Show npm cache
98
+ looble cache clean Clear npm cache
99
+ looble benchmark Benchmark CLI internal overhead
100
+ looble doctor Check environment
101
+ looble --version Show version
102
+ `);
103
+ }
104
+ function createProject(type, name) {
105
+ if (!name) return fail("Please provide a project name.");
106
+ if (type === "react" || type === "vue" || type === "vite") {
107
+ const template = type === "react" ? "react" :
108
+ type === "vue" ? "vue" : "vanilla";
109
+ return npm([
110
+ "create", "vite@latest", name, "--",
111
+ "--template", template
112
+ ]);
113
+ }
114
+ if (type === "node") {
115
+ fs.mkdirSync(name, { recursive: true });
116
+ const pkg = {
117
+ name,
118
+ version: "1.0.0",
119
+ type: "commonjs",
120
+ main: "index.js",
121
+ scripts: { start: "node index.js" }
122
+ };
123
+ fs.writeFileSync(path.join(name, "package.json"),
124
+ JSON.stringify(pkg, null, 2));
125
+ fs.writeFileSync(path.join(name, "index.js"),
126
+ 'console.log("Hello from Looble!");\n');
127
+ return info(`Created ${name}`);
128
+ }
129
+ return fail("Supported templates: react, vue, vite, node.");
130
+ }
131
+
132
+ switch (command) {
133
+ case "--version":
134
+ case "-v":
135
+ case "version":
136
+ console.log("Looble v" + VERSION);
137
+ break;
138
+
139
+ case "--help":
140
+ case "-h":
141
+ case "help":
142
+ help();
143
+ break;
144
+
145
+ case "run": {
146
+ const task = args.shift();
147
+ if (!task) {
148
+ const pkg = readPackage();
149
+ if (pkg?.scripts?.dev) runScript("dev", args);
150
+ else if (pkg?.scripts?.start) runScript("start", args);
151
+ else if (pkg?.main) runFile(pkg.main, args);
152
+ else fail("No dev, start, or main entry found.");
153
+ } else {
154
+ runScript(task, args);
155
+ }
156
+ break;
157
+ }
158
+
159
+ case "start":
160
+ start();
161
+ break;
162
+
163
+ case "install":
164
+ case "i":
165
+ npm(["install", ...args]);
166
+ break;
167
+
168
+ case "add":
169
+ if (!args.length) fail("Usage: looble add <package>");
170
+ else npm(["install", ...args]);
171
+ break;
172
+
173
+ case "remove":
174
+ case "uninstall":
175
+ if (!args.length) fail("Usage: looble remove <package>");
176
+ else npm(["uninstall", ...args]);
177
+ break;
178
+
179
+ case "update":
180
+ npm(["update", ...args]);
181
+ break;
182
+
183
+ case "outdated":
184
+ npm(["outdated", ...args]);
185
+ break;
186
+
187
+ case "list":
188
+ case "ls":
189
+ npm(["ls", ...args]);
190
+ break;
191
+
192
+ case "create":
193
+ createProject(args.shift(), args.shift());
194
+ break;
195
+
196
+ case "cache":
197
+ if (args[0] === "clean") npm(["cache", "clean", "--force"]);
198
+ else npm(["cache", "verify"]);
199
+ break;
200
+
201
+ case "benchmark": {
202
+ const count = 1000000;
203
+ const startTime = performance.now();
204
+ let x = 0;
205
+ for (let i = 0; i < count; i++) x += i;
206
+ const elapsed = performance.now() - startTime;
207
+ console.log("Iterations:", count);
208
+ console.log("Elapsed:", elapsed.toFixed(4), "ms");
209
+ console.log("Checksum:", x);
210
+ console.log("Note: this measures a JS loop, not runtime startup.");
211
+ break;
212
+ }
213
+
214
+ case "doctor": {
215
+ console.log("Looble:", VERSION);
216
+ console.log("Node:", process.version);
217
+ console.log("Platform:", process.platform);
218
+ console.log("Architecture:", process.arch);
219
+ console.log("CPUs:", os.cpus().length);
220
+ console.log("Memory:", (os.totalmem() / 1024 ** 3).toFixed(2), "GB");
221
+ const pkg = readPackage();
222
+ console.log("Project:", pkg ? pkg.name : "No package.json");
223
+ console.log("npm ecosystem: available");
224
+ break;
225
+ }
226
+
227
+ default:
228
+ if (command && /\.(mjs|cjs|js)$/i.test(command)) {
229
+ runFile(command, args);
230
+ } else if (command) {
231
+ fail(`Unknown command: ${command}. Use looble --help.`);
232
+ } else {
233
+ help();
234
+ }
235
+ }
package/package.json CHANGED
@@ -1,6 +1,29 @@
1
1
  {
2
2
  "name": "looble",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "Looble JavaScript runtime launcher and npm-compatible project toolchain",
5
+ "main": "bin/looble.js",
6
+ "type": "commonjs",
7
+ "bin": {
8
+ "looble": "bin/looble.js"
9
+ },
10
+ "files": [
11
+ "bin/",
12
+ "README.md",
13
+ "LICENSE"
14
+ ],
15
+ "keywords": [
16
+ "looble",
17
+ "javascript",
18
+ "runtime",
19
+ "npm",
20
+ "react",
21
+ "vue",
22
+ "vite",
23
+ "package-manager"
24
+ ],
25
+ "engines": {
26
+ "node": ">=20"
27
+ },
28
+ "license": "MIT"
29
+ }