actionview-svelte-handler 0.7.0 → 0.8.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1fcb603925b52a51a8488d83da752370c24135602c464b51993f86b58fedf1af
4
- data.tar.gz: 7f3e9f80901d4b567758e259ab37e5ed7a315459a3b1b867b9f2f847b1697b29
3
+ metadata.gz: fa87ed29fb4384fb377c10cf448128bc375891b09f4c4e5cc27e9ed61cca05f8
4
+ data.tar.gz: 29a5cc3725715e988248c8a34ff81828455ead0d654006ca9beced87a4654017
5
5
  SHA512:
6
- metadata.gz: a4260e66a28e3006940465ef5158f3bdf9cc2559327ca14ca4f4ff7c75d405bf051abc7e95de2452e5083a6ef68d51375735735340039ea4fc54ce1f0a4eb6e8
7
- data.tar.gz: 0b131aebc945768f2a7bfd0a4d16cddf80e4198a54d59dffa48a4da6b76573bfc5e439a332e5ee3c4189fc2f29bc2f5cde3e3045dc44330482244c0406a90f46
6
+ metadata.gz: ef8416ff83fcfb265e32508a18f6461d360312384c1b230717cce0913e646939d014683ee86df0e25e5ad48d51720192b084693d835b70eb9456d617058cb59d
7
+ data.tar.gz: 2c1af7eda9cfed6602c2aa7d2994efd94a535d75812a018348ec32bea9028a66474763f53bf0b0c6d249c456b6be848156dfca72b01cf8d33312eee1139139f6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- actionview-svelte-handler (0.7.0)
4
+ actionview-svelte-handler (0.8.0)
5
5
  rails (~> 7.0)
6
6
  zeitwerk (~> 2)
7
7
 
@@ -1,9 +1,9 @@
1
1
  module Svelte
2
2
  class InstallGenerator < Rails::Generators::Base
3
3
  desc "This generator installs actionview-svelte-handler"
4
-
4
+
5
5
  source_root File.expand_path("templates/install", __dir__)
6
-
6
+
7
7
  def install
8
8
  copy_file "initializer.rb", "config/initializers/svelte.rb"
9
9
  insert_into_file "app/views/layouts/application.html.erb",
@@ -13,4 +13,4 @@ module Svelte
13
13
  `npm install`
14
14
  end
15
15
  end
16
- end
16
+ end
data/lib/svelte/errors.rb CHANGED
@@ -4,44 +4,45 @@ module Svelte
4
4
  module Errors
5
5
  class CompilerError < ActiveSupport::SyntaxErrorProxy # steep:ignore UnknownConstant
6
6
  attr_accessor :location, :suggestion, :template
7
-
8
- def initialize(message, location)
9
- @location = location
10
- @sugggestion = @location.dig(:suggestion) || ""
7
+
8
+ def initialize(error)
9
+ @file = error[:id]
10
+ @line = error.dig(:start, :line)
11
+ @sugggestion = error.dig(:suggestion) || ""
11
12
  # steep:ignore:start
12
- super(message) # : self
13
+ super(error[:pluginCode]) # : self
13
14
  # steep:ignore:end
14
15
  end
15
-
16
+
16
17
  def message
17
18
  to_s
18
19
  end
19
-
20
+
20
21
  def backtrace
21
22
  if suggestion
22
- ["#{Rails.root.join location[:file]}:#{location[:line]}:#{message}, #{suggestion}"] + caller
23
+ ["#{Rails.root.join @file}:#{@line}:#{message}, #{suggestion}"] + caller
23
24
  else
24
- ["#{Rails.root.join location[:file]}:#{location[:line]}:#{message}"] + caller
25
+ ["#{Rails.root.join @file}:#{@line}:#{message}"] + caller
25
26
  end
26
27
  end
27
-
28
+
28
29
  def cause
29
30
  nil
30
31
  end
31
-
32
+
32
33
  def bindings
33
34
  [template.send(:binding)]
34
35
  end
35
-
36
+
36
37
  def backtrace_locations
37
38
  traces = backtrace.map { |trace|
38
39
  file, line = trace.match(/^(.+?):(\d+).*$/, &:captures) || trace
39
40
  ActiveSupport::SyntaxErrorProxy::BacktraceLocation.new(file, line.to_i, trace) # steep:ignore UnknownConstant
40
41
  }
41
-
42
+
42
43
  traces.map { |loc| ActiveSupport::SyntaxErrorProxy::BacktraceLocationProxy.new(loc, self) } # steep:ignore UnknownConstant
43
44
  end
44
-
45
+
45
46
  def annotated_source_code
46
47
  location[:lineText].split("\n").map.with_index(1) { |line, index|
47
48
  indentation = " " * 4
@@ -49,48 +50,48 @@ module Svelte
49
50
  }
50
51
  end
51
52
  end
52
-
53
+
53
54
  class TemplateError < StandardError
54
55
  attr_reader :cause, :template
55
-
56
+
56
57
  SOURCE_CODE_RADIUS = 3
57
-
58
+
58
59
  def initialize(template, error)
59
60
  raise("Did not provide cause error") unless error
60
61
  @cause = error
61
-
62
+
62
63
  raise("Did not provide template") unless template
63
64
  @template, @sub_templates = template, nil
64
-
65
+
65
66
  raise("Cause error is nil for TemplateError") unless @cause
66
67
  @cause.template = template
67
-
68
+
68
69
  # steep:ignore:start
