@growi/pluginkit 1.0.0-next.96e3edfcdce577ec4ee9cf8f8d0ef908840d0bd4 → 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.
- package/dist/model/growi-plugin-validation-data.d.ts +4 -1
- package/dist/v4/server/index.cjs +1 -1
- package/dist/v4/server/index.js +10 -8
- package/dist/v4/server/index.js.map +1 -1
- package/dist/v4/server/utils/index.cjs +1 -1
- package/dist/v4/server/utils/index.d.ts +1 -0
- package/dist/v4/server/utils/index.js +10 -8
- package/dist/v4/server/utils/index.js.map +1 -1
- package/dist/v4/server/utils/theme/index.cjs +2 -0
- package/dist/v4/server/utils/theme/index.cjs.map +1 -0
- package/dist/v4/server/utils/theme/index.d.ts +1 -0
- package/dist/v4/server/utils/theme/index.js +5 -0
- package/dist/v4/server/utils/theme/index.js.map +1 -0
- package/dist/v4/server/utils/theme/validate-growi-plugin-directive.cjs +2 -0
- package/dist/v4/server/utils/theme/validate-growi-plugin-directive.cjs.map +1 -0
- package/dist/v4/server/utils/theme/validate-growi-plugin-directive.d.ts +7 -0
- package/dist/v4/server/utils/theme/validate-growi-plugin-directive.js +25 -0
- package/dist/v4/server/utils/theme/validate-growi-plugin-directive.js.map +1 -0
- package/dist/v4/server/utils/theme/validate-growi-plugin-directive.spec.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GrowiPluginDirective } from './growi-plugin-package-data';
|
|
2
|
-
import { GrowiPluginType } from '@growi/core';
|
|
2
|
+
import { GrowiPluginType, GrowiThemeMetadata } from '@growi/core';
|
|
3
3
|
|
|
4
4
|
export type GrowiPluginValidationData = {
|
|
5
5
|
projectDirRoot: string;
|
|
@@ -11,3 +11,6 @@ export type GrowiPluginValidationData = {
|
|
|
11
11
|
export type GrowiTemplatePluginValidationData = GrowiPluginValidationData & {
|
|
12
12
|
supportingLocales: string[];
|
|
13
13
|
};
|
|
14
|
+
export type GrowiThemePluginValidationData = GrowiPluginValidationData & {
|
|
15
|
+
themes: GrowiThemeMetadata[];
|
|
16
|
+
};
|
package/dist/v4/server/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./utils/common/import-package-json.cjs"),a=require("./utils/common/validate-growi-plugin-directive.cjs"),t=require("./utils/template/get-markdown.cjs"),e=require("./utils/template/scan.cjs"),l=require("./utils/template/validate-all-locales.cjs"),r=require("./utils/template/validate-growi-plugin-directive.cjs"),o=require("./utils/theme/validate-growi-plugin-directive.cjs");exports.importPackageJson=i.importPackageJson;exports.validateGrowiDirective=a.validateGrowiDirective;exports.getMarkdown=t.getMarkdown;exports.scanAllTemplates=e.scanAllTemplates;exports.scanTemplate=e.scanTemplate;exports.validateAllTemplateLocales=l.validateAllTemplateLocales;exports.validateTemplatePluginGrowiDirective=r.validateTemplatePluginGrowiDirective;exports.validateThemePluginGrowiDirective=o.validateThemePluginGrowiDirective;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/v4/server/index.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { importPackageJson as
|
|
1
|
+
import { importPackageJson as o } from "./utils/common/import-package-json.js";
|
|
2
2
|
import { validateGrowiDirective as a } from "./utils/common/validate-growi-plugin-directive.js";
|
|
3
|
-
import { getMarkdown as
|
|
3
|
+
import { getMarkdown as l } from "./utils/template/get-markdown.js";
|
|
4
4
|
import { scanAllTemplates as p, scanTemplate as c } from "./utils/template/scan.js";
|
|
5
|
-
import { validateAllTemplateLocales as
|
|
6
|
-
import { validateTemplatePluginGrowiDirective as
|
|
5
|
+
import { validateAllTemplateLocales as v } from "./utils/template/validate-all-locales.js";
|
|
6
|
+
import { validateTemplatePluginGrowiDirective as n } from "./utils/template/validate-growi-plugin-directive.js";
|
|
7
|
+
import { validateThemePluginGrowiDirective as s } from "./utils/theme/validate-growi-plugin-directive.js";
|
|
7
8
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
l as getMarkdown,
|
|
10
|
+
o as importPackageJson,
|
|
10
11
|
p as scanAllTemplates,
|
|
11
12
|
c as scanTemplate,
|
|
12
|
-
|
|
13
|
+
v as validateAllTemplateLocales,
|
|
13
14
|
a as validateGrowiDirective,
|
|
14
|
-
|
|
15
|
+
n as validateTemplatePluginGrowiDirective,
|
|
16
|
+
s as validateThemePluginGrowiDirective
|
|
15
17
|
};
|
|
16
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./common/import-package-json.cjs"),a=require("./common/validate-growi-plugin-directive.cjs"),t=require("./template/get-markdown.cjs"),e=require("./template/scan.cjs"),l=require("./template/validate-all-locales.cjs"),r=require("./template/validate-growi-plugin-directive.cjs"),o=require("./theme/validate-growi-plugin-directive.cjs");exports.importPackageJson=i.importPackageJson;exports.validateGrowiDirective=a.validateGrowiDirective;exports.getMarkdown=t.getMarkdown;exports.scanAllTemplates=e.scanAllTemplates;exports.scanTemplate=e.scanTemplate;exports.validateAllTemplateLocales=l.validateAllTemplateLocales;exports.validateTemplatePluginGrowiDirective=r.validateTemplatePluginGrowiDirective;exports.validateThemePluginGrowiDirective=o.validateThemePluginGrowiDirective;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { importPackageJson as
|
|
1
|
+
import { importPackageJson as o } from "./common/import-package-json.js";
|
|
2
2
|
import { validateGrowiDirective as a } from "./common/validate-growi-plugin-directive.js";
|
|
3
|
-
import { getMarkdown as
|
|
3
|
+
import { getMarkdown as l } from "./template/get-markdown.js";
|
|
4
4
|
import { scanAllTemplates as p, scanTemplate as c } from "./template/scan.js";
|
|
5
|
-
import { validateAllTemplateLocales as
|
|
6
|
-
import { validateTemplatePluginGrowiDirective as
|
|
5
|
+
import { validateAllTemplateLocales as v } from "./template/validate-all-locales.js";
|
|
6
|
+
import { validateTemplatePluginGrowiDirective as n } from "./template/validate-growi-plugin-directive.js";
|
|
7
|
+
import { validateThemePluginGrowiDirective as s } from "./theme/validate-growi-plugin-directive.js";
|
|
7
8
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
l as getMarkdown,
|
|
10
|
+
o as importPackageJson,
|
|
10
11
|
p as scanAllTemplates,
|
|
11
12
|
c as scanTemplate,
|
|
12
|
-
|
|
13
|
+
v as validateAllTemplateLocales,
|
|
13
14
|
a as validateGrowiDirective,
|
|
14
|
-
|
|
15
|
+
n as validateTemplatePluginGrowiDirective,
|
|
16
|
+
s as validateThemePluginGrowiDirective
|
|
15
17
|
};
|
|
16
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './validate-growi-plugin-directive';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@growi/core"),n=require("../../../../model/growi-plugin-validation-error.cjs"),s=require("../common/validate-growi-plugin-directive.cjs"),h=l=>{const r=s.validateGrowiDirective(l,o.GrowiPluginType.Theme),{growiPlugin:e}=r;if(e.themes==null||!Array.isArray(e.themes)||e.themes.length===0)throw new n.GrowiPluginValidationError("Theme plugin must have 'themes' array and that must have one or more theme metadata");const a=[],i=[];if(e.themes.forEach(t=>{o.isGrowiThemeMetadata(t)?a.push(t):i.push(t)}),i.length>0)throw new n.GrowiPluginValidationError(`Some of theme metadata are invalid: ${i.toString()}`);return{...r,themes:a}};exports.validateThemePluginGrowiDirective=h;
|
|
2
|
+
//# sourceMappingURL=validate-growi-plugin-directive.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-growi-plugin-directive.cjs","sources":["../../../../../src/v4/server/utils/theme/validate-growi-plugin-directive.ts"],"sourcesContent":["import type { GrowiThemeMetadata } from '@growi/core';\nimport { GrowiPluginType, isGrowiThemeMetadata } from '@growi/core';\n\nimport type { GrowiPluginValidationData, GrowiThemePluginValidationData } from '../../../../model';\nimport { GrowiPluginValidationError } from '../../../../model';\nimport { validateGrowiDirective } from '../common';\n\n\n/**\n * An utility for theme plugin which wrap 'validateGrowiDirective' of './common' module\n * @param projectDirRoot\n */\nexport const validateThemePluginGrowiDirective = (projectDirRoot: string): GrowiThemePluginValidationData => {\n const data = validateGrowiDirective(projectDirRoot, GrowiPluginType.Theme);\n\n const { growiPlugin } = data;\n\n // check themes\n if (growiPlugin.themes == null || !Array.isArray(growiPlugin.themes) || growiPlugin.themes.length === 0) {\n throw new GrowiPluginValidationError<GrowiPluginValidationData>(\n \"Theme plugin must have 'themes' array and that must have one or more theme metadata\",\n );\n }\n\n const validMetadatas: GrowiThemeMetadata[] = [];\n const invalidObjects: unknown[] = [];\n growiPlugin.themes.forEach((theme: unknown) => {\n if (isGrowiThemeMetadata(theme)) {\n validMetadatas.push(theme);\n }\n else {\n invalidObjects.push(theme);\n }\n });\n\n if (invalidObjects.length > 0) {\n throw new GrowiPluginValidationError<GrowiPluginValidationData>(\n `Some of theme metadata are invalid: ${invalidObjects.toString()}`,\n );\n }\n\n return {\n ...data,\n themes: validMetadatas,\n };\n};\n"],"names":["validateThemePluginGrowiDirective","projectDirRoot","data","validateGrowiDirective","GrowiPluginType","growiPlugin","GrowiPluginValidationError","validMetadatas","invalidObjects","theme","isGrowiThemeMetadata"],"mappings":"2OAYaA,EAAqCC,GAA2D,CAC3G,MAAMC,EAAOC,EAAA,uBAAuBF,EAAgBG,EAAA,gBAAgB,KAAK,EAEnE,CAAE,YAAAC,CAAgB,EAAAH,EAGxB,GAAIG,EAAY,QAAU,MAAQ,CAAC,MAAM,QAAQA,EAAY,MAAM,GAAKA,EAAY,OAAO,SAAW,EACpG,MAAM,IAAIC,EAAA,2BACR,qFAAA,EAIJ,MAAMC,EAAuC,CAAA,EACvCC,EAA4B,CAAA,EAU9B,GATQH,EAAA,OAAO,QAASI,GAAmB,CACzCC,EAAAA,qBAAqBD,CAAK,EAC5BF,EAAe,KAAKE,CAAK,EAGzBD,EAAe,KAAKC,CAAK,CAC3B,CACD,EAEGD,EAAe,OAAS,EAC1B,MAAM,IAAIF,EAAA,2BACR,uCAAuCE,EAAe,SAAA,CAAU,EAAA,EAI7D,MAAA,CACL,GAAGN,EACH,OAAQK,CAAA,CAEZ"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GrowiThemePluginValidationData } from '../../../../model';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* An utility for theme plugin which wrap 'validateGrowiDirective' of './common' module
|
|
5
|
+
* @param projectDirRoot
|
|
6
|
+
*/
|
|
7
|
+
export declare const validateThemePluginGrowiDirective: (projectDirRoot: string) => GrowiThemePluginValidationData;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { GrowiPluginType as n, isGrowiThemeMetadata as h } from "@growi/core";
|
|
2
|
+
import { GrowiPluginValidationError as o } from "../../../../model/growi-plugin-validation-error.js";
|
|
3
|
+
import { validateGrowiDirective as s } from "../common/validate-growi-plugin-directive.js";
|
|
4
|
+
const w = (m) => {
|
|
5
|
+
const i = s(m, n.Theme), { growiPlugin: e } = i;
|
|
6
|
+
if (e.themes == null || !Array.isArray(e.themes) || e.themes.length === 0)
|
|
7
|
+
throw new o(
|
|
8
|
+
"Theme plugin must have 'themes' array and that must have one or more theme metadata"
|
|
9
|
+
);
|
|
10
|
+
const r = [], t = [];
|
|
11
|
+
if (e.themes.forEach((a) => {
|
|
12
|
+
h(a) ? r.push(a) : t.push(a);
|
|
13
|
+
}), t.length > 0)
|
|
14
|
+
throw new o(
|
|
15
|
+
`Some of theme metadata are invalid: ${t.toString()}`
|
|
16
|
+
);
|
|
17
|
+
return {
|
|
18
|
+
...i,
|
|
19
|
+
themes: r
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
w as validateThemePluginGrowiDirective
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=validate-growi-plugin-directive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-growi-plugin-directive.js","sources":["../../../../../src/v4/server/utils/theme/validate-growi-plugin-directive.ts"],"sourcesContent":["import type { GrowiThemeMetadata } from '@growi/core';\nimport { GrowiPluginType, isGrowiThemeMetadata } from '@growi/core';\n\nimport type { GrowiPluginValidationData, GrowiThemePluginValidationData } from '../../../../model';\nimport { GrowiPluginValidationError } from '../../../../model';\nimport { validateGrowiDirective } from '../common';\n\n\n/**\n * An utility for theme plugin which wrap 'validateGrowiDirective' of './common' module\n * @param projectDirRoot\n */\nexport const validateThemePluginGrowiDirective = (projectDirRoot: string): GrowiThemePluginValidationData => {\n const data = validateGrowiDirective(projectDirRoot, GrowiPluginType.Theme);\n\n const { growiPlugin } = data;\n\n // check themes\n if (growiPlugin.themes == null || !Array.isArray(growiPlugin.themes) || growiPlugin.themes.length === 0) {\n throw new GrowiPluginValidationError<GrowiPluginValidationData>(\n \"Theme plugin must have 'themes' array and that must have one or more theme metadata\",\n );\n }\n\n const validMetadatas: GrowiThemeMetadata[] = [];\n const invalidObjects: unknown[] = [];\n growiPlugin.themes.forEach((theme: unknown) => {\n if (isGrowiThemeMetadata(theme)) {\n validMetadatas.push(theme);\n }\n else {\n invalidObjects.push(theme);\n }\n });\n\n if (invalidObjects.length > 0) {\n throw new GrowiPluginValidationError<GrowiPluginValidationData>(\n `Some of theme metadata are invalid: ${invalidObjects.toString()}`,\n );\n }\n\n return {\n ...data,\n themes: validMetadatas,\n };\n};\n"],"names":["validateThemePluginGrowiDirective","projectDirRoot","data","validateGrowiDirective","GrowiPluginType","growiPlugin","GrowiPluginValidationError","validMetadatas","invalidObjects","theme","isGrowiThemeMetadata"],"mappings":";;;AAYa,MAAAA,IAAoC,CAACC,MAA2D;AAC3G,QAAMC,IAAOC,EAAuBF,GAAgBG,EAAgB,KAAK,GAEnE,EAAE,aAAAC,EAAgB,IAAAH;AAGxB,MAAIG,EAAY,UAAU,QAAQ,CAAC,MAAM,QAAQA,EAAY,MAAM,KAAKA,EAAY,OAAO,WAAW;AACpG,UAAM,IAAIC;AAAA,MACR;AAAA,IAAA;AAIJ,QAAMC,IAAuC,CAAA,GACvCC,IAA4B,CAAA;AAU9B,MATQH,EAAA,OAAO,QAAQ,CAACI,MAAmB;AACzC,IAAAC,EAAqBD,CAAK,IAC5BF,EAAe,KAAKE,CAAK,IAGzBD,EAAe,KAAKC,CAAK;AAAA,EAC3B,CACD,GAEGD,EAAe,SAAS;AAC1B,UAAM,IAAIF;AAAA,MACR,uCAAuCE,EAAe,SAAA,CAAU;AAAA,IAAA;AAI7D,SAAA;AAAA,IACL,GAAGN;AAAA,IACH,QAAQK;AAAA,EAAA;AAEZ;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@growi/pluginkit",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Plugin kit for GROWI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"test": "vitest run --coverage"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@growi/core": "1.0.0
|
|
24
|
+
"@growi/core": "^1.0.0",
|
|
25
25
|
"extensible-custom-error": "^0.0.7"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {}
|