oc-template-solid-compiler 0.6.0 → 0.6.1

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.
@@ -10,27 +10,14 @@ const oc_template_solid_1 = require("oc-template-solid");
10
10
  const oc_vite_compiler_1 = require("oc-vite-compiler");
11
11
  const vite_plugin_solid_1 = __importDefault(require("vite-plugin-solid"));
12
12
  const solidOCProviderTemplate_1 = __importDefault(require("./solidOCProviderTemplate"));
13
- const htmlTemplate_1 = __importDefault(require("./htmlTemplate"));
14
13
  exports.compile = (0, oc_generic_template_compiler_1.createCompile)({
15
14
  compileView: (options, cb) => (0, oc_vite_compiler_1.viteView)({
16
15
  ...options,
17
16
  plugins: [(0, vite_plugin_solid_1.default)()],
18
- viewWrapper: ({ viewPath }) => (0, solidOCProviderTemplate_1.default)({ viewPath }),
19
- htmlTemplate: htmlTemplate_1.default,
17
+ viewWrapper: solidOCProviderTemplate_1.default,
20
18
  externals: (0, oc_template_solid_1.getInfo)().externals
21
19
  }, cb),
22
20
  compileServer: oc_vite_compiler_1.viteServer,
23
21
  compileStatics: oc_statics_compiler_1.default,
24
22
  getInfo: oc_template_solid_1.getInfo
25
23
  });
26
- // OPTIONS
27
- // =======
28
- // componentPath
29
- // componentPackage,
30
- // logger,
31
- // minify
32
- // ocPackage
33
- // publishPath
34
- // verbose,
35
- // watch,
36
- // production
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "oc-template-solid-compiler",
3
- "version": "0.6.0",
4
- "description": "",
3
+ "version": "0.6.1",
4
+ "description": "Compiler for the SolidJS OC template",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
@@ -30,12 +30,11 @@
30
30
  "license": "MIT",
31
31
  "dependencies": {
32
32
  "chalk": "^3.0.0",
33
- "cssesc": "^3.0.0",
34
33
  "immer": "^9.0.6",
35
34
  "oc-generic-template-compiler": "2.1.1",
36
35
  "oc-statics-compiler": "2.1.1",
37
- "oc-template-solid": "0.1.0",
38
- "oc-vite-compiler": "3.0.0",
36
+ "oc-template-solid": "^0.1.0",
37
+ "oc-vite-compiler": "^3.1.1",
39
38
  "resolve": "^1.20.0",
40
39
  "solid-js": "^1.8.7",
41
40
  "vite-plugin-solid": "^2.8.0"
@@ -1,10 +0,0 @@
1
- export default function viewTemplate({ templateId, css, bundle, hash }: {
2
- templateId: string;
3
- css: string;
4
- externals: Array<{
5
- name: string;
6
- global: string;
7
- }>;
8
- bundle: string;
9
- hash: string;
10
- }): string;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const escapeCSS = require('cssesc');
4
- function viewTemplate({ templateId, css, bundle, hash }) {
5
- return `function(model){
6
- oc.solidComponents = oc.solidComponents || {};
7
- oc.solidComponents['${hash}'] = oc.solidComponents['${hash}'] || (${bundle});
8
- if (!model) return;
9
- var modelHTML = model.__html ? model.__html : '';
10
- var staticPath = model.component.props._staticPath;
11
- var props = JSON.stringify(model.component.props);
12
- window.oc = window.oc || {};
13
- window.oc.__solidTemplate = window.oc.__solidTemplate || { count: 0 };
14
- var count = window.oc.__solidTemplate.count;
15
- var templateId = "${templateId}-" + count;
16
- window.oc.__solidTemplate.count++;
17
- return '<div id="' + templateId + '" class="${templateId}">' + modelHTML + '</div>' +
18
- '${css ? '<style>' + escapeCSS(css) + '</style>' : ''}' +
19
- '<script>' +
20
- 'window.oc = window.oc || {};' +
21
- 'oc.cmd = oc.cmd || [];' +
22
- 'oc.cmd.push(function(oc){' +
23
- '${css ? "oc.events.fire(\\'oc:cssDidMount\\', \\'" + css + "\\');" : ''}' +
24
- 'var targetNode = document.getElementById("' + templateId + '");' +
25
- 'targetNode.setAttribute("id","");' +
26
- 'oc.solidComponents["${hash}"](' + props + ', targetNode);' +
27
- '});' +
28
- '</script>'
29
- }`;
30
- }
31
- exports.default = viewTemplate;