@hywax/cms 0.0.11 → 0.0.13

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/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hywax/cms",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "configKey": "cms",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.1",
package/dist/module.mjs CHANGED
@@ -6,7 +6,7 @@ import { snakeCase, kebabCase } from 'scule';
6
6
  import { readFile, writeFile } from 'node:fs/promises';
7
7
 
8
8
  const name = "@hywax/cms";
9
- const version = "0.0.11";
9
+ const version = "0.0.13";
10
10
 
11
11
  function createContext(options, nuxt) {
12
12
  const { resolve } = createResolver(import.meta.url);
@@ -48,7 +48,7 @@ function transformHttpCodes(httpCodes) {
48
48
  }
49
49
 
50
50
  function prepareAutoImports({ resolve, options, nuxt }) {
51
- const httpCodesPath = "#cms/http-codes";
51
+ const httpCodesPath = resolve(nuxt.options.buildDir, "http-codes");
52
52
  const httpCodesImports = transformHttpCodes(options.httpCodes).map(({ code }) => ({ name: code, from: httpCodesPath }));
53
53
  const sharedUtils = [
54
54
  "avatar",
@@ -70,6 +70,7 @@ function prepareAutoImports({ resolve, options, nuxt }) {
70
70
  });
71
71
  addPlugin(resolve("./runtime/plugins/api"));
72
72
  addImports([
73
+ ...httpCodesImports,
73
74
  ...sharedUtils,
74
75
  { name: "docToMarkdown", from: resolve("./runtime/editor/markdown") },
75
76
  { name: "markdownToDoc", from: resolve("./runtime/editor/markdown") }
@@ -86,6 +87,8 @@ function prepareAutoImports({ resolve, options, nuxt }) {
86
87
  addServerImportsDir([
87
88
  resolve("./runtime/server/utils")
88
89
  ]);
90
+ nuxt.options.nitro.alias ||= {};
91
+ nuxt.options.nitro.alias["#http-codes"] = httpCodesPath;
89
92
  nuxt.options.alias["#cms"] = resolve("./runtime");
90
93
  nuxt.options.appConfig.cms = defu(nuxt.options.appConfig.cms || {}, defaultCMSConfig);
91
94
  }
@@ -516,12 +519,9 @@ declare module '@nuxt/schema' {
516
519
  export {}
517
520
  `
518
521
  });
519
- return templates;
520
- }
521
- function getServerTemplates({ options }) {
522
- const templates = [];
523
522
  templates.push({
524
- filename: "#cms/http-codes",
523
+ filename: "http-codes.mjs",
524
+ write: true,
525
525
  getContents: () => {
526
526
  const httpCodes = transformHttpCodes(options.httpCodes);
527
527
  const content = httpCodes.map(({ code, value }) => `export const ${code} = '${value}'`).join("\n");
@@ -531,9 +531,13 @@ function getServerTemplates({ options }) {
531
531
  });
532
532
  return templates;
533
533
  }
534
+ function getServerTemplates(_context) {
535
+ const templates = [];
536
+ return templates;
537
+ }
534
538
  function prepareTemplates(context) {
535
539
  const appTemplates = getAppTemplates(context);
536
- const serverTemplates = getServerTemplates(context);
540
+ const serverTemplates = getServerTemplates();
537
541
  for (const template of appTemplates) {
538
542
  if (template.filename.endsWith(".d.ts")) {
539
543
  addTypeTemplate(template);
@@ -561,8 +565,8 @@ const module = defineNuxtModule({
561
565
  const context = createContext(options, nuxt);
562
566
  prepareMergeConfigs(context);
563
567
  await prepareInstallModules();
564
- prepareAutoImports(context);
565
568
  prepareTemplates(context);
569
+ prepareAutoImports(context);
566
570
  prepareServerRoutes(context);
567
571
  await prepareGenerateEnv(context);
568
572
  }
@@ -1,5 +1,5 @@
1
1
  import { Buffer } from "node:buffer";
2
- import { HTTP_CODE_BAD_REQUEST } from "#cms/http-codes";
2
+ import { HTTP_CODE_BAD_REQUEST } from "#http-codes";
3
3
  import { useRuntimeConfig } from "#imports";
4
4
  import { isImageMimeType } from "@uplora/formats";
5
5
  import { z } from "zod";
@@ -1,4 +1,4 @@
1
- import { HTTP_CODE_BAD_REQUEST, HTTP_CODE_INTERNAL_SERVER_ERROR, HTTP_CODE_REQUEST_TIMEOUT, HTTP_CODE_UNAUTHORIZED } from "#cms/http-codes";
1
+ import { HTTP_CODE_BAD_REQUEST, HTTP_CODE_INTERNAL_SERVER_ERROR, HTTP_CODE_REQUEST_TIMEOUT, HTTP_CODE_UNAUTHORIZED } from "#http-codes";
2
2
  import { consola } from "consola";
3
3
  import { defu } from "defu";
4
4
  import { createError, H3Error } from "h3";
@@ -1,4 +1,4 @@
1
- import { HTTP_CODE_BAD_REQUEST } from "#cms/http-codes";
1
+ import { HTTP_CODE_BAD_REQUEST } from "#http-codes";
2
2
  import { readMultipartFormData } from "h3";
3
3
  import { InternalHttpError } from "../errors/InternalHttpError.js";
4
4
  export function getValidatedSort(query, availableColumns) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hywax/cms",
3
3
  "type": "module",
4
- "version": "0.0.11",
4
+ "version": "0.0.13",
5
5
  "description": "Hywax CMS. ⚠️ This package is intended for internal use only.",
6
6
  "repository": {
7
7
  "type": "git",