@supacloud/cli 0.47.0 → 0.48.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.
- package/dist/index.js +86 -10
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -183718,6 +183718,10 @@ import { join as join22 } from "node:path";
|
|
|
183718
183718
|
var ts4 = __toESM(require_typescript(), 1);
|
|
183719
183719
|
import { existsSync as existsSync22, readFileSync as readFileSync22 } from "node:fs";
|
|
183720
183720
|
import { dirname as dirname22, join as join32, relative as relative22, resolve as resolve22, sep as sep22 } from "node:path";
|
|
183721
|
+
import { existsSync as existsSync52 } from "node:fs";
|
|
183722
|
+
import { join as join62, resolve as resolve52 } from "node:path";
|
|
183723
|
+
import { pathToFileURL } from "node:url";
|
|
183724
|
+
|
|
183721
183725
|
class TraitCompiler {
|
|
183722
183726
|
handlers;
|
|
183723
183727
|
constructor(handlers = createDefaultTraitHandlers()) {
|
|
@@ -188177,6 +188181,62 @@ function resolveTypeSafety(options) {
|
|
|
188177
188181
|
exclude: options.typeSafety?.exclude
|
|
188178
188182
|
};
|
|
188179
188183
|
}
|
|
188184
|
+
var DEFAULT_SUPACLOUD_CONFIG = {
|
|
188185
|
+
root: "src",
|
|
188186
|
+
outDir: "generated",
|
|
188187
|
+
include: ["**/*.module.ts", "**/*.ts"],
|
|
188188
|
+
strict: true,
|
|
188189
|
+
generateClient: true,
|
|
188190
|
+
generatePermissions: true,
|
|
188191
|
+
treeShakeUnusedProviders: true,
|
|
188192
|
+
moduleBoundaryPreset: "modular-monolith"
|
|
188193
|
+
};
|
|
188194
|
+
function defineSupacloudConfig(config = {}) {
|
|
188195
|
+
return {
|
|
188196
|
+
...DEFAULT_SUPACLOUD_CONFIG,
|
|
188197
|
+
...config,
|
|
188198
|
+
include: config.include ?? [...DEFAULT_SUPACLOUD_CONFIG.include]
|
|
188199
|
+
};
|
|
188200
|
+
}
|
|
188201
|
+
function resolveSupacloudConfig(config = {}, cwd = process.cwd()) {
|
|
188202
|
+
const resolved = defineSupacloudConfig(config);
|
|
188203
|
+
return {
|
|
188204
|
+
rootDir: resolve52(cwd, resolved.root ?? DEFAULT_SUPACLOUD_CONFIG.root),
|
|
188205
|
+
outDir: resolve52(cwd, resolved.outDir ?? DEFAULT_SUPACLOUD_CONFIG.outDir),
|
|
188206
|
+
include: resolved.include ?? [...DEFAULT_SUPACLOUD_CONFIG.include],
|
|
188207
|
+
strict: resolved.strict ?? DEFAULT_SUPACLOUD_CONFIG.strict,
|
|
188208
|
+
generateClient: resolved.generateClient ?? DEFAULT_SUPACLOUD_CONFIG.generateClient,
|
|
188209
|
+
generatePermissions: resolved.generatePermissions ?? DEFAULT_SUPACLOUD_CONFIG.generatePermissions,
|
|
188210
|
+
moduleBoundaryPreset: resolved.moduleBoundaryPreset ?? DEFAULT_SUPACLOUD_CONFIG.moduleBoundaryPreset,
|
|
188211
|
+
treeShakeUnusedProviders: resolved.treeShakeUnusedProviders ?? DEFAULT_SUPACLOUD_CONFIG.treeShakeUnusedProviders
|
|
188212
|
+
};
|
|
188213
|
+
}
|
|
188214
|
+
async function loadSupacloudConfig(cwd = process.cwd()) {
|
|
188215
|
+
const candidates = [
|
|
188216
|
+
join62(cwd, "supacloud.config.ts"),
|
|
188217
|
+
join62(cwd, "supacloud.config.mts"),
|
|
188218
|
+
join62(cwd, "supacloud.config.js"),
|
|
188219
|
+
join62(cwd, "supacloud.config.mjs")
|
|
188220
|
+
];
|
|
188221
|
+
const configPath = candidates.find((candidate) => existsSync52(candidate));
|
|
188222
|
+
if (!configPath)
|
|
188223
|
+
return defineSupacloudConfig();
|
|
188224
|
+
const imported = await import(pathToFileURL(configPath).href);
|
|
188225
|
+
return defineSupacloudConfig(imported.default ?? {});
|
|
188226
|
+
}
|
|
188227
|
+
function compileOptionsFromConfig(config, cwd = process.cwd()) {
|
|
188228
|
+
const resolved = resolveSupacloudConfig(config, cwd);
|
|
188229
|
+
return {
|
|
188230
|
+
rootDir: resolved.rootDir,
|
|
188231
|
+
outDir: resolved.outDir,
|
|
188232
|
+
include: resolved.include,
|
|
188233
|
+
strict: resolved.strict,
|
|
188234
|
+
generateClient: resolved.generateClient,
|
|
188235
|
+
generatePermissions: resolved.generatePermissions,
|
|
188236
|
+
moduleBoundaryPreset: resolved.moduleBoundaryPreset,
|
|
188237
|
+
treeShakeUnusedProviders: resolved.treeShakeUnusedProviders
|
|
188238
|
+
};
|
|
188239
|
+
}
|
|
188180
188240
|
|
|
188181
188241
|
// src/shared/tools/app-tool-export.ts
|
|
188182
188242
|
function sanitizeToolName(name) {
|
|
@@ -188402,12 +188462,16 @@ function parseInclude(include) {
|
|
|
188402
188462
|
}
|
|
188403
188463
|
async function runCompile(args) {
|
|
188404
188464
|
const root = resolve8(args.root || process.cwd());
|
|
188405
|
-
const
|
|
188465
|
+
const loadedConfig = await loadSupacloudConfig(root);
|
|
188466
|
+
const defaults = resolveSupacloudConfig(loadedConfig, root);
|
|
188406
188467
|
const result = await compileProject({
|
|
188407
|
-
|
|
188408
|
-
|
|
188409
|
-
|
|
188410
|
-
|
|
188468
|
+
...compileOptionsFromConfig({
|
|
188469
|
+
...loadedConfig,
|
|
188470
|
+
root: args.root ? "." : loadedConfig.root,
|
|
188471
|
+
outDir: args.out_dir ? resolve8(root, args.out_dir) : defaults.outDir,
|
|
188472
|
+
include: parseInclude(args.include) ?? loadedConfig.include,
|
|
188473
|
+
strict: args.strict ?? loadedConfig.strict ?? false
|
|
188474
|
+
}, root)
|
|
188411
188475
|
});
|
|
188412
188476
|
const hasError = result.diagnostics.some((diagnostic) => diagnostic.severity === "error");
|
|
188413
188477
|
const text = [
|
|
@@ -188421,12 +188485,24 @@ async function runCompile(args) {
|
|
|
188421
188485
|
}
|
|
188422
188486
|
async function runCheck(args) {
|
|
188423
188487
|
const root = resolve8(args.root || process.cwd());
|
|
188424
|
-
const
|
|
188488
|
+
const loadedConfig = await loadSupacloudConfig(root);
|
|
188489
|
+
const defaults = resolveSupacloudConfig(loadedConfig, root);
|
|
188490
|
+
const config = compileOptionsFromConfig({
|
|
188491
|
+
...loadedConfig,
|
|
188492
|
+
root: args.root ? "." : loadedConfig.root,
|
|
188493
|
+
outDir: args.out_dir ? resolve8(root, args.out_dir) : defaults.outDir,
|
|
188494
|
+
include: parseInclude(args.include) ?? loadedConfig.include,
|
|
188495
|
+
strict: args.strict ?? loadedConfig.strict ?? false
|
|
188496
|
+
}, root);
|
|
188497
|
+
const graph = await analyzeProject(config.rootDir, config.include);
|
|
188425
188498
|
const diagnostics = [
|
|
188426
188499
|
...graph.diagnostics ?? [],
|
|
188427
|
-
...validateGraph(graph,
|
|
188500
|
+
...validateGraph(graph, {
|
|
188501
|
+
strict: config.strict,
|
|
188502
|
+
moduleBoundaryPreset: config.moduleBoundaryPreset
|
|
188503
|
+
})
|
|
188428
188504
|
];
|
|
188429
|
-
if (
|
|
188505
|
+
if (config.strict) {
|
|
188430
188506
|
for (const diagnostic of diagnostics) {
|
|
188431
188507
|
if (diagnostic.severity === "warn")
|
|
188432
188508
|
diagnostic.severity = "error";
|
|
@@ -191739,7 +191815,7 @@ function registerRemoteDevTools(server2, options = {}) {
|
|
|
191739
191815
|
// package.json
|
|
191740
191816
|
var package_default = {
|
|
191741
191817
|
name: "@supacloud/cli",
|
|
191742
|
-
version: "0.
|
|
191818
|
+
version: "0.48.0",
|
|
191743
191819
|
description: "Project-scoped CLI for SupaCloud users",
|
|
191744
191820
|
type: "module",
|
|
191745
191821
|
main: "./dist/index.js",
|
|
@@ -191772,7 +191848,7 @@ var package_default = {
|
|
|
191772
191848
|
},
|
|
191773
191849
|
dependencies: {
|
|
191774
191850
|
"@sinclair/typebox": "^0.34.52",
|
|
191775
|
-
"@supacloud/compiler": "^0.
|
|
191851
|
+
"@supacloud/compiler": "^0.7.0",
|
|
191776
191852
|
"@supacloud/db": "^0.2.0",
|
|
191777
191853
|
fflate: "^0.8.3"
|
|
191778
191854
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supacloud/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.0",
|
|
4
4
|
"description": "Project-scoped CLI for SupaCloud users",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@sinclair/typebox": "^0.34.52",
|
|
36
|
-
"@supacloud/compiler": "^0.
|
|
36
|
+
"@supacloud/compiler": "^0.7.0",
|
|
37
37
|
"@supacloud/db": "^0.2.0",
|
|
38
38
|
"fflate": "^0.8.3"
|
|
39
39
|
},
|