svelte-on-rails 0.0.41 → 0.0.43
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.
- checksums.yaml +4 -4
- data/README.md +18 -58
- data/lib/generators/svelte_on_rails/install/install_generator.rb +25 -18
- data/lib/svelte-on-rails.rb +0 -1
- data/lib/svelte_on_rails/configuration.rb +42 -5
- data/lib/svelte_on_rails/installer/hello_world.rb +5 -1
- data/lib/svelte_on_rails/installer/npm.rb +1 -1
- data/lib/svelte_on_rails/lib/development_utils.rb +24 -11
- data/lib/svelte_on_rails/lib/utils.rb +37 -1
- data/lib/svelte_on_rails/renderer/renderer.rb +6 -1
- data/lib/svelte_on_rails/renderer/utils.js +2 -1
- data/lib/svelte_on_rails/view_helpers.rb +1 -3
- data/lib/tasks/svelte_on_rails_tasks.rake +25 -31
- data/templates/config_base/app/frontend/ssr/ssr.js +4 -0
- data/templates/config_base/vite-ssr.config.ts +133 -0
- data/templates/rails_vite_hello_world/app/frontend/images/svelte-on-rails-hello-world-england.png +0 -0
- data/templates/rails_vite_hello_world/app/frontend/images/svelte-on-rails-hello-world-face-smile-wink.svg +1 -0
- data/templates/rails_vite_hello_world/app/frontend/images/svelte-on-rails-hello-world-switzerland.jpg +0 -0
- data/templates/rails_vite_hello_world/app/frontend/javascript/components/JavascriptImport.svelte +7 -0
- data/templates/rails_vite_hello_world/app/frontend/javascript/components/JpgImport.svelte +7 -0
- data/templates/rails_vite_hello_world/app/frontend/javascript/components/ParentWithChild.svelte +6 -0
- data/templates/rails_vite_hello_world/app/frontend/javascript/components/PngImport.svelte +7 -0
- data/templates/rails_vite_hello_world/app/frontend/javascript/components/SvelteOnRailsHelloWorld.svelte +2 -6
- data/templates/rails_vite_hello_world/app/frontend/javascript/components/SvgRawImport.svelte +7 -0
- data/templates/rails_vite_hello_world/app/frontend/javascript/components/sub/NestedComponent.svelte +1 -1
- data/templates/rails_vite_hello_world/app/frontend/javascript/nestedJavascript.js +4 -1
- data/templates/rails_vite_hello_world/app/views/svelte_on_rails_hello_world/_nav.html.erb +11 -0
- data/templates/rails_vite_hello_world/app/views/svelte_on_rails_hello_world/_styles.html.erb +16 -0
- data/templates/rails_vite_hello_world/app/views/svelte_on_rails_hello_world/backend_frontend_rendered.html.erb +37 -0
- data/templates/rails_vite_hello_world/app/views/svelte_on_rails_hello_world/index.html.erb +8 -4
- data/templates/rails_vite_hello_world/app/views/svelte_on_rails_hello_world/ssr_auto_rendered.html.erb +26 -0
- metadata +17 -10
- data/lib/svelte_on_rails/compiler/compile.js +0 -123
- data/lib/svelte_on_rails/compiler/compiler.rb +0 -120
- data/lib/svelte_on_rails/compiler/customPlugins.js +0 -60
- data/templates/rails_vite_hello_world/app/frontend/images/atom.svg +0 -1
- data/templates/rails_vite_hello_world/app/frontend/images/check-circle-green.png +0 -0
- data/templates/rails_vite_hello_world/app/frontend/images/svg.svg +0 -3
- data/templates/rails_vite_hello_world/app/frontend/javascript/components/Pug.svelte +0 -14
- /data/templates/{svelte_on_rails_vite_base → config_base}/app/frontend/initializers/svelte.js +0 -0
- /data/templates/{svelte_on_rails_vite_base → config_base}/config/svelte_on_rails.yml +0 -0
@@ -1,60 +0,0 @@
|
|
1
|
-
import path from 'path';
|
2
|
-
import fs from 'fs/promises';
|
3
|
-
|
4
|
-
// Plugin for raw imports
|
5
|
-
export function rawResolver() {
|
6
|
-
return {
|
7
|
-
name: 'raw-resolver',
|
8
|
-
resolveId(source, importer) {
|
9
|
-
console.log(`Raw-Resolver: source=${source}, importer=${importer}`);
|
10
|
-
if (source.endsWith('?raw')) {
|
11
|
-
const actualSource = source.replace('?raw', '');
|
12
|
-
const resolved = path.resolve(path.dirname(importer), actualSource);
|
13
|
-
console.log(`Raw-Resolver: Resolving ${source} to ${resolved}?raw`);
|
14
|
-
return `${resolved}?raw`;
|
15
|
-
}
|
16
|
-
return null;
|
17
|
-
},
|
18
|
-
};
|
19
|
-
}
|
20
|
-
|
21
|
-
export function stringPlugin() {
|
22
|
-
return {
|
23
|
-
name: 'string',
|
24
|
-
async load(id) {
|
25
|
-
if (id.endsWith('?raw')) {
|
26
|
-
console.log(`String-Plugin: Loading ${id}`);
|
27
|
-
const actualId = id.replace('?raw', '');
|
28
|
-
try {
|
29
|
-
const content = await fs.readFile(actualId, 'utf-8');
|
30
|
-
console.log(`String-Plugin: Content of ${actualId} loaded (excerpt): ${content.substring(0, 50)}...`);
|
31
|
-
return `export default ${JSON.stringify(content)};`;
|
32
|
-
} catch (error) {
|
33
|
-
console.error(`String-Plugin: Error loading ${actualId}:`, error);
|
34
|
-
throw error;
|
35
|
-
}
|
36
|
-
}
|
37
|
-
return null;
|
38
|
-
},
|
39
|
-
};
|
40
|
-
}
|
41
|
-
|
42
|
-
// Plugin to ignore browser-specific modules during SSR
|
43
|
-
export function ssrExternals() {
|
44
|
-
return {
|
45
|
-
name: 'ssr-externals',
|
46
|
-
resolveId(source) {
|
47
|
-
// Ignore modules like axios during SSR
|
48
|
-
if (source === 'axios' || source.includes('form-data')) {
|
49
|
-
return { id: 'void 0', external: true };
|
50
|
-
}
|
51
|
-
return null;
|
52
|
-
},
|
53
|
-
load(id) {
|
54
|
-
if (id === 'void 0') {
|
55
|
-
return 'export default null;';
|
56
|
-
}
|
57
|
-
return null;
|
58
|
-
}
|
59
|
-
};
|
60
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M256 224C238.3 224 223.1 238.4 223.1 256S238.3 288 256 288c17.62 0 32-14.38 32-32C287.9 238.4 273.6 224 256 224zM471.2 128c-15.62-27.75-49.62-41.38-93.11-41.38c-9.499 .125-18.87 .75-28.25 2C327.1 34.38 293.5 0 256 0S184.9 34.38 162.1 88.62c-9.374-1.25-18.75-1.875-28.25-2C90.39 86.62 56.4 100.2 40.78 128c-18.75 33.5-6.499 80.62 27.62 128c-34.12 47.38-46.37 94.5-27.62 128c15.62 27.75 49.62 41.38 93.11 41.38c9.499-.125 18.87-.75 28.25-2C184.9 477.6 218.5 512 256 512s71.12-34.38 93.86-88.63c9.374 1.25 18.75 1.875 28.25 2c43.49 0 77.49-13.62 93.11-41.38c18.75-33.5 6.499-80.63-27.62-128C477.7 208.6 489.1 161.5 471.2 128zM256 48c14.37 0 32.12 18.12 47.12 50C287.1 102.4 271.4 107.8 256 114.1c-15.37-6.375-31.12-11.76-47.12-16.14C223.9 66.12 241.6 48 256 48zM133.9 377.4c-26.5 0-46.74-6.625-52.74-17.38c-7.124-12.75-.5-37.63 18.62-66.63C111.4 305.2 123.8 316.5 136.8 327c2.25 16.5 5.374 33 9.624 49.13C142.3 376.4 137.9 377.4 133.9 377.4zM136.8 185C123.8 195.5 111.4 206.8 99.77 218.6C80.65 189.6 74.02 164.8 81.15 152c5.999-10.75 26.25-17.38 52.74-17.38c3.1 0 8.374 1 12.5 1.25C142.1 152 139 168.5 136.8 185zM256 464c-14.37 0-32.12-18.12-47.12-49.1C224.9 409.6 240.6 404.2 256 397.9c15.37 6.375 31.12 11.76 47.12 16.14C288.1 445.9 270.4 464 256 464zM256 352c-52.99 0-95.99-43-95.99-96S203 160 256 160s95.99 43 95.99 96S308.1 352 256 352zM430.9 360c-5.999 10.75-26.25 17.38-52.74 17.38c-3.1 0-8.374-1-12.5-1.25C369.9 360 372.1 343.5 375.2 327c12.1-10.5 25.37-21.75 36.1-33.63C431.4 322.4 437.1 347.2 430.9 360zM412.2 218.6C400.6 206.8 388.2 195.5 375.2 185C372.1 168.5 369.9 152 365.6 135.9c4.125-.25 8.499-1.25 12.5-1.25c26.5 0 46.74 6.625 52.74 17.38C437.1 164.8 431.4 189.6 412.2 218.6z"/></svg>
|
Binary file
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<script>
|
2
|
-
export let notice
|
3
|
-
let ary = ['item-1', 'item-2', 'item-3']
|
4
|
-
</script>
|
5
|
-
|
6
|
-
<template lang="pug">
|
7
|
-
h1 Hello, Pug!
|
8
|
-
p {notice}
|
9
|
-
ul
|
10
|
-
<!-- The | Syntax is a workaround for situations where pug integration in svelte is not working really well-->
|
11
|
-
| {#each ary as item}
|
12
|
-
| <li>{item}</li>
|
13
|
-
| {/each}
|
14
|
-
</template>
|
/data/templates/{svelte_on_rails_vite_base → config_base}/app/frontend/initializers/svelte.js
RENAMED
File without changes
|
File without changes
|