69
70
  super(@cause.message) # : self
70
71
  # steep:ignore:end
71
72
  end
72
-
73
+
73
74
  def message
74
75
  @cause.message
75
76
  end
76
-
77
+
77
78
  def annotated_source_code
78
79
  @cause.annotated_source_code
79
80
  end
80
-
81
+
81
82
  # Following is copypasta-ed from ActionView::Template::Error
82
83
  def backtrace
83
84
  @cause.backtrace
84
85
  end
85
-
86
+
86
87
  def backtrace_locations
87
88
  @cause.backtrace_locations
88
89
  end
89
-
90
+
90
91
  def file_name
91
92
  @template.identifier
92
93
  end
93
-
94
+
94
95
  def sub_template_message
95
96
  if @sub_templates
96
97
  "Trace of template inclusion: " +
@@ -99,27 +100,27 @@ module Svelte
99
100
  ""
100
101
  end
101
102
  end
102
-
103
+
103
104
  def source_extract(indentation = 0)
104
105
  return [] unless (num = line_number)
105
106
  num = num.to_i
106
-
107
+
107
108
  source_code = @template.encode!.split("\n")
108
-
109
+
109
110
  start_on_line = [num - SOURCE_CODE_RADIUS - 1, 0].max
110
111
  end_on_line = [num + SOURCE_CODE_RADIUS - 1, source_code.length].min
111
-
112
+
112
113
  indent = end_on_line.to_s.size + indentation
113
114
  return [] unless (source_code = source_code[start_on_line..end_on_line])
114
-
115
+
115
116
  formatted_code_for(source_code, start_on_line, indent)
116
117
  end
117
-
118
+
118
119
  def sub_template_of(template_path)
119
120
  @sub_templates ||= []
120
121
  @sub_templates << template_path
121
122
  end
122
-
123
+
123
124
  def line_number
124
125
  @line_number ||=
125
126
  if file_name
@@ -127,9 +128,9 @@ module Svelte
127
128
  $1 if message =~ regexp || backtrace.find { |line| line =~ regexp }
128
129
  end
129
130
  end
130
-
131
+
131
132
  private
132
-
133
+
133
134
  def source_location
134
135
  if line_number
135
136
  "on line ##{line_number} of "
@@ -137,7 +138,7 @@ module Svelte
137
138
  "in "
138
139
  end + file_name
139
140
  end
140
-
141
+
141
142
  def formatted_code_for(source_code, line_counter, indent)
142
143
  raise("line counter is nil") if line_counter.nil?
143
144
  indent_template = "%#{indent}s: %s"
@@ -149,5 +150,3 @@ module Svelte
149
150
  end
150
151
  end
151
152
  end
152
-
153
- # {:id=>"", :location=>{:column=>13, :file=>"demo/e.html.svelte", :length=>3, :line=>7, :lineText=>"<h1>{hola}, {nam}</h1>", :namespace=>"file", :suggestion=>""}, :notes=>[], :pluginName=>"esbuild-svelte", :text=>"'nam' is not defined"}
@@ -35,6 +35,7 @@ module Svelte
35
35
 
