@codedir/mimir-code 0.1.2 → 0.1.4
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/cli.mjs +31 -23
- package/dist/cli.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -3906,6 +3906,19 @@ import { fileURLToPath } from "url";
|
|
|
3906
3906
|
import { readFileSync, existsSync } from "fs";
|
|
3907
3907
|
function locateWasmFile() {
|
|
3908
3908
|
const wasmFileName = "sql-wasm.wasm";
|
|
3909
|
+
const currentDir = dirname(fileURLToPath(import.meta.url));
|
|
3910
|
+
const nodeModulesPaths = [
|
|
3911
|
+
// Relative to the built module (dist/storage/Database.js)
|
|
3912
|
+
join(currentDir, "..", "..", "node_modules", "sql.js", "dist", wasmFileName),
|
|
3913
|
+
// Relative to current working directory (for local development)
|
|
3914
|
+
join(process.cwd(), "node_modules", "sql.js", "dist", wasmFileName)
|
|
3915
|
+
];
|
|
3916
|
+
for (const modulePath of nodeModulesPaths) {
|
|
3917
|
+
if (existsSync(modulePath)) {
|
|
3918
|
+
const buffer = readFileSync(modulePath);
|
|
3919
|
+
return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
|
|
3920
|
+
}
|
|
3921
|
+
}
|
|
3909
3922
|
const executablePath = process.argv[0] || process.execPath;
|
|
3910
3923
|
const binaryDir = dirname(executablePath);
|
|
3911
3924
|
const resourcesPaths = [
|
|
@@ -3922,23 +3935,13 @@ function locateWasmFile() {
|
|
|
3922
3935
|
return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
|
|
3923
3936
|
}
|
|
3924
3937
|
}
|
|
3925
|
-
const currentDir = dirname(fileURLToPath(import.meta.url));
|
|
3926
|
-
const nodeModulesPaths = [
|
|
3927
|
-
join(currentDir, "..", "..", "node_modules", "sql.js", "dist", wasmFileName),
|
|
3928
|
-
join(process.cwd(), "node_modules", "sql.js", "dist", wasmFileName)
|
|
3929
|
-
];
|
|
3930
|
-
for (const modulePath of nodeModulesPaths) {
|
|
3931
|
-
if (existsSync(modulePath)) {
|
|
3932
|
-
const buffer = readFileSync(modulePath);
|
|
3933
|
-
return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
|
|
3934
|
-
}
|
|
3935
|
-
}
|
|
3936
3938
|
const diagnostics = [
|
|
3939
|
+
`import.meta.url: ${import.meta.url}`,
|
|
3940
|
+
`currentDir: ${currentDir}`,
|
|
3937
3941
|
`process.argv[0]: ${process.argv[0]}`,
|
|
3938
3942
|
`process.execPath: ${process.execPath}`,
|
|
3939
3943
|
`executablePath: ${executablePath}`,
|
|
3940
3944
|
`binaryDir: ${binaryDir}`,
|
|
3941
|
-
`currentDir: ${currentDir}`,
|
|
3942
3945
|
`process.cwd(): ${process.cwd()}`
|
|
3943
3946
|
];
|
|
3944
3947
|
throw new Error(
|
|
@@ -3948,7 +3951,7 @@ Diagnostics:
|
|
|
3948
3951
|
${diagnostics.join("\n")}
|
|
3949
3952
|
|
|
3950
3953
|
Tried:
|
|
3951
|
-
` + [...
|
|
3954
|
+
` + [...nodeModulesPaths, ...resourcesPaths].map((p) => ` - ${p}`).join("\n")
|
|
3952
3955
|
);
|
|
3953
3956
|
}
|
|
3954
3957
|
var DatabaseManager = class _DatabaseManager {
|
|
@@ -4415,6 +4418,7 @@ function closeDatabaseManager() {
|
|
|
4415
4418
|
|
|
4416
4419
|
// src/core/MimirInitializer.ts
|
|
4417
4420
|
import path6, { dirname as dirname2 } from "path";
|
|
4421
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
4418
4422
|
var MimirInitializer = class {
|
|
4419
4423
|
constructor(fs4, configLoader2) {
|
|
4420
4424
|
this.fs = fs4;
|
|
@@ -4534,15 +4538,17 @@ checkpoints/
|
|
|
4534
4538
|
"light-colorblind.json"
|
|
4535
4539
|
];
|
|
4536
4540
|
try {
|
|
4541
|
+
const currentDir = dirname2(fileURLToPath2(import.meta.url));
|
|
4537
4542
|
const executablePath = process.argv[0] || process.execPath;
|
|
4538
4543
|
const binaryDir = dirname2(executablePath);
|
|
4539
4544
|
const possibleSourceDirs = [
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4545
|
+
// npm package: <package-root>/src/cli/themes/
|
|
4546
|
+
path6.join(currentDir, "../../src/cli/themes"),
|
|
4547
|
+
// From dist/core/ -> src/cli/themes
|
|
4543
4548
|
// Development: dist/core/../cli/themes
|
|
4544
|
-
path6.join(
|
|
4545
|
-
//
|
|
4549
|
+
path6.join(currentDir, "../cli/themes"),
|
|
4550
|
+
// Compiled binary: ~/.local/bin/resources/themes/
|
|
4551
|
+
path6.join(binaryDir, "resources", "themes")
|
|
4546
4552
|
];
|
|
4547
4553
|
for (const themeFile of defaultThemes) {
|
|
4548
4554
|
const destPath = path6.join(themesDir, themeFile);
|
|
@@ -4583,15 +4589,17 @@ checkpoints/
|
|
|
4583
4589
|
const commandsDir = path6.join(mimirDir, "commands");
|
|
4584
4590
|
const exampleCommands = ["update-docs.yml"];
|
|
4585
4591
|
try {
|
|
4592
|
+
const currentDir = dirname2(fileURLToPath2(import.meta.url));
|
|
4586
4593
|
const executablePath = process.argv[0] || process.execPath;
|
|
4587
4594
|
const binaryDir = dirname2(executablePath);
|
|
4588
4595
|
const possibleSourceDirs = [
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4596
|
+
// npm package: <package-root>/scripts/templates/commands/
|
|
4597
|
+
path6.join(currentDir, "../../scripts/templates/commands"),
|
|
4598
|
+
// From dist/core/ -> scripts/templates/commands
|
|
4592
4599
|
// Development: dist/core/../../scripts/templates/commands
|
|
4593
|
-
path6.join(
|
|
4594
|
-
//
|
|
4600
|
+
path6.join(currentDir, "../../../scripts/templates/commands"),
|
|
4601
|
+
// Compiled binary: ~/.local/bin/resources/commands/
|
|
4602
|
+
path6.join(binaryDir, "resources", "commands")
|
|
4595
4603
|
];
|
|
4596
4604
|
for (const commandFile of exampleCommands) {
|
|
4597
4605
|
const destPath = path6.join(commandsDir, commandFile);
|