@primate/svelte 0.16.0 → 0.18.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/LICENSE +19 -0
- package/package.json +46 -9
- package/src/private/build/client.js +8 -0
- package/src/private/build/index.js +14 -0
- package/src/private/build/publish.js +40 -0
- package/src/private/build/server.js +6 -0
- package/src/private/client/create-root.js +31 -0
- package/src/private/client/expose.js +1 -0
- package/src/private/client/index.js +18 -0
- package/src/private/client/spa.js +19 -0
- package/src/private/context-name.js +1 -0
- package/src/private/extension.js +1 -0
- package/src/private/i18n/index.js +10 -0
- package/src/private/i18n/locale.js +19 -0
- package/src/private/name.js +1 -0
- package/src/private/pkgname.js +1 -0
- package/src/private/serve/index.js +16 -0
- package/src/private/serve/render.js +4 -0
- package/src/public/context-name.js +1 -0
- package/src/public/default.js +14 -0
- package/src/public/i18n.js +1 -0
- package/src/public/locale.js +1 -0
- package/src/public/runtime.js +12 -0
- package/README.md +0 -5
- package/src/client/client.js +0 -14
- package/src/client/create-root.js +0 -25
- package/src/client/exports.js +0 -3
- package/src/client/liveview.js +0 -16
- package/src/client/rootname.js +0 -1
- package/src/errors.js +0 -6
- package/src/errors.json +0 -10
- package/src/exports.js +0 -1
- package/src/module.js +0 -104
package/LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) Terrablue <terrablue@proton.me> and contributors.
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
|
11
|
+
all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
16
|
+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
THE SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primate/svelte",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Primate Svelte
|
|
3
|
+
"version": "0.18.0",
|
|
4
|
+
"description": "Primate Svelte frontend",
|
|
5
5
|
"homepage": "https://primatejs.com/modules/svelte",
|
|
6
6
|
"bugs": "https://github.com/primatejs/primate/issues",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"files": [
|
|
9
9
|
"src/**/*.js",
|
|
10
|
-
"src/errors.json",
|
|
11
10
|
"!src/**/*.spec.js"
|
|
12
11
|
],
|
|
13
12
|
"repository": {
|
|
@@ -16,13 +15,51 @@
|
|
|
16
15
|
"directory": "packages/svelte"
|
|
17
16
|
},
|
|
18
17
|
"dependencies": {
|
|
19
|
-
"@
|
|
20
|
-
"
|
|
21
|
-
"svelte": "^4.2.0"
|
|
18
|
+
"@rcompat/fs": "^0.4.0",
|
|
19
|
+
"@primate/frontend": "^0.16.0"
|
|
22
20
|
},
|
|
23
21
|
"peerDependencies": {
|
|
24
|
-
"
|
|
22
|
+
"svelte": "4",
|
|
23
|
+
"@primate/i18n": "^0.8.0",
|
|
24
|
+
"primate": "^0.32.0"
|
|
25
|
+
},
|
|
26
|
+
"peerDependenciesMeta": {
|
|
27
|
+
"@primate/i18n": {
|
|
28
|
+
"optional": true
|
|
29
|
+
}
|
|
25
30
|
},
|
|
26
31
|
"type": "module",
|
|
27
|
-
"
|
|
28
|
-
|
|
32
|
+
"imports": {
|
|
33
|
+
"#*": {
|
|
34
|
+
"@primate/lt": "./src/private/*.js",
|
|
35
|
+
"default": "./src/private/*.js"
|
|
36
|
+
},
|
|
37
|
+
"#build": {
|
|
38
|
+
"@primate/lt": "./src/private/build/index.js",
|
|
39
|
+
"default": "./src/private/build/index.js"
|
|
40
|
+
},
|
|
41
|
+
"#serve": {
|
|
42
|
+
"@primate/lt": "./src/private/serve/index.js",
|
|
43
|
+
"default": "./src/private/serve/index.js"
|
|
44
|
+
},
|
|
45
|
+
"#client": {
|
|
46
|
+
"@primate/lt": "./src/private/client/index.js",
|
|
47
|
+
"default": "./src/private/client/index.js"
|
|
48
|
+
},
|
|
49
|
+
"#client/*": {
|
|
50
|
+
"@primate/lt": "./src/private/client/*.js",
|
|
51
|
+
"default": "./src/private/client/*.js"
|
|
52
|
+
},
|
|
53
|
+
"#i18n/*": {
|
|
54
|
+
"@primate/lt": "./src/private/i18n/*.js",
|
|
55
|
+
"default": "./src/private/i18n/*.js"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"exports": {
|
|
59
|
+
".": {
|
|
60
|
+
"runtime": "./src/public/runtime.js",
|
|
61
|
+
"default": "./src/public/default.js"
|
|
62
|
+
},
|
|
63
|
+
"./*": "./src/public/*.js"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import create_root from "#client/create-root";
|
|
2
|
+
import expose from "#client/expose";
|
|
3
|
+
import name from "#name";
|
|
4
|
+
import build from "@primate/frontend/core/build";
|
|
5
|
+
import client from "./client.js";
|
|
6
|
+
import publish from "./publish.js";
|
|
7
|
+
import server from "./server.js";
|
|
8
|
+
|
|
9
|
+
export default extension => build({
|
|
10
|
+
create_root,
|
|
11
|
+
extension,
|
|
12
|
+
name,
|
|
13
|
+
actions: { compile: { client, server }, expose, publish },
|
|
14
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import file from "@rcompat/fs/file";
|
|
2
|
+
import webpath from "@rcompat/fs/webpath";
|
|
3
|
+
import client from "./client.js";
|
|
4
|
+
|
|
5
|
+
const css_filter = /\.sveltecss$/u;
|
|
6
|
+
const root_filter = /^root:svelte$/u;
|
|
7
|
+
|
|
8
|
+
export default (app, extension) => ({
|
|
9
|
+
name: "svelte",
|
|
10
|
+
setup(build) {
|
|
11
|
+
build.onResolve({ filter: css_filter }, ({ path }) => {
|
|
12
|
+
return { path, namespace: "sveltecss" };
|
|
13
|
+
});
|
|
14
|
+
build.onResolve({ filter: root_filter }, ({ path }) => {
|
|
15
|
+
return { path, namespace: "svelteroot" };
|
|
16
|
+
});
|
|
17
|
+
build.onLoad({ filter: css_filter }, ({ path }) => {
|
|
18
|
+
const contents = app.build.load(webpath(path));
|
|
19
|
+
return contents ? { contents, loader: "css", resolveDir: app.root.path } : null;
|
|
20
|
+
});
|
|
21
|
+
build.onLoad({ filter: root_filter }, ({ path }) => {
|
|
22
|
+
const contents = app.build.load(path);
|
|
23
|
+
return contents ? { contents, loader: "js", resolveDir: app.root.path } : null;
|
|
24
|
+
});
|
|
25
|
+
build.onLoad({ filter: new RegExp(`${extension}$`, "u") }, async args => {
|
|
26
|
+
// Load the file from the file system
|
|
27
|
+
const source = await file(args.path).text();
|
|
28
|
+
|
|
29
|
+
// Convert Svelte syntax to JavaScript
|
|
30
|
+
const { js, css } = client(source);
|
|
31
|
+
let contents = js;
|
|
32
|
+
if (css !== null && css !== "") {
|
|
33
|
+
const path = File.webpath(`${args.path}css`);
|
|
34
|
+
app.build.save(path, css);
|
|
35
|
+
contents += `\nimport "${path}";`;
|
|
36
|
+
}
|
|
37
|
+
return { contents };
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export default length => {
|
|
2
|
+
const n = length - 1;
|
|
3
|
+
const body = Array.from({ length: n }, (_, i) => i - 1)
|
|
4
|
+
.reduceRight((child, _, i) => `
|
|
5
|
+
{#if components[${i + 1}]}
|
|
6
|
+
<svelte:component this={components[${i}]} {request} {...data[${i}]}>
|
|
7
|
+
${child}
|
|
8
|
+
</svelte:component>
|
|
9
|
+
{:else}
|
|
10
|
+
<svelte:component this={components[${i}]} {request} {...data[${i}]}/>
|
|
11
|
+
{/if}
|
|
12
|
+
`, `<svelte:component this={components[${n}]} {request} {...data[${n}]}/>`);
|
|
13
|
+
|
|
14
|
+
return `
|
|
15
|
+
<script>
|
|
16
|
+
import { afterUpdate, setContext } from "svelte";
|
|
17
|
+
import context_name from "@primate/svelte/context-name";
|
|
18
|
+
|
|
19
|
+
export let components;
|
|
20
|
+
export let data;
|
|
21
|
+
export let request;
|
|
22
|
+
export let context;
|
|
23
|
+
export let update = () => undefined;
|
|
24
|
+
|
|
25
|
+
setContext(context_name, context);
|
|
26
|
+
|
|
27
|
+
afterUpdate(update);
|
|
28
|
+
</script>
|
|
29
|
+
${body}
|
|
30
|
+
`;
|
|
31
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default "export { setContext } from \"svelte\";";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import spa from "./spa.js";
|
|
2
|
+
|
|
3
|
+
export default ({ names, data, context, request }, options) => `
|
|
4
|
+
import * as components from "app";
|
|
5
|
+
let root = new components.root_svelte({
|
|
6
|
+
target: document.body,
|
|
7
|
+
hydrate: true,
|
|
8
|
+
props: {
|
|
9
|
+
components: [${names.map(name => `components.${name}`).join(", ")}],
|
|
10
|
+
data: ${JSON.stringify(data)},
|
|
11
|
+
context: ${JSON.stringify(context)},
|
|
12
|
+
request: {
|
|
13
|
+
...${JSON.stringify(request)},
|
|
14
|
+
url: new URL(location.href),
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
${options.spa ? spa : ""}`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default `
|
|
2
|
+
const { spa } = components;
|
|
3
|
+
window.addEventListener("DOMContentLoaded", _ => spa((props, update) => {
|
|
4
|
+
root.$destroy();
|
|
5
|
+
root = new components.root_svelte({
|
|
6
|
+
target: document.body,
|
|
7
|
+
hydrate: true,
|
|
8
|
+
props: {
|
|
9
|
+
components: props.names.map(name => components[name]),
|
|
10
|
+
data: props.data,
|
|
11
|
+
context: props.context,
|
|
12
|
+
request: {
|
|
13
|
+
...props.request,
|
|
14
|
+
url: new URL(location.href),
|
|
15
|
+
},
|
|
16
|
+
update,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
}));`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default "__PRMT__";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default ".svelte";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import context_name from "#context-name";
|
|
2
|
+
import locale_store from "#i18n/locale";
|
|
3
|
+
import resolve from "@primate/i18n/core/resolve";
|
|
4
|
+
import { getContext } from "svelte";
|
|
5
|
+
import { derived } from "svelte/store";
|
|
6
|
+
|
|
7
|
+
export default derived(locale_store, locale => (key, placeholders) => {
|
|
8
|
+
const { locales } = getContext(context_name).i18n;
|
|
9
|
+
return resolve(locales[locale], key, placeholders);
|
|
10
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import context_name from "#context-name";
|
|
2
|
+
import save from "@primate/i18n/core/save";
|
|
3
|
+
import { getContext } from "svelte";
|
|
4
|
+
import { writable } from "svelte/store";
|
|
5
|
+
|
|
6
|
+
const store = writable("", set => {
|
|
7
|
+
const { locale } = getContext(context_name).i18n;
|
|
8
|
+
set(locale);
|
|
9
|
+
|
|
10
|
+
return () => undefined;
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
subscribe: store.subscribe,
|
|
15
|
+
set: locale => {
|
|
16
|
+
store.set(locale);
|
|
17
|
+
save(locale);
|
|
18
|
+
},
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default "svelte";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default "@primate/svelte";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import client from "#client";
|
|
2
|
+
import name from "#name";
|
|
3
|
+
import handler from "@primate/frontend/core/handler";
|
|
4
|
+
import render from "./render.js";
|
|
5
|
+
|
|
6
|
+
export default (extension, spa) => (app, next) => {
|
|
7
|
+
app.register(extension, handler({
|
|
8
|
+
app,
|
|
9
|
+
render,
|
|
10
|
+
client,
|
|
11
|
+
name,
|
|
12
|
+
spa,
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
return next(app);
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "#context-name";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import build from "#build";
|
|
2
|
+
import default_extension from "#extension";
|
|
3
|
+
import pkgname from "#pkgname";
|
|
4
|
+
import serve from "#serve";
|
|
5
|
+
|
|
6
|
+
export default ({
|
|
7
|
+
extension = default_extension,
|
|
8
|
+
// activate fetch-based browsing
|
|
9
|
+
spa = true,
|
|
10
|
+
} = {}) => ({
|
|
11
|
+
name: pkgname,
|
|
12
|
+
build: build(extension),
|
|
13
|
+
serve: serve(extension, spa),
|
|
14
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "#i18n/index";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "#i18n/locale";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import default_extension from "#extension";
|
|
2
|
+
import pkgname from "#pkgname";
|
|
3
|
+
import serve from "#serve";
|
|
4
|
+
|
|
5
|
+
export default ({
|
|
6
|
+
extension = default_extension,
|
|
7
|
+
// activate fetch-based browsing
|
|
8
|
+
spa = true,
|
|
9
|
+
} = {}) => ({
|
|
10
|
+
name: pkgname,
|
|
11
|
+
serve: serve(extension, spa),
|
|
12
|
+
});
|
package/README.md
DELETED
package/src/client/client.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import rootname from "./rootname.js";
|
|
2
|
-
import liveview from "./liveview.js";
|
|
3
|
-
|
|
4
|
-
export default ({names, data}, options) => `
|
|
5
|
-
import * as components from "app";
|
|
6
|
-
let root = new components.${rootname}({
|
|
7
|
-
target: document.body,
|
|
8
|
-
hydrate: true,
|
|
9
|
-
props: {
|
|
10
|
-
components: [${names.map(name => `components.${name}`).join(", ")}],
|
|
11
|
-
data: JSON.parse(${JSON.stringify(JSON.stringify(data))}),
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
|
-
${options.liveview ? liveview : ""}`;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export default (length, data) => {
|
|
2
|
-
const n = length - 1;
|
|
3
|
-
const body = Array.from({length: n}, (_, i) => i - 1)
|
|
4
|
-
.reduceRight((child, _, i) => `
|
|
5
|
-
{#if components[${i + 1}]}
|
|
6
|
-
<svelte:component this={components[${i}]} ${data}={data[${i}]}>
|
|
7
|
-
${child}
|
|
8
|
-
</svelte:component>
|
|
9
|
-
{:else}
|
|
10
|
-
<svelte:component this={components[${i}]} ${data}={data[${i}]} />
|
|
11
|
-
{/if}
|
|
12
|
-
`, `<svelte:component this={components[${n}]} ${data}={data[${n}]} />`);
|
|
13
|
-
|
|
14
|
-
return `
|
|
15
|
-
<script>
|
|
16
|
-
import {afterUpdate} from "svelte";
|
|
17
|
-
export let components;
|
|
18
|
-
export let data;
|
|
19
|
-
export let update = () => undefined;
|
|
20
|
-
|
|
21
|
-
afterUpdate(update);
|
|
22
|
-
</script>
|
|
23
|
-
${body}
|
|
24
|
-
`;
|
|
25
|
-
};
|
package/src/client/exports.js
DELETED
package/src/client/liveview.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import rootname from "./rootname.js";
|
|
2
|
-
|
|
3
|
-
export default `
|
|
4
|
-
const {liveview} = components;
|
|
5
|
-
window.addEventListener("DOMContentLoaded", _ => liveview((props, update) => {
|
|
6
|
-
root.$destroy();
|
|
7
|
-
root = new components.${rootname}({
|
|
8
|
-
target: document.body,
|
|
9
|
-
hydrate: true,
|
|
10
|
-
props: {
|
|
11
|
-
components: props.names.map(name => components[name]),
|
|
12
|
-
data: props.data,
|
|
13
|
-
update,
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
}));`;
|
package/src/client/rootname.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default "svelte_root";
|
package/src/errors.js
DELETED
package/src/errors.json
DELETED
package/src/exports.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {default} from "./module.js";
|
package/src/module.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import {Response, Status, MediaType} from "runtime-compat/http";
|
|
2
|
-
import * as base from "@primate/frontend";
|
|
3
|
-
import * as compiler from "svelte/compiler";
|
|
4
|
-
import {client, create_root, rootname} from "./client/exports.js";
|
|
5
|
-
|
|
6
|
-
const normalize = base.normalize("svelte");
|
|
7
|
-
const type = "module";
|
|
8
|
-
|
|
9
|
-
const handler = config => (name, props = {}, {status = Status.OK, page} = {}) =>
|
|
10
|
-
async (app, {layouts = [], as_layout} = {}, request) => {
|
|
11
|
-
const {make, root} = config;
|
|
12
|
-
const options = {
|
|
13
|
-
liveview: app.liveview !== undefined,
|
|
14
|
-
};
|
|
15
|
-
const {headers} = request;
|
|
16
|
-
if (as_layout) {
|
|
17
|
-
return make(name, props);
|
|
18
|
-
}
|
|
19
|
-
const components = (await Promise.all(layouts.map(layout =>
|
|
20
|
-
layout(app, {as_layout: true}, request)
|
|
21
|
-
)))
|
|
22
|
-
/* set the actual page as the last component */
|
|
23
|
-
.concat(await make(name, props));
|
|
24
|
-
|
|
25
|
-
const data = components.map(component => component.props);
|
|
26
|
-
const names = await Promise.all(components.map(component =>
|
|
27
|
-
normalize(component.name)));
|
|
28
|
-
if (options.liveview && headers.get(app.liveview.header) !== undefined) {
|
|
29
|
-
return new Response(JSON.stringify({names, data}), {
|
|
30
|
-
status,
|
|
31
|
-
headers: {...await app.headers(),
|
|
32
|
-
"Content-Type": MediaType.APPLICATION_JSON},
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const imported = (await import(root)).default;
|
|
37
|
-
const {html: body, head} = imported.render({
|
|
38
|
-
components: components.map(({component}) => component),
|
|
39
|
-
data,
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
const code = client({names, data}, options);
|
|
43
|
-
|
|
44
|
-
await app.publish({code, type, inline: true});
|
|
45
|
-
// needs to be called before app.render
|
|
46
|
-
const headers$ = await app.headers();
|
|
47
|
-
|
|
48
|
-
return new Response(await app.render({body, page, head}), {
|
|
49
|
-
status,
|
|
50
|
-
headers: {...headers$, "Content-Type": MediaType.TEXT_HTML},
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export default ({
|
|
55
|
-
dynamicProps = "data",
|
|
56
|
-
extension = "svelte",
|
|
57
|
-
directory,
|
|
58
|
-
} = {}) => {
|
|
59
|
-
return {
|
|
60
|
-
name: "primate:svelte",
|
|
61
|
-
register(app, next) {
|
|
62
|
-
app.register(extension, handler(base.register({app, rootname})));
|
|
63
|
-
|
|
64
|
-
return next(app);
|
|
65
|
-
},
|
|
66
|
-
async compile(app, next) {
|
|
67
|
-
await base.compile({
|
|
68
|
-
app,
|
|
69
|
-
directory: directory ?? app.config.location.components,
|
|
70
|
-
extension,
|
|
71
|
-
rootname,
|
|
72
|
-
create_root,
|
|
73
|
-
dynamicProps,
|
|
74
|
-
compile(file) {
|
|
75
|
-
const options = {generate: "ssr", hydratable: true};
|
|
76
|
-
return compiler.compile(file, options).js.code;
|
|
77
|
-
},
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
return next(app);
|
|
81
|
-
},
|
|
82
|
-
async publish(app, next) {
|
|
83
|
-
// import libs
|
|
84
|
-
await app.import("svelte");
|
|
85
|
-
|
|
86
|
-
await base.publish({
|
|
87
|
-
app,
|
|
88
|
-
directory: directory ?? app.config.location.components,
|
|
89
|
-
extension,
|
|
90
|
-
rootname,
|
|
91
|
-
create_root,
|
|
92
|
-
dynamicProps,
|
|
93
|
-
normalize,
|
|
94
|
-
compile(file) {
|
|
95
|
-
const options = {generate: "dom", hydratable: true};
|
|
96
|
-
const {js, css} = compiler.compile(file, options);
|
|
97
|
-
return {js: js.code, css: css.code};
|
|
98
|
-
},
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
return next(app);
|
|
102
|
-
},
|
|
103
|
-
};
|
|
104
|
-
};
|