@joist/plugin-vite 4.0.0-next.13

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/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@joist/plugin-vite",
3
+ "version": "4.0.0-next.13",
4
+ "type": "module",
5
+ "main": "./target/lib.js",
6
+ "module": "./target/lib.js",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./target/lib.js"
10
+ }
11
+ },
12
+ "files": [
13
+ "src",
14
+ "target"
15
+ ],
16
+ "sideEffects": false,
17
+ "description": "server side render shadow dom (Declarative Shadow DOM)",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/deebloo/joist.git"
21
+ },
22
+ "keywords": [],
23
+ "author": "deebloo",
24
+ "license": "MIT",
25
+ "bugs": {
26
+ "url": "https://github.com/deebloo/joist/issues"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "scripts": {
32
+ "build": "wireit"
33
+ },
34
+ "wireit": {
35
+ "build": {
36
+ "command": "tsc --build --pretty",
37
+ "clean": "if-file-deleted",
38
+ "files": [
39
+ "src/**",
40
+ "tsconfig.json"
41
+ ],
42
+ "output": [
43
+ "target/**",
44
+ "tsconfig.tsbuildinfo"
45
+ ],
46
+ "dependencies": [
47
+ "../ssr:build"
48
+ ]
49
+ },
50
+ "test": {
51
+ "command": "mocha target/**/*.test.js",
52
+ "files": [
53
+ "target/**"
54
+ ],
55
+ "output": [],
56
+ "dependencies": [
57
+ "build"
58
+ ]
59
+ }
60
+ },
61
+ "devDependencies": {
62
+ "vite": "^5.4.8"
63
+ }
64
+ }
package/src/lib.ts ADDED
@@ -0,0 +1,26 @@
1
+ import { Applicator } from '@joist/ssr';
2
+ import { PluginOption } from 'vite';
3
+
4
+ function plugin(applicator: Applicator): PluginOption {
5
+ return {
6
+ name: 'Joist',
7
+ transformIndexHtml: {
8
+ order: 'pre',
9
+ handler(html) {
10
+ return applicator.apply(html, ['joist-header', 'joist-nav', 'joist-main']);
11
+ }
12
+ },
13
+ handleHotUpdate({ file, server }) {
14
+ if (file.includes('elements') && (file.endsWith('.html') || file.endsWith('.css'))) {
15
+ console.log(`${file} updated...`);
16
+
17
+ server.ws.send({
18
+ type: 'full-reload',
19
+ path: '*'
20
+ });
21
+ }
22
+ }
23
+ };
24
+ }
25
+
26
+ export default plugin;
@@ -0,0 +1,4 @@
1
+ import { Applicator } from '@joist/ssr';
2
+ import { PluginOption } from 'vite';
3
+ declare function plugin(applicator: Applicator): PluginOption;
4
+ export default plugin;
package/target/lib.js ADDED
@@ -0,0 +1,22 @@
1
+ function plugin(applicator) {
2
+ return {
3
+ name: 'Joist',
4
+ transformIndexHtml: {
5
+ order: 'pre',
6
+ handler(html) {
7
+ return applicator.apply(html, ['joist-header', 'joist-nav', 'joist-main']);
8
+ }
9
+ },
10
+ handleHotUpdate({ file, server }) {
11
+ if (file.includes('elements') && (file.endsWith('.html') || file.endsWith('.css'))) {
12
+ console.log(`${file} updated...`);
13
+ server.ws.send({
14
+ type: 'full-reload',
15
+ path: '*'
16
+ });
17
+ }
18
+ }
19
+ };
20
+ }
21
+ export default plugin;
22
+ //# sourceMappingURL=lib.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lib.js","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAGA,SAAS,MAAM,CAAC,UAAsB;IACpC,OAAO;QACL,IAAI,EAAE,OAAO;QACb,kBAAkB,EAAE;YAClB,KAAK,EAAE,KAAK;YACZ,OAAO,CAAC,IAAI;gBACV,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,cAAc,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC;YAC7E,CAAC;SACF;QACD,eAAe,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;YAC9B,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;gBACnF,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,aAAa,CAAC,CAAC;gBAElC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC;oBACb,IAAI,EAAE,aAAa;oBACnB,IAAI,EAAE,GAAG;iBACV,CAAC,CAAC;YACL,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAED,eAAe,MAAM,CAAC"}