36
36
  assembler.write(ERB.new(File.read('#{Svelte.gem_dir}/lib/svelte/templates/assembler.js.erb')).result_with_hash({
37
37
  path: '#{Rails.root.join template.identifier}',
38
+ digest: '#{digest}',
38
39
  locals: local_assigns,
39
40
  compiled_client: j(Rails.cache.read('svelte/template/client' + '#{digest}')),
40
41
  compiled_server: j(Rails.cache.read('svelte/template/server' + '#{digest}')),
@@ -46,7 +47,7 @@ module Svelte
46
47
  result = JSON.parse(`NODE_PATH=#{Rails.root.join("node_modules")} NODE_NO_WARNINGS=1 node --experimental-vm-modules \#{assembler.path}`).deep_symbolize_keys
47
48
 
48
49
  if result[:error]
49
- e = Svelte::Errors::CompilerError.new(result.dig(:error, :text), result.dig(:error, :location))
50
+ e = Svelte::Errors::CompilerError.new(result.dig(:error))
50
51
  raise Svelte::Errors::TemplateError.new(template, e)
51
52
  end
52
53
 
@@ -4,9 +4,6 @@ module Svelte
4
4
  def svelte_tags
5
5
  js = <<-JS
6
6
  import "https://esm.sh/@11ty/is-land";
7
- import { readable } from "https://esm.sh/svelte/store"
8
-
9
- window.props = readable(JSON.parse("#{j(Svelte.props.to_json)}"))
10
7
  JS
11
8
 
12
9
  ((content_for(:head).presence || "") + "\n" + tag.script(js.html_safe, type: "module")).html_safe # steep:ignore RequiredBlockMissing
@@ -4,10 +4,8 @@
4
4
  DO NOT MODIFY.
5
5
  */
6
6
 
7
- import { readable } from "svelte/store";
8
7
  import { importFromStringSync } from "module-from-string";
9
8
  import { sveltePreprocess } from "svelte-preprocess";
10
- import * as recast from "recast";
11
9
  import { rollup } from "rollup";
12
10
  import svelte from "rollup-plugin-svelte";
13
11
  import alias from "@rollup/plugin-alias";
@@ -26,10 +24,11 @@ class Builder {
26
24
  preprocess;
27
25
  pathAliases;
28
26
  root;
29
- constructor(path2, root, props, locals, client, server, ssr, workingDir, preprocess, pathAliases) {
27
+ digest;
28
+ constructor(path2, root, props, locals, client, server, ssr, workingDir, preprocess, pathAliases, digest) {
30
29
  this.path = path2;
31
30
  this.root = root;
32
- this.props = readable(Object.assign(props, locals, props));
31
+ this.props = Object.assign(props, props, locals);
33
32
  this.locals = locals;
34
33
  this.compiled = {
35
34
  client,
@@ -39,8 +38,38 @@ class Builder {
39
38
  this.workingDir = workingDir;
40
39
  this.preprocess = preprocess;
41
40
  this.pathAliases = pathAliases;
41
+ this.digest = digest;
42
42
  }
43
43
  async bundle(generate) {
44
+ let entry = null;
45
+ if (generate == "ssr") {
46
+ entry = `
47
+ import App from "${this.path}";
48
+ import { render } from "svelte/server";
49
+
50
+ const rendered = render(App, {
51
+ props: JSON.parse('${JSON.stringify(this.props)}')
52
+ })
53
+
54
+ export default rendered;
55
+ `;
56
+ } else {
57
+ entry = `
58
+ import App from "${this.path}";
59
+ import { hydrate } from "svelte";
60
+
61
+ function hydrateApp() {
62
+ const app = hydrate(App, {
63
+ target: document.getElementById("hydratee-${this.digest}"),
64
+ props: JSON.parse('${JSON.stringify(this.props)}')
65
+ })
66
+
67
+ app.flushSync();
68
+ }
69
+
70
+ export default hydrateApp;
71
+ `;
72
+ }
44
73
  const bundle = (await (await rollup({
45
74
  input: "entry",
46
75
  output: {
@@ -53,7 +82,7 @@ class Builder {
53
82
  plugins: [
54
83
  // @ts-expect-error see https://github.com/rollup/plugins/issues/1662
55
84
  virtual({
56
- entry: `import App from '${this.path}'; export default App`
85
+ entry
57
86
  }),
58
87
  // @ts-expect-error see https://github.com/rollup/plugins/issues/1662
59
88
  svelte({
@@ -64,9 +93,8 @@ class Builder {
64
93
  },
65
94
  emitCss: false,
66
95
  preprocess: sveltePreprocess(this.preprocess),
67
- onwarn: (warning, handler) => {
68
- if (warning.code === "missing-declaration" && warning.message.includes("'props'")) return;
69
- throw new Error(warning.message);
96
+ onwarn: (warning) => {
97
+ throw warning;
70
98
  }
71
99
  }),
72
100
  // @ts-expect-error see https://github.com/rollup/plugins/issues/1662
@@ -108,36 +136,33 @@ class Builder {
108
136
  ${bundle[0].code}`.trim();
109
137
  }
110
138
  async client() {
111
- return this.compiled?.client || this.standardizeClient(await this.bundle("dom"));
112
- }
113
- standardizeClient(code) {
114
- const ast = recast.parse(code);
115
- let name;
116
- recast.visit(ast, {
117
- visitExportNamedDeclaration: (path2) => {
118
- const stagingName = path2.node?.specifiers?.[0].local?.name;
119
- name = typeof stagingName !== "string" ? "" : stagingName;
120
- path2.prune();
121
- return false;
122
- }
123
- });
124
- recast.visit(ast, {
125
- visitIdentifier: (path2) => {
126
- if (path2.node.name === name) {
127
- path2.node.name = "App";
128
- }
129
- return false;
130
- }
131
- });
132
- return recast.print(ast).code;
139
+ return this.compiled?.client || await this.bundle("dom");
133
140
  }
141
+ // standardizeClient (code: string): string {
142
+ // const ast = recast.parse(code)
143
+ // let name: string | undefined
144
+ // recast.visit(ast, {
145
+ // visitExportNamedDeclaration: (path) => {
146
+ // const stagingName: any = path.node?.specifiers?.[0].local?.name
147
+ // name = typeof stagingName !== 'string' ? '' : stagingName
148
+ // path.prune()
149
+ // return false
150
+ // }
151
+ // })
152
+ // recast.visit(ast, {
153
+ // visitIdentifier: (path) => {
154
+ // if (path.node.name === name) {
155
+ // path.node.name = 'App'
156
+ // }
157
+ // return false
158
+ // }
159
+ // })
160
+ // return recast.print(ast).code
161
+ // }s
134
162
  async server() {
135
163
  const output = this.compiled?.server || await this.bundle("ssr");
136
- const Component = importFromStringSync(output, {
137
- globals: { props: this.props }
138
- }).default;
139
- const { html, css, head } = await Component.render(this.locals);
140
- return { output, html, head, css: css.code };
164
+ const { html, css, head } = importFromStringSync(output).default;
165
+ return { output, html, head, css: css?.code };
141
166
  }
142
167
  async build() {
143
168
  try {
@@ -10,7 +10,8 @@ const bob = new Builder(
10
10
  <%= ssr %>,
11
11
  '<%= Rails.root %>',
12
12
  JSON.parse('<%= Svelte.preprocess.to_json || "{}" %>'),
13
- JSON.parse('<%= Svelte.aliases.to_json || "{}" %>')
13
+ JSON.parse('<%= Svelte.aliases.to_json || "{}" %>'),
14
+ '<%= digest %>'
14
15
  )
15
16
 
16
17
  const built = await bob.build()
@@ -7,12 +7,6 @@
7
7
  <%= result.dig(:server, :css) %>
8
8
  </style>
9
9
  <template data-island>
10
- <script type="module"><%= result.dig(:client).strip %>;
11
- new App({
12
- target: document.getElementById("hydratee-<%= digest %>"),
13
- props: JSON.parse('<%= locals.to_json %>'),
14
- hydrate: true
15
- });
16
- </script>
10
+ <script type="module">(<%= result.dig(:client).strip %>)();</script>
17
11
  </template>
18
12
  </is-land>
@@ -1,3 +1,3 @@
1
1
  module Svelte
2
- VERSION = "0.7.0"
2
+ VERSION = "0.8.0"
3
3
  end
data/lib/ts/builder.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { readable, Stores } from 'svelte/store'
2
1
  import { importFromStringSync } from 'module-from-string'
3
2
  import { sveltePreprocess } from 'svelte-preprocess'
4
3
  import type { Warning } from 'svelte/types/compiler/interfaces'
@@ -11,6 +10,7 @@ import { nodeResolve } from '@rollup/plugin-node-resolve';
11
10
  import virtual from '@rollup/plugin-virtual';
12
11
  import swc from '@rollup/plugin-swc';
13
12
  import path from "node:path"
13
+ import { render } from "svelte/server"
14
14
 
15
15
  export interface BuildSuccess {
16
16
  client: string
@@ -36,7 +36,7 @@ export type BuildResult = BuildSuccess | BuildError
36
36
  */
37
37
  class Builder {
38
38
  path: string
39
- props: Stores
39
+ props: object
40
40
  locals: object
41
41
  compiled: {
42
42
  client: string | null
@@ -48,6 +48,7 @@ class Builder {
48
48
  preprocess: object
49
49
  pathAliases?: object
50
50
  root: string
51
+ digest: string
51
52
 
52
53
  constructor (
53
54
  path: string,
@@ -59,11 +60,12 @@ class Builder {
59
60
  ssr: boolean,
60
61
  workingDir: string,
61
62
  preprocess: object,
62
- pathAliases: object
63
+ pathAliases: object,
64
+ digest: string
63
65
  ) {
64
66
  this.path = path
65
67
  this.root = root
66
- this.props = readable(Object.assign(props, locals, props))
68
+ this.props = Object.assign(props, props, locals)
67
69
  this.locals = locals
68
70
  this.compiled = {
69
71
  client,
@@ -73,9 +75,41 @@ class Builder {
73
75
  this.workingDir = workingDir
74
76
  this.preprocess = preprocess
75
77
  this.pathAliases = pathAliases
78
+ this.digest = digest
76
79
  }
77
80
 
78
81
  async bundle (generate: 'ssr' | 'dom'): Promise<string> {
82
+ let entry = null
83
+
84
+ if(generate == 'ssr') {
85
+ entry = `
86
+ import App from "${this.path}";
87
+ import { render } from "svelte/server";
88
+
89
+ const rendered = render(App, {
90
+ props: JSON.parse('${JSON.stringify(this.props)}')
91
+ })
92
+
93
+ export default rendered;
94
+ `
95
+ } else {
96
+ entry = `
97
+ import App from "${this.path}";
98
+ import { hydrate } from "svelte";
99
+
100
+ function hydrateApp() {
101
+ const app = hydrate(App, {
102
+ target: document.getElementById("hydratee-${this.digest}"),
103
+ props: JSON.parse('${JSON.stringify(this.props)}')
104
+ })
105
+
106
+ app.flushSync();
107
+ }
108
+
109
+ export default hydrateApp;
110
+ `
111
+ }
112
+
79
113
  const bundle = (await (await rollup({
80
114
  input: 'entry',
81
115
  output: {
@@ -88,7 +122,7 @@ class Builder {
88
122
  plugins: [
89
123
  // @ts-expect-error see https://github.com/rollup/plugins/issues/1662
90
124
  virtual({
91
- entry: `import App from '${this.path}'; export default App`
125
+ entry: entry
92
126
  }),
93
127
  // @ts-expect-error see https://github.com/rollup/plugins/issues/1662
94
128
  svelte({
@@ -99,13 +133,8 @@ class Builder {
99
133
  },
100
134
  emitCss: false,
101
135
  preprocess: sveltePreprocess(this.preprocess),
102
- onwarn: (warning: Warning, handler: Function) => {
103
- if (
104
- warning.code === 'missing-declaration' &&
105
- warning.message.includes("'props'")
106
- ) return
107
-
108
- throw new Error(warning.message);
136
+ onwarn: (warning: Warning) => {
137
+ throw warning;
109
138
  }
110
139
  }),
111
140
  // @ts-expect-error see https://github.com/rollup/plugins/issues/1662
@@ -147,46 +176,42 @@ class Builder {
147
176
 
148
177
  async client (): Promise<string> {
149
178
  return (
150
- this.compiled?.client || this.standardizeClient(await this.bundle("dom")) // eslint-disable-line
179
+ this.compiled?.client || (await this.bundle("dom")) // eslint-disable-line
151
180
  )
152
181
  }
153
182
 
154
- standardizeClient (code: string): string {
155
- const ast = recast.parse(code)
156
-
157
- let name: string | undefined
158
-
159
- recast.visit(ast, {
160
- visitExportNamedDeclaration: (path) => {
161
- const stagingName: any = path.node?.specifiers?.[0].local?.name
162
- name = typeof stagingName !== 'string' ? '' : stagingName
163
- path.prune()
164
- return false
165
- }
166
- })
167
-
168
- recast.visit(ast, {
169
- visitIdentifier: (path) => {
170
- if (path.node.name === name) {
171
- path.node.name = 'App'
172
- }
173
- return false
174
- }
175
- })
183
+ // standardizeClient (code: string): string {
184
+ // const ast = recast.parse(code)
185
+
186
+ // let name: string | undefined
187
+
188
+ // recast.visit(ast, {
189
+ // visitExportNamedDeclaration: (path) => {
190
+ // const stagingName: any = path.node?.specifiers?.[0].local?.name
191
+ // name = typeof stagingName !== 'string' ? '' : stagingName
192
+ // path.prune()
193
+ // return false
194
+ // }
195
+ // })
196
+
197
+ // recast.visit(ast, {
198
+ // visitIdentifier: (path) => {
199
+ // if (path.node.name === name) {
200
+ // path.node.name = 'App'
201
+ // }
202
+ // return false
203
+ // }
204
+ // })
176
205
 
177
- return recast.print(ast).code
178
- }
206
+ // return recast.print(ast).code
207
+ // }s
179
208
 
180
209
  async server (): Promise<{ output: string, html: string, css: string, head: string }> {
181
210
  const output = this.compiled?.server || (await this.bundle('ssr')) // eslint-disable-line
182
211
 
183
- const Component = importFromStringSync(output, {
184
- globals: { props: this.props }
185
- }).default
186
-
187
- const { html, css, head } = await Component.render(this.locals)
212
+ const { html, css, head } = importFromStringSync(output).default
188
213
 
189
- return { output, html, head, css: css.code }
214
+ return { output, html, head, css: css?.code }
190
215
  }
191
216
 
192
217
  async build (): Promise<BuildResult> {
@@ -1,4 +1,3 @@
1
- import { Stores } from 'svelte/store';
2
1
  export interface BuildSuccess {
3
2
  client: string;
4
3
  server: {
@@ -20,7 +19,7 @@ export type BuildResult = BuildSuccess | BuildError;
20
19
  */
21
20
  declare class Builder {
22
21
  path: string;
23
- props: Stores;
22
+ props: object;
24
23
  locals: object;
25
24
  compiled: {
26
25
  client: string | null;
@@ -31,10 +30,10 @@ declare class Builder {
31
30
  preprocess: object;
32
31
  pathAliases?: object;
33
32
  root: string;
34
- constructor(path: string, root: string, props: object, locals: object, client: string | null, server: string | null, ssr: boolean, workingDir: string, preprocess: object, pathAliases: object);
33
+ digest: string;
34
+ constructor(path: string, root: string, props: object, locals: object, client: string | null, server: string | null, ssr: boolean, workingDir: string, preprocess: object, pathAliases: object, digest: string);
35
35
  bundle(generate: 'ssr' | 'dom'): Promise<string>;
36
36
  client(): Promise<string>;
37
- standardizeClient(code: string): string;
38
37
  server(): Promise<{
39
38
  output: string;
40
39
  html: string;
data/package-lock.json CHANGED
@@ -14,22 +14,16 @@
14
14
  "@rollup/plugin-swc": "^0.4.0",
15
15
  "@rollup/plugin-virtual": "^3.0.2",
16
16
  "@swc/core": "^1.7.26",
17
- "convert-source-map": "^2.0.0",
18
- "esbuild-svelte": "^0.8.1",
19
- "flat": "^6.0.1",
20
17
  "inflected": "^2.1.0",
21
- "lodash.merge": "^4.6.2",
22
18
  "module-from-string": "^3.3.1",
23
19
  "recast": "^0.23.9",
24
20
  "rollup": "^4.22.4",
25
21
  "rollup-plugin-svelte": "^7.2.2",
26
- "rollup-sourcemap-path-transform": "^1.0.5",
27
- "svelte": "^4.2.19",
28
- "svelte-preprocess": "^6.0.2"
22
+ "svelte": "^5.0.2",
23
+ "svelte-preprocess": "^6.0.3"
29
24
  },
30
25
  "devDependencies": {
31
26
  "@types/convert-source-map": "^2.0.3",
32
- "@types/lodash.merge": "^4.6.9",
33
27
  "surge": "^0.23.1",
34
28
  "ts-standard": "^12.0.2",
35
29
  "typescript": "^5.5.4",
@@ -3202,21 +3196,6 @@
3202
3196
  "integrity": "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==",
3203
3197
  "dev": true
3204
3198
  },
3205
- "node_modules/@types/lodash": {
3206
- "version": "4.17.7",
3207
- "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.7.tgz",
3208
- "integrity": "sha512-8wTvZawATi/lsmNu10/j2hk1KEP0IvjubqPE3cu1Xz7xfXXt5oCq3SNUz4fMIP4XGF9Ky+Ue2tBA3hcS7LSBlA==",
3209
- "dev": true
3210
- },
3211
- "node_modules/@types/lodash.merge": {
3212
- "version": "4.6.9",
3213
- "resolved": "https://registry.npmjs.org/@types/lodash.merge/-/lodash.merge-4.6.9.tgz",
3214
- "integrity": "sha512-23sHDPmzd59kUgWyKGiOMO2Qb9YtqRO/x4IhkgNUiPQ1+5MUVqi6bCZeq9nBJ17msjIMbEIO5u+XW4Kz6aGUhQ==",
3215
- "dev": true,
3216
- "dependencies": {
3217
- "@types/lodash": "*"
3218
- }
3219
- },
3220
3199
  "node_modules/@types/markdown-it": {
3221
3200
  "version": "14.1.2",
3222
3201
  "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-14.1.2.tgz",
@@ -3819,6 +3798,14 @@
3819
3798
  "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
3820
3799
  }
3821
3800
  },
3801
+ "node_modules/acorn-typescript": {
3802
+ "version": "1.4.13",
3803
+ "resolved": "https://registry.npmjs.org/acorn-typescript/-/acorn-typescript-1.4.13.tgz",
3804
+ "integrity": "sha512-xsc9Xv0xlVfwp2o7sQ+GCQ1PgbkdcpWdTzrwXxO3xDMTAywVS3oXVOcOHuRjAPkS4P9b+yc/qNF15460v+jp4Q==",
3805
+ "peerDependencies": {
3806
+ "acorn": ">=8.9.0"
3807
+ }
3808
+ },
3822
3809
  "node_modules/ajv": {
3823
3810
  "version": "6.12.6",
3824
3811
  "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
@@ -3896,11 +3883,11 @@
3896
3883
  "dev": true
3897
3884
  },
3898
3885
  "node_modules/aria-query": {
3899
- "version": "5.3.0",
3900
- "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz",
3901
- "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==",
3902
- "dependencies": {
3903
- "dequal": "^2.0.3"
3886
+ "version": "5.3.2",
3887
+ "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.2.tgz",
3888
+ "integrity": "sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw==",
3889
+ "engines": {
3890
+ "node": ">= 0.4"
3904
3891
  }
3905
3892
  },
3906
3893
  "node_modules/array-buffer-byte-length": {
@@ -4419,18 +4406,6 @@
4419
4406
  "integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==",
4420
4407
  "dev": true
4421
4408
  },
4422
- "node_modules/code-red": {
4423
- "version": "1.0.4",
4424
- "resolved": "https://registry.npmjs.org/code-red/-/code-red-1.0.4.tgz",
4425
- "integrity": "sha512-7qJWqItLA8/VPVlKJlFXU+NBlo/qyfs39aJcuMT/2ere32ZqvF5OSxgdM5xOfJJ7O429gg2HM47y8v9P+9wrNw==",
4426
- "dependencies": {
4427
- "@jridgewell/sourcemap-codec": "^1.4.15",
4428
- "@types/estree": "^1.0.1",
4429
- "acorn": "^8.10.0",
4430
- "estree-walker": "^3.0.3",
4431
- "periscopic": "^3.1.0"
4432
- }
4433
- },
4434
4409
  "node_modules/color-convert": {
4435
4410
  "version": "2.0.1",
4436
4411
  "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
@@ -4530,18 +4505,6 @@
4530
4505
  "node": ">= 8"
4531
4506
  }
4532
4507
  },
4533
- "node_modules/css-tree": {
4534
- "version": "2.3.1",
4535
- "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.3.1.tgz",
4536
- "integrity": "sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==",
4537
- "dependencies": {
4538
- "mdn-data": "2.0.30",
4539
- "source-map-js": "^1.0.1"
4540
- },
4541
- "engines": {
4542
- "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0"
4543
- }
4544
- },
4545
4508
  "node_modules/csstype": {
4546
4509
  "version": "3.1.3",
4547
4510
  "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
@@ -4684,14 +4647,6 @@
4684
4647
  "node": ">=0.4.0"
4685
4648
  }
4686
4649
  },
4687
- "node_modules/dequal": {
4688
- "version": "2.0.3",
4689
- "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz",
4690
- "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==",
4691
- "engines": {
4692
- "node": ">=6"
4693
- }
4694
- },
4695
4650
  "node_modules/dir-glob": {
4696
4651
  "version": "3.0.1",
4697
4652
  "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
@@ -4958,21 +4913,6 @@
4958
4913
  "@esbuild/win32-x64": "0.23.0"
4959
4914
  }
4960
4915
  },
4961
- "node_modules/esbuild-svelte": {
4962
- "version": "0.8.1",
4963
- "resolved": "https://registry.npmjs.org/esbuild-svelte/-/esbuild-svelte-0.8.1.tgz",
4964
- "integrity": "sha512-iswZSetqRxYaQoWMd38Gu6AanIL6KFsVj8/unei7qTaxjAkRDulW62/Bc5nmeogKBWekBvrPOE106wui7gYARQ==",
4965
- "dependencies": {
4966
- "@jridgewell/trace-mapping": "^0.3.19"
4967
- },
4968
- "engines": {
4969
- "node": ">=14"
4970
- },
4971
- "peerDependencies": {
4972
- "esbuild": ">=0.9.6",
4973
- "svelte": ">=3.43.0 <6"
4974
- }
4975
- },
4976
4916
  "node_modules/escalade": {
4977
4917
  "version": "3.1.2",
4978
4918
  "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz",
@@ -5454,6 +5394,11 @@
5454
5394
  "url": "https://opencollective.com/eslint"
5455
5395
  }
5456
5396
  },
5397
+ "node_modules/esm-env": {
5398
+ "version": "1.0.0",
5399
+ "resolved": "https://registry.npmjs.org/esm-env/-/esm-env-1.0.0.tgz",
5400
+ "integrity": "sha512-Cf6VksWPsTuW01vU9Mk/3vRue91Zevka5SjyNf3nEpokFRuqt/KjUQoGAwq9qMmhpLTHmXzSIrFRw8zxWzmFBA=="
5401
+ },
5457
5402
  "node_modules/espree": {
5458
5403
  "version": "9.6.1",
5459
5404
  "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz",
@@ -5495,6 +5440,15 @@
5495
5440
  "node": ">=0.10"
5496
5441
  }
5497
5442
  },
5443
+ "node_modules/esrap": {
5444
+ "version": "1.2.2",
5445
+ "resolved": "https://registry.npmjs.org/esrap/-/esrap-1.2.2.tgz",
5446
+ "integrity": "sha512-F2pSJklxx1BlQIQgooczXCPHmcWpn6EsP5oo73LQfonG9fIlIENQ8vMmfGXeojP9MrkzUNAfyU5vdFlR9shHAw==",
5447
+ "dependencies": {
5448
+ "@jridgewell/sourcemap-codec": "^1.4.15",
5449
+ "@types/estree": "^1.0.1"
5450
+ }
5451
+ },
5498
5452
  "node_modules/esrecurse": {
5499
5453
  "version": "4.3.0",
5500
5454
  "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
@@ -5516,14 +5470,6 @@
5516
5470
  "node": ">=4.0"
5517
5471
  }
5518
5472
  },
5519
- "node_modules/estree-walker": {
5520
- "version": "3.0.3",
5521
- "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz",
5522
- "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==",
5523
- "dependencies": {
5524
- "@types/estree": "^1.0.0"
5525
- }
5526
- },
5527
5473
  "node_modules/esutils": {
5528
5474
  "version": "2.0.3",
5529
5475
  "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
@@ -5677,17 +5623,6 @@
5677
5623
  "url": "https://github.com/sponsors/sindresorhus"
5678
5624
  }
5679
5625
  },
5680
- "node_modules/flat": {
5681
- "version": "6.0.1",
5682
- "resolved": "https://registry.npmjs.org/flat/-/flat-6.0.1.tgz",
5683
- "integrity": "sha512-/3FfIa8mbrg3xE7+wAhWeV+bd7L2Mof+xtZb5dRDKZ+wDvYJK4WDYeIOuOhre5Yv5aQObZrlbRmk3RTSiuQBtw==",
5684
- "bin": {
5685
- "flat": "cli.js"
5686
- },
5687
- "engines": {
5688
- "node": ">=18"
5689
- }
5690
- },
5691
5626
  "node_modules/flat-cache": {
5692
5627
  "version": "3.2.0",
5693
5628
  "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz",
@@ -6999,7 +6934,8 @@
6999
6934
  "node_modules/lodash.merge": {
7000
6935
  "version": "4.6.2",
7001
6936
  "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
7002
- "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ=="
6937
+ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
6938
+ "dev": true
7003
6939
  },
7004
6940
  "node_modules/loose-envify": {
7005
6941
  "version": "1.4.0",
@@ -7035,11 +6971,6 @@
7035
6971
  "integrity": "sha512-1I+1qpDt4idfgLQG+BNWmrqku+7/2bi5nLf4YwF8y8zXvmfiTBY3PV3ZibfrjBueCByROpuBjLLFCajqkgYoLQ==",
7036
6972
  "dev": true
7037
6973
  },
7038
- "node_modules/mdn-data": {
7039
- "version": "2.0.30",
7040
- "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz",
7041
- "integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA=="
7042
- },
7043
6974
  "node_modules/merge2": {
7044
6975
  "version": "1.4.1",
7045
6976
  "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
@@ -7525,16 +7456,6 @@
7525
7456
  "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==",
7526
7457
  "dev": true
7527
7458
  },
7528
- "node_modules/periscopic": {
7529
- "version": "3.1.0",
7530
- "resolved": "https://registry.npmjs.org/periscopic/-/periscopic-3.1.0.tgz",
7531
- "integrity": "sha512-vKiQ8RRtkl9P+r/+oefh25C3fhybptkHKCZSPlcXiJux2tJF55GnEj3BVn4A5gKfq9NWWXXrxkHBwVPUfH0opw==",
7532
- "dependencies": {
7533
- "@types/estree": "^1.0.0",
7534
- "estree-walker": "^3.0.0",
7535
- "is-reference": "^3.0.0"
7536
- }
7537
- },
7538
7459
  "node_modules/picocolors": {
7539
7460
  "version": "1.0.1",
7540
7461
  "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz",
@@ -8116,17 +8037,6 @@
8116
8037
  "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
8117
8038
  "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="
8118
8039
  },
8119
- "node_modules/rollup-sourcemap-path-transform": {
8120
- "version": "1.0.5",
8121
- "resolved": "https://registry.npmjs.org/rollup-sourcemap-path-transform/-/rollup-sourcemap-path-transform-1.0.5.tgz",
8122
- "integrity": "sha512-i7mcb8heyQcG+76oZrmdrkrtNVIpuefqhHYxdsqWO4wZO/8/BtUoBr2YKy+QyzdTYvR+EKTmoHN4Yg29LYC4Dw==",
8123
- "engines": {
8124
- "node": ">= 14.18"
8125
- },
8126
- "peerDependencies": {
8127
- "rollup": "^2 || ^3 || ^4"
8128
- }
8129
- },
8130
8040
  "node_modules/run-async": {
8131
8041
  "version": "2.4.1",
8132
8042
  "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz",
@@ -8362,6 +8272,7 @@
8362
8272
  "version": "1.2.0",
8363
8273
  "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz",
8364
8274
  "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==",
8275
+ "devOptional": true,
8365
8276
  "engines": {
8366
8277
  "node": ">=0.10.0"
8367
8278
  }
@@ -8810,33 +8721,32 @@
8810
8721
  "dev": true
8811
8722
  },
8812
8723
  "node_modules/svelte": {
8813
- "version": "4.2.19",
8814
- "resolved": "https://registry.npmjs.org/svelte/-/svelte-4.2.19.tgz",
8815
- "integrity": "sha512-IY1rnGr6izd10B0A8LqsBfmlT5OILVuZ7XsI0vdGPEvuonFV7NYEUK4dAkm9Zg2q0Um92kYjTpS1CAP3Nh/KWw==",
8816
- "dependencies": {
8817
- "@ampproject/remapping": "^2.2.1",
8818
- "@jridgewell/sourcemap-codec": "^1.4.15",
8819
- "@jridgewell/trace-mapping": "^0.3.18",
8820
- "@types/estree": "^1.0.1",
8821
- "acorn": "^8.9.0",
8822
- "aria-query": "^5.3.0",
8823
- "axobject-query": "^4.0.0",
8824
- "code-red": "^1.0.3",
8825
- "css-tree": "^2.3.1",
8826
- "estree-walker": "^3.0.3",
8827
- "is-reference": "^3.0.1",
8724
+ "version": "5.0.2",
8725
+ "resolved": "https://registry.npmjs.org/svelte/-/svelte-5.0.2.tgz",
8726
+ "integrity": "sha512-TIqp5kjyTMa45L0McUvVfjuvlF/hyxVolyAc9APY3/FeF5aqYpt+Y1PckPQ7DlsDkthxNeq2+ystop8GlIV3kw==",
8727
+ "dependencies": {
8728
+ "@ampproject/remapping": "^2.3.0",
8729
+ "@jridgewell/sourcemap-codec": "^1.5.0",
8730
+ "@types/estree": "^1.0.5",
8731
+ "acorn": "^8.12.1",
8732
+ "acorn-typescript": "^1.4.13",
8733
+ "aria-query": "^5.3.1",
8734
+ "axobject-query": "^4.1.0",
8735
+ "esm-env": "^1.0.0",
8736
+ "esrap": "^1.2.2",
8737
+ "is-reference": "^3.0.2",
8828
8738
  "locate-character": "^3.0.0",
8829
- "magic-string": "^0.30.4",
8830
- "periscopic": "^3.1.0"
8739
+ "magic-string": "^0.30.11",
8740
+ "zimmerframe": "^1.1.2"
8831
8741
  },
8832
8742
  "engines": {
8833
- "node": ">=16"
8743
+ "node": ">=18"
8834
8744
  }
8835
8745
  },
8836
8746
  "node_modules/svelte-preprocess": {
8837
- "version": "6.0.2",
8838
- "resolved": "https://registry.npmjs.org/svelte-preprocess/-/svelte-preprocess-6.0.2.tgz",
8839
- "integrity": "sha512-OvDTLfaOkkhjprbDKO0SOCkjNYuHy16dbD4SpqbIi6QiabOMHxRT4km5/dzbFFkmW1L0E2INF3MFltG2pgOyKQ==",
8747
+ "version": "6.0.3",
8748
+ "resolved": "https://registry.npmjs.org/svelte-preprocess/-/svelte-preprocess-6.0.3.tgz",
8749
+ "integrity": "sha512-PLG2k05qHdhmRG7zR/dyo5qKvakhm8IJ+hD2eFRQmMLHp7X3eJnjeupUtvuRpbNiF31RjVw45W+abDwHEmP5OA==",
8840
8750
  "hasInstallScript": true,
8841
8751
  "engines": {
8842
8752
  "node": ">= 18.0.0"
@@ -10052,6 +9962,11 @@
10052
9962
  "funding": {
10053
9963
  "url": "https://github.com/sponsors/sindresorhus"
10054
9964
  }
9965
+ },
9966
+ "node_modules/zimmerframe": {
9967
+ "version": "1.1.2",
9968
+ "resolved": "https://registry.npmjs.org/zimmerframe/-/zimmerframe-1.1.2.tgz",
9969
+ "integrity": "sha512-rAbqEGa8ovJy4pyBxZM70hg4pE6gDgaQ0Sl9M3enG3I0d6H4XSAM3GeNGLKnsBpuijUow064sf7ww1nutC5/3w=="
10055
9970
  }
10056
9971
  }
10057
9972
  }
data/package.json CHANGED
@@ -23,12 +23,13 @@
23
23
  "@rollup/plugin-swc": "^0.4.0",
24
24
  "@rollup/plugin-virtual": "^3.0.2",
25
25
  "@swc/core": "^1.7.26",
26
+ "inflected": "^2.1.0",
26
27
  "module-from-string": "^3.3.1",
27
28
  "recast": "^0.23.9",
28
29
  "rollup": "^4.22.4",
29
30
  "rollup-plugin-svelte": "^7.2.2",
30
- "svelte": "^4.2.19",
31
- "svelte-preprocess": "^6.0.2"
31
+ "svelte": "^5.0.2",
32
+ "svelte-preprocess": "^6.0.3"
32
33
  },
33
34
  "engines": {
34
35
  "node": ">=12.16.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionview-svelte-handler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - reesericci
8
8
  autorequire: svelte
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-25 00:00:00.000000000 Z
11
+ date: 2024-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails