@ws-ui/vite-plugins 1.8.2 → 1.8.3

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/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  import importMetaUrlPlugin from './esbuild-plugin-import-meta-url';
2
2
  import monacoEditorPlugin from './vite-plugin-monaco-editor';
3
- import standaloneEditorPlugin from './standalone-editor-plugin';
4
- export { importMetaUrlPlugin, monacoEditorPlugin, standaloneEditorPlugin };
3
+ export { importMetaUrlPlugin, monacoEditorPlugin };
package/dist/index.js CHANGED
@@ -1,4 +1,3 @@
1
1
  import importMetaUrlPlugin from './esbuild-plugin-import-meta-url';
2
2
  import monacoEditorPlugin from './vite-plugin-monaco-editor';
3
- import standaloneEditorPlugin from './standalone-editor-plugin';
4
- export { importMetaUrlPlugin, monacoEditorPlugin, standaloneEditorPlugin };
3
+ export { importMetaUrlPlugin, monacoEditorPlugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ws-ui/vite-plugins",
3
- "version": "1.8.2",
3
+ "version": "1.8.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -1,2 +0,0 @@
1
- import { PluginOption } from 'vite';
2
- export default function standaloneEditorPlugin(): PluginOption;
@@ -1,56 +0,0 @@
1
- import * as fs from 'fs';
2
- export default function standaloneEditorPlugin() {
3
- let config;
4
- let cssContent = '';
5
- const name = 'standaline-editor-plugin';
6
- const standaloneCssPath = '@ws-ui/webform-editor/dist/standalone.css';
7
- return {
8
- name,
9
- // Get the final configuration, including the resolved root
10
- configResolved(resolvedConfig) {
11
- config = resolvedConfig;
12
- },
13
- // Use the buildStart hook to read the file content once.
14
- // This hook runs after configResolved, but before the dev server starts transforming HTML.
15
- async buildStart() {
16
- // Only execute this logic in development mode ('serve')
17
- if (config.command !== 'serve') {
18
- return;
19
- }
20
- // Vite uses bare imports like this by default, so we can try to resolve it
21
- try {
22
- // Resolve the bare module specifier to its real file system path
23
- // We use the same resolution logic Vite uses for modules
24
- const resolved = await config.createResolver({ asSrc: false })(standaloneCssPath);
25
- if (resolved && fs.existsSync(resolved)) {
26
- // Read the content of the CSS file
27
- cssContent = fs.readFileSync(resolved, 'utf-8');
28
- console.log(`[${name}] Successfully read CSS content from: ${resolved}`);
29
- }
30
- else {
31
- console.error(`[${name}] Could not resolve or find the CSS file: ${standaloneCssPath}`);
32
- }
33
- }
34
- catch (e) {
35
- console.error(`[${name}] Error reading CSS file:`, e);
36
- }
37
- },
38
- // Inject the content into the HTML
39
- transformIndexHtml(html, ctx) {
40
- // Check if we are in dev mode and have content to inject
41
- if (ctx.server && cssContent) {
42
- return [
43
- {
44
- tag: 'style',
45
- attrs: {
46
- type: 'text/css',
47
- },
48
- children: cssContent,
49
- injectTo: 'head-prepend',
50
- },
51
- ];
52
- }
53
- return html;
54
- },
55
- };
56
- }