cayo 1.2.1 → 1.3.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.
- package/dist/cayo.svelte.js +21 -5
- package/dist/entry.svelte.js +1 -1
- package/lib/core/bundle.js +7 -1
- package/lib/core/codegen.js +7 -1
- package/lib/core/render/prerender.js +2 -2
- package/package.json +2 -1
- package/src/cayo.svelte +3 -1
- package/template/package.json +1 -1
- package/template/src/__template.svelte +0 -1
- package/template/package-lock.json +0 -4027
package/dist/cayo.svelte.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { create_ssr_component, compute_rest_props,
|
|
1
|
+
import { create_ssr_component, compute_rest_props, spread, escape_object, escape_attribute_value } from 'svelte/internal';
|
|
2
2
|
|
|
3
3
|
function getWarnings(src, badProps) {
|
|
4
4
|
const warnings = {};
|
|
@@ -38,11 +38,12 @@ function checkBadProps(warnings, src, keys) {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
/* src/cayo.svelte generated by Svelte v3.
|
|
41
|
+
/* src/cayo.svelte generated by Svelte v3.59.2 */
|
|
42
42
|
|
|
43
43
|
const Cayo = create_ssr_component(($$result, $$props, $$bindings, slots) => {
|
|
44
|
-
let $$restProps = compute_rest_props($$props, ["src"]);
|
|
44
|
+
let $$restProps = compute_rest_props($$props, ["src","attributes"]);
|
|
45
45
|
let { src } = $$props;
|
|
46
|
+
let { attributes } = $$props;
|
|
46
47
|
|
|
47
48
|
// Save unserializable prop keys (during stringification)
|
|
48
49
|
// so we can report them later
|
|
@@ -74,8 +75,23 @@ const Cayo = create_ssr_component(($$result, $$props, $$bindings, slots) => {
|
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
if ($$props.src === void 0 && $$bindings.src && src !== void 0) $$bindings.src(src);
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
if ($$props.attributes === void 0 && $$bindings.attributes && attributes !== void 0) $$bindings.attributes(attributes);
|
|
79
|
+
|
|
80
|
+
return `<div${spread(
|
|
81
|
+
[
|
|
82
|
+
escape_object(attributes),
|
|
83
|
+
{
|
|
84
|
+
"data-cayo-id": escape_attribute_value(cayoInstanceData['data-cayo-id'])
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"data-cayo-src": escape_attribute_value(cayoInstanceData['data-cayo-src'])
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"data-cayo-warn": escape_attribute_value(cayoInstanceData['data-cayo-warn'])
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
{}
|
|
94
|
+
)}>
|
|
79
95
|
${`<script data-cayo-props type="application/json">${props}</script>`}
|
|
80
96
|
${slots.default ? slots.default({}) : ``}
|
|
81
97
|
</div>`;
|
package/dist/entry.svelte.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { create_ssr_component, add_attribute } from 'svelte/internal';
|
|
2
2
|
|
|
3
|
-
/* src/entry.svelte generated by Svelte v3.
|
|
3
|
+
/* src/entry.svelte generated by Svelte v3.59.2 */
|
|
4
4
|
|
|
5
5
|
const Entry = create_ssr_component(($$result, $$props, $$bindings, slots) => {
|
|
6
6
|
let { src } = $$props;
|
package/lib/core/bundle.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs, { pathExists } from 'fs-extra';
|
|
2
2
|
import { rollup } from 'rollup';
|
|
3
3
|
import svelte from 'rollup-plugin-svelte';
|
|
4
|
+
import resolve from '@rollup/plugin-node-resolve';
|
|
4
5
|
import css from 'rollup-plugin-import-css';
|
|
5
6
|
import json from '@rollup/plugin-json';
|
|
6
7
|
|
|
@@ -36,9 +37,14 @@ export async function getDeps(input, config) {
|
|
|
36
37
|
...preprocessors,
|
|
37
38
|
],
|
|
38
39
|
}),
|
|
40
|
+
resolve({
|
|
41
|
+
browser: true,
|
|
42
|
+
exportConditions: ['svelte'],
|
|
43
|
+
extensions: ['.svelte']
|
|
44
|
+
}),
|
|
39
45
|
...defaultRollupPlugins(),
|
|
40
46
|
...userRollupPlugins(config),
|
|
41
|
-
]
|
|
47
|
+
],
|
|
42
48
|
}
|
|
43
49
|
try {
|
|
44
50
|
// Create a bundle
|
package/lib/core/codegen.js
CHANGED
|
@@ -7,7 +7,6 @@ export function generateGetProps() {
|
|
|
7
7
|
`
|
|
8
8
|
function getProps(cayoElement) {
|
|
9
9
|
const json = cayoElement.querySelector('[data-cayo-props]').innerHTML;
|
|
10
|
-
console.log('json', json);
|
|
11
10
|
return JSON.parse(json);
|
|
12
11
|
}
|
|
13
12
|
`
|
|
@@ -75,12 +74,19 @@ export function generateComponentInstance(cayoId, componentName) {
|
|
|
75
74
|
return (
|
|
76
75
|
`
|
|
77
76
|
cayos['${cayoId}'] = {};
|
|
77
|
+
cayos['${cayoId}'].id = '${cayoId}';
|
|
78
78
|
cayos['${cayoId}'].target = document.querySelector('[data-cayo-id="${cayoId}"]');
|
|
79
79
|
cayos['${cayoId}'].instance = new ${componentName}({
|
|
80
80
|
target: target(cayos['${cayoId}'].target),
|
|
81
81
|
hydrate: true,
|
|
82
82
|
props: getProps(cayos['${cayoId}'].target),
|
|
83
83
|
});
|
|
84
|
+
cayos['${cayoId}'].event = new CustomEvent('cayo:init', {
|
|
85
|
+
detail: {
|
|
86
|
+
cayo: cayos['${cayoId}'],
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
document.dispatchEvent(cayos['${cayoId}'].event);
|
|
84
90
|
`
|
|
85
91
|
);
|
|
86
92
|
}
|
|
@@ -248,12 +248,12 @@ export async function processPage(content, page, _cayo, logger) {
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
function tagsExist(source) {
|
|
251
|
-
const doctype = source.match(
|
|
251
|
+
const doctype = source.match(/(?<doctype><!DOCTYPE[\s\S]*?>)/);
|
|
252
252
|
const head = source.match(/<head[\s\S]*>(?<innerHTML>[\s\S]*)<\/head>/);
|
|
253
253
|
const body = source.match(/<body[\s\S]*>(?<innerHTML>[\s\S]*)<\/body>/);
|
|
254
254
|
const html = source.match(/<html[\s\S]*>(?<innerHTML>[\s\S]*)<\/html>/);
|
|
255
255
|
return {
|
|
256
|
-
doctype: doctype === null ? false : doctype,
|
|
256
|
+
doctype: doctype === null ? false : doctype.groups.doctype,
|
|
257
257
|
html: html === null ? false : html.groups,
|
|
258
258
|
head: head === null ? false : head.groups,
|
|
259
259
|
body: body === null ? false : body.groups,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cayo",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "node cayo dev --projectRoot test",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"homepage": "https://github.com/matthew-ia/cayo#readme",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@rollup/plugin-json": "^4.1.0",
|
|
34
|
+
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
34
35
|
"chalk": "^2.4.2",
|
|
35
36
|
"chokidar": "^3.5.2",
|
|
36
37
|
"deepmerge": "^4.2.2",
|
package/src/cayo.svelte
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
export let src;
|
|
3
2
|
import { getWarnings } from './cayo-warnings.js';
|
|
3
|
+
export let src;
|
|
4
|
+
export let attributes;
|
|
4
5
|
|
|
5
6
|
// Save unserializable prop keys (during stringification)
|
|
6
7
|
// so we can report them later
|
|
@@ -31,6 +32,7 @@
|
|
|
31
32
|
</script>
|
|
32
33
|
|
|
33
34
|
<div
|
|
35
|
+
{...attributes}
|
|
34
36
|
data-cayo-id={cayoInstanceData['data-cayo-id']}
|
|
35
37
|
data-cayo-src={cayoInstanceData['data-cayo-src']}
|
|
36
38
|
data-cayo-warn={cayoInstanceData['data-cayo-warn']}
|
package/template/package.json
CHANGED