@vtj/local 0.8.8 → 0.8.10
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/controller.mjs +1 -0
- package/dist/plugin.d.ts +2 -0
- package/dist/plugin.mjs +7 -5
- package/dist/service.d.ts +1 -0
- package/dist/service.mjs +15 -5
- package/package.json +4 -4
package/dist/controller.mjs
CHANGED
package/dist/plugin.d.ts
CHANGED
package/dist/plugin.mjs
CHANGED
|
@@ -56,7 +56,7 @@ const linkPlugin = function(options) {
|
|
|
56
56
|
if (ctx.path !== entry) {
|
|
57
57
|
return html;
|
|
58
58
|
}
|
|
59
|
-
const link = typeof options.link === "string" ? options.link :
|
|
59
|
+
const link = typeof options.link === "string" ? options.link : `${options.packageName}/link.js`;
|
|
60
60
|
const url = `${config.base}${link}`;
|
|
61
61
|
return html.replace(
|
|
62
62
|
/<\/body>/,
|
|
@@ -152,13 +152,15 @@ export function createDevTools(options = {}) {
|
|
|
152
152
|
packagesDir: "../../packages",
|
|
153
153
|
devMode: false,
|
|
154
154
|
uploader: "/uploader.json",
|
|
155
|
+
packageName: "@vtj/pro",
|
|
156
|
+
nodeModulesDir: "node_modules",
|
|
155
157
|
hm: "42f2469b4aa27c3f8978f634c0c19d24",
|
|
156
158
|
...options
|
|
157
159
|
};
|
|
158
160
|
const plugins = [aliasPlugin(opts)];
|
|
159
|
-
const proPath =
|
|
160
|
-
const materialsPath1 =
|
|
161
|
-
const materialsPath2 =
|
|
161
|
+
const proPath = `${opts.nodeModulesDir}/${opts.packageName}/dist`;
|
|
162
|
+
const materialsPath1 = `${opts.nodeModulesDir}/@vtj/materials/dist`;
|
|
163
|
+
const materialsPath2 = `${opts.nodeModulesDir}/${opts.packageName}/${materialsPath1}`;
|
|
162
164
|
if (opts.copy) {
|
|
163
165
|
const copyOptions = [];
|
|
164
166
|
if (pathExistsSync(materialsPath1)) {
|
|
@@ -187,7 +189,7 @@ export function createDevTools(options = {}) {
|
|
|
187
189
|
const staticOptions = [];
|
|
188
190
|
if (pathExistsSync(proPath)) {
|
|
189
191
|
staticOptions.push({
|
|
190
|
-
path: `${opts.staticBase}
|
|
192
|
+
path: `${opts.staticBase}${opts.packageName}`,
|
|
191
193
|
dir: proPath
|
|
192
194
|
});
|
|
193
195
|
}
|
package/dist/service.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { type ApiRequest } from './shared';
|
|
|
4
4
|
import { type StaticRepositoryOptions } from './repository';
|
|
5
5
|
export declare function notMatch(_req: ApiRequest): Promise<import("./shared").ApiResponse>;
|
|
6
6
|
export declare function saveLogs(e: any): Promise<boolean>;
|
|
7
|
+
export declare function getExtension(): Promise<import("./shared").ApiResponse>;
|
|
7
8
|
export declare function init(): Promise<import("./shared").ApiResponse>;
|
|
8
9
|
export declare function saveProject(dsl: ProjectSchema): Promise<import("./shared").ApiResponse>;
|
|
9
10
|
export declare function saveFile(dsl: BlockSchema): Promise<import("./shared").ApiResponse>;
|
package/dist/service.mjs
CHANGED
|
@@ -19,22 +19,32 @@ export async function saveLogs(e) {
|
|
|
19
19
|
const json = JSON.parse(JSON.stringify(e));
|
|
20
20
|
return logs.save(name, json);
|
|
21
21
|
}
|
|
22
|
+
export async function getExtension() {
|
|
23
|
+
const root = resolve("./");
|
|
24
|
+
const pkg = readJsonSync(resolve(root, "package.json"));
|
|
25
|
+
const { vtj = {} } = pkg || {};
|
|
26
|
+
return success(vtj.extension || null);
|
|
27
|
+
}
|
|
22
28
|
export async function init() {
|
|
23
29
|
const root = resolve("./");
|
|
24
30
|
const pkg = readJsonSync(resolve(root, "package.json"));
|
|
25
31
|
const repository = new JsonRepository("projects");
|
|
26
|
-
const {
|
|
27
|
-
|
|
32
|
+
const { vtj = {} } = pkg || {};
|
|
33
|
+
const id = vtj.id || pkg.name;
|
|
34
|
+
const name = vtj.name || pkg.description || upperFirstCamelCase(id);
|
|
35
|
+
const description = vtj.description || pkg.description || "";
|
|
36
|
+
let dsl = repository.get(id);
|
|
28
37
|
if (dsl) {
|
|
38
|
+
Object.assign(dsl, { id, name, description });
|
|
29
39
|
return success(dsl);
|
|
30
40
|
} else {
|
|
31
41
|
const model = new ProjectModel({
|
|
32
|
-
id
|
|
33
|
-
name
|
|
42
|
+
id,
|
|
43
|
+
name,
|
|
34
44
|
description
|
|
35
45
|
});
|
|
36
46
|
dsl = model.toDsl();
|
|
37
|
-
repository.save(
|
|
47
|
+
repository.save(id, dsl);
|
|
38
48
|
return success(dsl);
|
|
39
49
|
}
|
|
40
50
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vtj/local",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.10",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"formidable": "~3.5.1",
|
|
8
|
-
"@vtj/
|
|
9
|
-
"@vtj/
|
|
10
|
-
"@vtj/
|
|
8
|
+
"@vtj/core": "~0.8.10",
|
|
9
|
+
"@vtj/coder": "~0.8.10",
|
|
10
|
+
"@vtj/node": "~0.8.2"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"@types/formidable": "~3.4.5",
|