rimelight-components 2.0.71 → 2.0.73
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 +1 -1
- package/dist/module.mjs +29 -49
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { readdirSync } from 'node:fs';
|
|
|
4
4
|
import { basename } from 'node:path';
|
|
5
5
|
|
|
6
6
|
const name = "rimelight-components";
|
|
7
|
-
const version = "2.0.
|
|
7
|
+
const version = "2.0.73";
|
|
8
8
|
const homepage = "https://rimelight.com/tools/rimelight-components";
|
|
9
9
|
|
|
10
10
|
const defaultOptions = {
|
|
@@ -56,7 +56,7 @@ function addBlockMapTemplates(blockNames) {
|
|
|
56
56
|
let content = "export const BLOCK_RENDERER_COMPONENT_MAP = {\n";
|
|
57
57
|
blockNames.forEach((name) => {
|
|
58
58
|
const fullComponentName = `${name}Renderer`;
|
|
59
|
-
const componentPath = `rimelight-components/components/blocks/renderer/${fullComponentName}.vue`;
|
|
59
|
+
const componentPath = `rimelight-components/runtime/components/blocks/renderer/${fullComponentName}.vue`;
|
|
60
60
|
content += ` '${name}': () => import('${componentPath}'),
|
|
61
61
|
`;
|
|
62
62
|
});
|
|
@@ -68,32 +68,22 @@ function addBlockMapTemplates(blockNames) {
|
|
|
68
68
|
addTemplate({
|
|
69
69
|
filename: "rimelight-block-renderer-map.d.ts",
|
|
70
70
|
getContents: () => {
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
content += `import { Component } from 'vue'
|
|
75
|
-
`;
|
|
76
|
-
content += `export declare const BLOCK_RENDERER_COMPONENT_MAP: { [key: string]: ${componentImporterType} | undefined }
|
|
77
|
-
`;
|
|
78
|
-
blockNames.forEach((name) => {
|
|
79
|
-
content += `export declare const ${name}: ${componentImporterType}
|
|
80
|
-
`;
|
|
81
|
-
});
|
|
82
|
-
return content;
|
|
71
|
+
const importerType = '() => Promise<{ default: import("vue").Component }>';
|
|
72
|
+
return `import { Component } from 'vue'
|
|
73
|
+
export declare const BLOCK_RENDERER_COMPONENT_MAP: Record<string, ${importerType}>`;
|
|
83
74
|
},
|
|
84
75
|
write: true
|
|
85
76
|
});
|
|
86
77
|
return template;
|
|
87
78
|
}
|
|
88
79
|
function addEditorBlockMapTemplates(blockNames) {
|
|
89
|
-
const componentImporterType = '() => Promise<{ default: import("vue").Component }>';
|
|
90
80
|
const template = addTemplate({
|
|
91
81
|
filename: "rimelight-block-editor-map.mjs",
|
|
92
82
|
getContents: () => {
|
|
93
83
|
let content = "export const BLOCK_EDITOR_COMPONENT_MAP = {\n";
|
|
94
84
|
blockNames.forEach((name) => {
|
|
95
85
|
const fullComponentName = `${name}Editor`;
|
|
96
|
-
const componentPath = `rimelight-components/components/blocks/editor/${fullComponentName}.vue`;
|
|
86
|
+
const componentPath = `rimelight-components/runtime/components/blocks/editor/${fullComponentName}.vue`;
|
|
97
87
|
content += ` '${name}': () => import('${componentPath}'),
|
|
98
88
|
`;
|
|
99
89
|
});
|
|
@@ -105,17 +95,9 @@ function addEditorBlockMapTemplates(blockNames) {
|
|
|
105
95
|
addTemplate({
|
|
106
96
|
filename: "rimelight-block-editor-map.d.ts",
|
|
107
97
|
getContents: () => {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
`;
|
|
112
|
-
content += `export declare const BLOCK_EDITOR_COMPONENT_MAP: { [key: string]: ${componentImporterType} | undefined }
|
|
113
|
-
`;
|
|
114
|
-
blockNames.forEach((name) => {
|
|
115
|
-
content += `export declare const ${name}: ${componentImporterType}
|
|
116
|
-
`;
|
|
117
|
-
});
|
|
118
|
-
return content;
|
|
98
|
+
const importerType = '() => Promise<{ default: import("vue").Component }>';
|
|
99
|
+
return `import { Component } from 'vue'
|
|
100
|
+
export declare const BLOCK_EDITOR_COMPONENT_MAP: Record<string, ${importerType}>`;
|
|
119
101
|
},
|
|
120
102
|
write: true
|
|
121
103
|
});
|
|
@@ -193,42 +175,40 @@ const module$1 = defineNuxtModule().with({
|
|
|
193
175
|
},
|
|
194
176
|
setup(options, nuxt) {
|
|
195
177
|
const { resolve } = createResolver(import.meta.url);
|
|
178
|
+
const runtimePath = resolve("./runtime");
|
|
196
179
|
nuxt.options.appConfig.rimelightComponents = defu(
|
|
197
180
|
nuxt.options.appConfig.rimelightComponents || {},
|
|
198
181
|
options
|
|
199
182
|
);
|
|
200
|
-
nuxt.options.
|
|
183
|
+
nuxt.options.build.transpile.push(runtimePath);
|
|
184
|
+
nuxt.options.build.transpile.push("rimelight-components");
|
|
185
|
+
nuxt.options.alias["#rimelight-components"] = runtimePath;
|
|
201
186
|
addComponentsDir({
|
|
202
187
|
path: resolve("./runtime/components/"),
|
|
203
188
|
pathPrefix: false,
|
|
204
|
-
//TODO Figure out if this can be typed better
|
|
205
189
|
prefix: options.prefix ?? void 0,
|
|
206
190
|
global: true
|
|
207
191
|
});
|
|
208
192
|
addImportsDir(resolve("./runtime/composables"));
|
|
209
193
|
addImportsDir(resolve("./runtime/utils"));
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
nuxt.options.alias[
|
|
219
|
-
const blockEditorFiles = readdirSync(
|
|
220
|
-
resolve("./runtime/components/blocks/editor")
|
|
221
|
-
).filter((name2) => name2.endsWith(".vue"));
|
|
222
|
-
const blockEditorNames = blockEditorFiles.map((file) => {
|
|
223
|
-
const baseName = basename(file, ".vue");
|
|
224
|
-
return baseName.replace(/Editor$/, "");
|
|
225
|
-
});
|
|
226
|
-
const blockEditorTemplate = addEditorBlockMapTemplates(blockEditorNames);
|
|
227
|
-
nuxt.options.alias["#rimelight-block-editor-map"] = blockEditorTemplate.dst;
|
|
194
|
+
const getBlockNames = (dir, suffix) => readdirSync(resolve(dir)).filter((f) => f.endsWith(".vue")).map((f) => basename(f, ".vue").replace(new RegExp(`${suffix}$`), ""));
|
|
195
|
+
const rendererNames = getBlockNames("./runtime/components/blocks/renderer", "Renderer");
|
|
196
|
+
const editorNames = getBlockNames("./runtime/components/blocks/editor", "Editor");
|
|
197
|
+
const blockRendererTemplate = addBlockMapTemplates(rendererNames);
|
|
198
|
+
const blockEditorTemplate = addEditorBlockMapTemplates(editorNames);
|
|
199
|
+
const rendererAlias = "#rimelight-block-renderer-map";
|
|
200
|
+
const editorAlias = "#rimelight-block-editor-map";
|
|
201
|
+
nuxt.options.alias[rendererAlias] = blockRendererTemplate.dst;
|
|
202
|
+
nuxt.options.alias[editorAlias] = blockEditorTemplate.dst;
|
|
228
203
|
nuxt.hook("nitro:config", (nitroConfig) => {
|
|
229
204
|
nitroConfig.alias = nitroConfig.alias || {};
|
|
230
|
-
nitroConfig.alias[
|
|
231
|
-
nitroConfig.
|
|
205
|
+
nitroConfig.alias[rendererAlias] = blockRendererTemplate.dst;
|
|
206
|
+
nitroConfig.virtual = nitroConfig.virtual || {};
|
|
207
|
+
nitroConfig.virtual[editorAlias] = "export const BLOCK_EDITOR_COMPONENT_MAP = {}";
|
|
208
|
+
nitroConfig.externals = nitroConfig.externals || {};
|
|
209
|
+
nitroConfig.externals.inline = nitroConfig.externals.inline || [];
|
|
210
|
+
nitroConfig.externals.inline.push(runtimePath);
|
|
211
|
+
nitroConfig.externals.inline.push("rimelight-components");
|
|
232
212
|
});
|
|
233
213
|
nuxt.hook("prepare:types", ({ references }) => {
|
|
234
214
|
references.push({ path: blockRendererTemplate.dst });
|