@blocklet/pages-kit-block-studio 0.0.18 → 0.1.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.
Files changed (28) hide show
  1. package/lib/cjs/constants/index.js +12 -1
  2. package/lib/cjs/constants/new-block-template/@metadata.json +59 -0
  3. package/lib/cjs/constants/new-block-template/index.js +55 -0
  4. package/lib/cjs/constants/new-block-template/index.tsx +89 -0
  5. package/lib/cjs/middlewares/init-block-studio-router.js +43 -9
  6. package/lib/cjs/middlewares/init-resource-router.js +5 -1
  7. package/lib/cjs/plugins/vite-plugin-block-studio.js +29 -31
  8. package/lib/cjs/plugins/vite-plugin-html-transform.js +40 -5
  9. package/lib/cjs/tsconfig.tsbuildinfo +1 -1
  10. package/lib/cjs/utils/generate-wrapper-code.js +21 -25
  11. package/lib/cjs/utils/helper.js +20 -12
  12. package/lib/esm/constants/index.js +8 -0
  13. package/lib/esm/constants/new-block-template/@metadata.json +59 -0
  14. package/lib/esm/constants/new-block-template/index.js +50 -0
  15. package/lib/esm/constants/new-block-template/index.tsx +89 -0
  16. package/lib/esm/middlewares/init-block-studio-router.js +44 -10
  17. package/lib/esm/middlewares/init-resource-router.js +5 -1
  18. package/lib/esm/plugins/vite-plugin-block-studio.js +29 -31
  19. package/lib/esm/plugins/vite-plugin-html-transform.js +40 -5
  20. package/lib/esm/tsconfig.tsbuildinfo +1 -1
  21. package/lib/esm/utils/generate-wrapper-code.js +21 -25
  22. package/lib/esm/utils/helper.js +10 -6
  23. package/lib/types/constants/index.d.ts +7 -0
  24. package/lib/types/constants/new-block-template/index.d.ts +13 -0
  25. package/lib/types/tsconfig.tsbuildinfo +1 -1
  26. package/lib/types/utils/helper.d.ts +2 -4
  27. package/package.json +17 -5
  28. package/tsconfig.json +3 -1
@@ -1,12 +1,9 @@
1
+ export * from '../constants';
1
2
  export interface GlobOptions {
2
3
  cwd?: string;
3
4
  filter?: string[];
4
5
  }
5
6
  export declare const logger: Console;
6
- export declare const libDir = "lib";
7
- export declare const METADATA_FILE_NAME = "@metadata.json";
8
- export declare const PREVIEW_IMAGE_DIR = "@preview-images";
9
- export declare const NANOID_LENGTH = 16;
10
7
  export declare function setBlockEntryFilesPattern(pattern: string): void;
11
8
  export declare function getBlockEntryFilesPattern(): string;
12
9
  export declare function findComponentFiles(options?: GlobOptions): {
@@ -31,3 +28,4 @@ export declare function generateYaml(metadata: any): string;
31
28
  export declare function getBlockStudioInfo(): import("@blocklet/sdk/lib/config").MountPoint | undefined;
32
29
  export declare const isPagesKitBlockStudio: boolean;
33
30
  export declare const getBlockCode: (filePath: string) => string;
31
+ export declare const safeParse: (text: string) => any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/pages-kit-block-studio",
3
- "version": "0.0.18",
3
+ "version": "0.1.0",
4
4
  "description": "Pages Kit block studio",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -39,6 +39,10 @@
39
39
  "./init-uploader-router": {
40
40
  "import": "./lib/esm/middlewares/init-uploader-router.js",
41
41
  "require": "./lib/cjs/middlewares/init-uploader-router.js"
42
+ },
43
+ "./init-block-studio-router": {
44
+ "import": "./lib/esm/middlewares/init-block-studio-router.js",
45
+ "require": "./lib/cjs/middlewares/init-block-studio-router.js"
42
46
  }
43
47
  },
44
48
  "typesVersions": {
@@ -68,6 +72,10 @@
68
72
  "init-uploader-router": [
69
73
  "./lib/types/middlewares/init-uploader-router.d.ts",
70
74
  "./lib/types/middlewares/init-uploader-router.d.ts"
75
+ ],
76
+ "init-block-studio-router": [
77
+ "./lib/types/middlewares/init-block-studio-router.d.ts",
78
+ "./lib/types/middlewares/init-block-studio-router.d.ts"
71
79
  ]
72
80
  }
73
81
  },
@@ -83,23 +91,26 @@
83
91
  "url": "git+https://github.com/blocklet/pages-kit.git"
84
92
  },
85
93
  "dependencies": {
86
- "@blocklet/sdk": "^1.16.38",
87
- "@blocklet/ui-react": "^2.11.37",
94
+ "@blocklet/sdk": "^1.16.39",
95
+ "@blocklet/ui-react": "^2.12.1",
88
96
  "@mdx-js/react": "^3.1.0",
89
97
  "@mui/material": "^5.16.7",
90
98
  "ahooks": "^3.8.4",
91
99
  "axios": "^1.7.4",
92
100
  "chalk": "^4.1.2",
101
+ "copyfiles": "^2.4.1",
93
102
  "esbuild": "^0.19.12",
94
103
  "express": "^4.19.2",
95
104
  "glob": "^11.0.0",
96
105
  "gogocode": "^1.0.55",
97
106
  "lodash": "^4.17.21",
107
+ "nanoid": "^3.3.7",
98
108
  "react": "^18.3.1",
99
109
  "react-dom": "^18.3.1",
100
110
  "react-router-dom": "^6.26.1",
101
111
  "typescript": "^5.7.2",
102
112
  "ufo": "^1.5.4",
113
+ "vite": "^5.4.11",
103
114
  "vite-plugin-react-pages": "^5.0.0",
104
115
  "yaml": "^2.5.0"
105
116
  },
@@ -123,11 +134,12 @@
123
134
  "scripts": {
124
135
  "lint": "eslint src --ext .mjs,.js,.jsx,.ts,.tsx",
125
136
  "lint:fix": "npm run lint -- --fix",
126
- "build": "run-p build:*",
137
+ "build": "run-p build:* && npm run copy-templates",
127
138
  "build:cjs": "tsc --module commonjs --outDir lib/cjs",
128
139
  "build:esm": "tsc --module es2022 --outDir lib/esm",
129
140
  "build:types": "tsc --declaration --emitDeclarationOnly --outDir lib/types",
130
141
  "dev": "run-p 'build:* -- -w'",
131
- "clean": "rimraf lib"
142
+ "clean": "rimraf lib",
143
+ "copy-templates": "copyfiles -u 1 \"src/constants/new-block-template/**/*\" lib/cjs/ && copyfiles -u 1 \"src/constants/new-block-template/**/*\" lib/esm/"
132
144
  }
133
145
  }
package/tsconfig.json CHANGED
@@ -9,5 +9,7 @@
9
9
  // "@blocklet/ai-runtime/*": ["../../../ai-studio/packages/ai-runtime/src/*"]
10
10
  // "@blocklet/ai-kit/*": ["../../../ai-kit/packages/ai-kit/src/*"]
11
11
  }
12
- }
12
+ },
13
+ "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.json", "src/**/*.mjs", "src/**/*.js", "src/**/*.jsx"],
14
+ "exclude": []
13
15
  }