oc-template-vue-compiler 0.5.6 → 0.6.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.
@@ -0,0 +1,7 @@
1
+ import plugin from '@vitejs/plugin-vue';
2
+ export declare const appBlock: ({ name, version, entry }: {
3
+ name: string;
4
+ version: string;
5
+ entry: string;
6
+ }) => string;
7
+ export { plugin };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.plugin = exports.appBlock = void 0;
7
+ const plugin_vue_1 = __importDefault(require("@vitejs/plugin-vue"));
8
+ exports.plugin = plugin_vue_1.default;
9
+ const appBlock = ({ name, version, entry }) => `
10
+ <div id="root"></div>
11
+ <script type="module">
12
+ const data = __INITIAL_DATA__;
13
+ window.__$$oc_initialData__ = Object.freeze(data);
14
+ const settings = Object.freeze({ baseUrl: '/', id: 'root', name: '${name}', staticPath: '/', version: '${version}' });
15
+ window.__$$oc_Settings__ = settings;
16
+
17
+ window.oc = window.oc || {};
18
+ window.oc.cmd = window.oc.cmd || [];
19
+
20
+ import App from "${entry}";
21
+ import { createApp } from 'vue';
22
+
23
+ const container = document.getElementById('root');
24
+ const app = createApp(App, data);
25
+
26
+ window.oc.cmd.push(() => {
27
+ app.mount(container);
28
+ window.oc.events.fire('oc:rendered', { ...settings, element: container, });
29
+ });
30
+ </script>
31
+ `;
32
+ exports.appBlock = appBlock;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oc-template-vue-compiler",
3
- "version": "0.5.6",
3
+ "version": "0.6.0",
4
4
  "description": "Compiler for the vueJS OC template",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -33,8 +33,8 @@
33
33
  "@types/testing-library__jest-dom": "^5.14.5",
34
34
  "@vitejs/plugin-vue": "^5.0.0",
35
35
  "jsdom": "^21.1.1",
36
- "oc-server": "^1.1.3",
37
- "oc-template-vue-compiler": "^0.5.5",
36
+ "oc-server": "^1.1.4",
37
+ "oc-template-vue-compiler": "^0.5.6",
38
38
  "typescript": "5.0.2",
39
39
  "vitest": "^0.29.7",
40
40
  "vue": "^3.3.11",