@zenstackhq/cli 3.8.0-beta.2 → 3.8.0-beta.3
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.cjs +7 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +8 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -13
package/dist/index.cjs
CHANGED
|
@@ -319,7 +319,7 @@ async function checkPluginResolution(schemaFile, model) {
|
|
|
319
319
|
for (const plugin of plugins) {
|
|
320
320
|
const provider = getPluginProvider(plugin);
|
|
321
321
|
if (!provider.startsWith("@core/")) {
|
|
322
|
-
const pluginSourcePath = plugin.$cstNode?.
|
|
322
|
+
const pluginSourcePath = plugin.$cstNode?.container?.astNode.$document?.uri?.fsPath ?? schemaFile;
|
|
323
323
|
await loadPluginModule(provider, node_path.default.dirname(pluginSourcePath));
|
|
324
324
|
}
|
|
325
325
|
}
|
|
@@ -2335,7 +2335,7 @@ async function runPull(options) {
|
|
|
2335
2335
|
model.declarations.splice(index, 1);
|
|
2336
2336
|
deletedEnums.push(colors.default.red(`- Enum ${decl.name} deleted`));
|
|
2337
2337
|
});
|
|
2338
|
-
newModel.declarations.filter((d) =>
|
|
2338
|
+
newModel.declarations.filter((d) => d.$type === _zenstackhq_language_ast.DataModel.$type || d.$type === _zenstackhq_language_ast.Enum.$type).forEach((_declaration) => {
|
|
2339
2339
|
const newDataModel = _declaration;
|
|
2340
2340
|
const declarations = services.shared.workspace.IndexManager.allElements(newDataModel.$type, docsSet).toArray();
|
|
2341
2341
|
const originalDataModel = declarations.find((d) => getDbName(d.node) === getDbName(newDataModel))?.node;
|
|
@@ -2632,8 +2632,9 @@ const plugin = {
|
|
|
2632
2632
|
}
|
|
2633
2633
|
const lite = pluginOptions["lite"] === true;
|
|
2634
2634
|
const liteOnly = pluginOptions["liteOnly"] === true;
|
|
2635
|
-
|
|
2636
|
-
if (importWithFileExtension
|
|
2635
|
+
let importWithFileExtension = pluginOptions["importWithFileExtension"];
|
|
2636
|
+
if (importWithFileExtension === void 0) importWithFileExtension = (0, _zenstackhq_sdk.detectImportFileExtension)(outDir);
|
|
2637
|
+
else if (typeof importWithFileExtension !== "string") throw new Error("The \"importWithFileExtension\" option must be a string if specified.");
|
|
2637
2638
|
const generateModelTypes = pluginOptions["generateModels"] !== false;
|
|
2638
2639
|
const generateInputTypes = pluginOptions["generateInput"] !== false;
|
|
2639
2640
|
await new _zenstackhq_sdk.TsSchemaGenerator().generate(model, {
|
|
@@ -2670,7 +2671,7 @@ async function run$5(options) {
|
|
|
2670
2671
|
const logsEnabled = !options.silent;
|
|
2671
2672
|
if (logsEnabled) console.log(colors.default.green(`\nEnabled watch mode!`));
|
|
2672
2673
|
const schemaExtensions = _zenstackhq_language.ZModelLanguageMetaData.fileExtensions;
|
|
2673
|
-
const getRootModelWatchPaths = (model) => new Set(model.declarations.filter((v) => v.$cstNode?.
|
|
2674
|
+
const getRootModelWatchPaths = (model) => new Set(model.declarations.filter((v) => v.$cstNode?.container?.astNode.$type === "Model" && !!v.$cstNode.container.astNode.$document?.uri?.fsPath).map((v) => v.$cstNode.container.astNode.$document.uri.fsPath));
|
|
2674
2675
|
const watchedPaths = getRootModelWatchPaths(model);
|
|
2675
2676
|
if (logsEnabled) {
|
|
2676
2677
|
const logPaths = [...watchedPaths].map((at) => `- ${at}`).join("\n");
|
|
@@ -2752,7 +2753,7 @@ async function runPlugins(schemaFile, model, outputPath, options) {
|
|
|
2752
2753
|
cliPlugin = plugins_exports[provider.slice(6)];
|
|
2753
2754
|
if (!cliPlugin) throw new CliError(`Unknown core plugin: ${provider}`);
|
|
2754
2755
|
} else {
|
|
2755
|
-
const pluginSourcePath = plugin.$cstNode?.
|
|
2756
|
+
const pluginSourcePath = plugin.$cstNode?.container?.astNode.$document?.uri?.fsPath ?? schemaFile;
|
|
2756
2757
|
cliPlugin = await loadPluginModule(provider, node_path.default.dirname(pluginSourcePath));
|
|
2757
2758
|
}
|
|
2758
2759
|
if (cliPlugin) {
|