cable_ready 5.0.0.pre8 → 5.0.0.pre10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +2 -542
  3. data/Gemfile +4 -1
  4. data/Gemfile.lock +125 -168
  5. data/IMPLEMENTATION.md +93 -0
  6. data/README.md +36 -10
  7. data/Rakefile +0 -8
  8. data/app/assets/javascripts/cable_ready.js +1265 -0
  9. data/app/assets/javascripts/cable_ready.min.js +2 -0
  10. data/app/assets/javascripts/cable_ready.min.js.map +1 -0
  11. data/app/assets/javascripts/cable_ready.umd.js +1186 -0
  12. data/app/assets/javascripts/cable_ready.umd.min.js +2 -0
  13. data/app/assets/javascripts/cable_ready.umd.min.js.map +1 -0
  14. data/app/channels/cable_ready/stream.rb +7 -5
  15. data/app/helpers/cable_ready/view_helper.rb +58 -0
  16. data/app/jobs/cable_ready_broadcast_job.rb +9 -8
  17. data/app/models/concerns/cable_ready/updatable/collection_updatable_callbacks.rb +2 -0
  18. data/app/models/concerns/cable_ready/updatable/collections_registry.rb +2 -0
  19. data/app/models/concerns/cable_ready/updatable/model_updatable_callbacks.rb +6 -3
  20. data/app/models/concerns/cable_ready/updatable.rb +110 -17
  21. data/app/models/concerns/extend_has_many.rb +2 -0
  22. data/cable_ready.gemspec +40 -0
  23. data/lib/cable_ready/broadcaster.rb +2 -0
  24. data/lib/cable_ready/cable_car.rb +2 -0
  25. data/lib/cable_ready/channel.rb +12 -4
  26. data/lib/cable_ready/channels.rb +3 -1
  27. data/lib/cable_ready/config.rb +16 -2
  28. data/lib/cable_ready/engine.rb +50 -0
  29. data/lib/cable_ready/identifiable.rb +23 -5
  30. data/lib/cable_ready/importmap.rb +4 -0
  31. data/lib/cable_ready/installer.rb +224 -0
  32. data/lib/cable_ready/operation_builder.rb +1 -1
  33. data/lib/cable_ready/sanity_checker.rb +1 -31
  34. data/lib/cable_ready/version.rb +1 -1
  35. data/lib/cable_ready.rb +4 -26
  36. data/lib/cable_ready_helper.rb +13 -0
  37. data/lib/generators/cable_ready/channel_generator.rb +51 -12
  38. data/lib/generators/cable_ready/templates/config/initializers/cable_ready.rb +10 -6
  39. data/lib/install/action_cable.rb +144 -0
  40. data/lib/install/broadcaster.rb +109 -0
  41. data/lib/install/bundle.rb +54 -0
  42. data/lib/install/compression.rb +51 -0
  43. data/lib/install/config.rb +39 -0
  44. data/lib/install/development.rb +34 -0
  45. data/lib/install/esbuild.rb +101 -0
  46. data/lib/install/importmap.rb +96 -0
  47. data/lib/install/initializers.rb +15 -0
  48. data/lib/install/mrujs.rb +121 -0
  49. data/lib/install/npm_packages.rb +13 -0
  50. data/lib/install/shakapacker.rb +61 -0
  51. data/lib/install/spring.rb +54 -0
  52. data/lib/install/updatable.rb +34 -0
  53. data/lib/install/vite.rb +62 -0
  54. data/lib/install/webpacker.rb +81 -0
  55. data/lib/install/yarn.rb +56 -0
  56. data/lib/tasks/cable_ready/cable_ready.rake +249 -0
  57. data/package.json +61 -0
  58. data/rollup.config.mjs +76 -0
  59. data/web-test-runner.config.mjs +12 -0
  60. data/yarn.lock +4623 -0
  61. metadata +96 -129
  62. data/LATEST +0 -1
  63. data/app/helpers/cable_ready_helper.rb +0 -25
  64. data/lib/generators/cable_ready/helpers_generator.rb +0 -43
  65. data/lib/generators/cable_ready/initializer_generator.rb +0 -14
  66. data/test/dummy/app/channels/application_cable/channel.rb +0 -4
  67. data/test/dummy/app/channels/application_cable/connection.rb +0 -4
  68. data/test/dummy/app/controllers/application_controller.rb +0 -2
  69. data/test/dummy/app/helpers/application_helper.rb +0 -2
  70. data/test/dummy/app/jobs/application_job.rb +0 -7
  71. data/test/dummy/app/mailers/application_mailer.rb +0 -4
  72. data/test/dummy/app/models/application_record.rb +0 -3
  73. data/test/dummy/app/models/global_idable_entity.rb +0 -16
  74. data/test/dummy/app/models/post.rb +0 -4
  75. data/test/dummy/app/models/section.rb +0 -6
  76. data/test/dummy/app/models/team.rb +0 -6
  77. data/test/dummy/app/models/topic.rb +0 -4
  78. data/test/dummy/app/models/user.rb +0 -7
  79. data/test/dummy/config/application.rb +0 -22
  80. data/test/dummy/config/boot.rb +0 -5
  81. data/test/dummy/config/environment.rb +0 -5
  82. data/test/dummy/config/environments/development.rb +0 -76
  83. data/test/dummy/config/environments/production.rb +0 -120
  84. data/test/dummy/config/environments/test.rb +0 -59
  85. data/test/dummy/config/initializers/application_controller_renderer.rb +0 -8
  86. data/test/dummy/config/initializers/assets.rb +0 -12
  87. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -8
  88. data/test/dummy/config/initializers/cable_ready.rb +0 -18
  89. data/test/dummy/config/initializers/content_security_policy.rb +0 -28
  90. data/test/dummy/config/initializers/cookies_serializer.rb +0 -5
  91. data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -6
  92. data/test/dummy/config/initializers/inflections.rb +0 -16
  93. data/test/dummy/config/initializers/mime_types.rb +0 -4
  94. data/test/dummy/config/initializers/permissions_policy.rb +0 -11
  95. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  96. data/test/dummy/config/puma.rb +0 -43
  97. data/test/dummy/config/routes.rb +0 -3
  98. data/test/dummy/db/migrate/20210902154139_create_users.rb +0 -9
  99. data/test/dummy/db/migrate/20210902154153_create_posts.rb +0 -10
  100. data/test/dummy/db/migrate/20210904081930_create_topics.rb +0 -9
  101. data/test/dummy/db/migrate/20210904093607_create_sections.rb +0 -9
  102. data/test/dummy/db/migrate/20210913191735_create_teams.rb +0 -8
  103. data/test/dummy/db/migrate/20210913191759_add_team_reference_to_users.rb +0 -5
  104. data/test/dummy/db/schema.rb +0 -49
  105. data/test/dummy/test/models/post_test.rb +0 -7
  106. data/test/dummy/test/models/section_test.rb +0 -7
  107. data/test/dummy/test/models/team_test.rb +0 -7
  108. data/test/dummy/test/models/topic_test.rb +0 -7
  109. data/test/dummy/test/models/user_test.rb +0 -7
  110. data/test/lib/cable_ready/cable_car_test.rb +0 -50
  111. data/test/lib/cable_ready/compoundable_test.rb +0 -26
  112. data/test/lib/cable_ready/helper_test.rb +0 -25
  113. data/test/lib/cable_ready/identifiable_test.rb +0 -69
  114. data/test/lib/cable_ready/operation_builder_test.rb +0 -189
  115. data/test/lib/cable_ready/updatable_test.rb +0 -112
  116. data/test/lib/generators/cable_ready/channel_generator_test.rb +0 -157
  117. data/test/support/generator_test_helpers.rb +0 -28
  118. data/test/test_helper.rb +0 -18
@@ -0,0 +1,249 @@
1
+ # frozen_string_literal: true
2
+
3
+ include Rails.application.routes.url_helpers
4
+
5
+ CR_STEPS = {
6
+ "action_cable" => "Action Cable",
7
+ "webpacker" => "CableReady using Webpacker",
8
+ "shakapacker" => "CableReady using Shakapacker",
9
+ "npm_packages" => "Install CableReady npm package",
10
+ "importmap" => "Install CableReady using importmaps",
11
+ "esbuild" => "Install CableReady using esbuild",
12
+ "config" => "Client initialization",
13
+ "initializers" => "Generate and configure initializer",
14
+ "development" => "development environment configuration",
15
+ "spring" => "Disable spring gem. Spring has been removed from Rails 7",
16
+ "mrujs" => "Swap out UJS for mrujs",
17
+ "broadcaster" => "Make CableReady::Broadcaster available to channels, controllers, jobs and models",
18
+ "updatable" => "Include CableReady::Updatable in Active Record model classes",
19
+ "vite" => "CableReady using Vite",
20
+ "compression" => "Compress WebSockets traffic with gzip"
21
+ }
22
+
23
+ CR_BUNDLERS = {
24
+ "webpacker" => ["npm_packages", "webpacker", "config", "action_cable", "development", "initializers", "broadcaster", "updatable", "spring", "yarn", "bundle"],
25
+ "esbuild" => ["npm_packages", "esbuild", "config", "action_cable", "development", "initializers", "broadcaster", "updatable", "spring", "yarn", "bundle"],
26
+ "vite" => ["npm_packages", "vite", "config", "action_cable", "development", "initializers", "broadcaster", "updatable", "spring", "yarn", "bundle"],
27
+ "shakapacker" => ["npm_packages", "shakapacker", "config", "action_cable", "development", "initializers", "broadcaster", "updatable", "spring", "yarn", "bundle"],
28
+ "importmap" => ["config", "action_cable", "importmap", "development", "initializers", "broadcaster", "updatable", "spring", "bundle"]
29
+ }
30
+
31
+ def run_install_template(template, force: false, trace: false)
32
+ puts "--- [#{template}] ----"
33
+
34
+ if Rails.root.join("tmp/cable_ready_installer/halt").exist?
35
+ FileUtils.rm(Rails.root.join("tmp/cable_ready_installer/halt"))
36
+ puts "CableReady installation halted. Please fix the issues above and try again."
37
+ exit
38
+ end
39
+ if Rails.root.join("tmp/cable_ready_installer/#{template}").exist? && !force
40
+ puts "👍 Step #{template} already completed. Skipping."
41
+ return
42
+ end
43
+
44
+ system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{File.expand_path("../../install/#{template}.rb", __dir__)} SKIP_SANITY_CHECK=true #{"--trace" if trace}"
45
+
46
+ puts
47
+ end
48
+
49
+ namespace :cable_ready do
50
+ desc "✨ Install CableReady ✨"
51
+ task :install do
52
+ FileUtils.mkdir_p(Rails.root.join("tmp/cable_ready_installer/templates"))
53
+ FileUtils.mkdir_p(Rails.root.join("tmp/cable_ready_installer/working"))
54
+ install_complete = Rails.root.join("tmp/cable_ready_installer/complete")
55
+
56
+ bundler = nil
57
+ options = {}
58
+
59
+ ARGV.each do |arg|
60
+ # make sure we have a valid build tool specified, or proceed to automatic detection
61
+ if ["webpacker", "esbuild", "vite", "shakapacker", "importmap"].include?(arg)
62
+ bundler = arg
63
+ else
64
+ kv = arg.split("=")
65
+ if kv.length == 2
66
+ kv[1] = if kv[1] == "true"
67
+ true
68
+ else
69
+ (kv[1] == "false") ? false : kv[1]
70
+ end
71
+ options[kv[0]] = kv[1]
72
+ end
73
+ end
74
+ end
75
+
76
+ options_path = Rails.root.join("tmp/cable_ready_installer/options")
77
+ options_path.write(options.to_yaml)
78
+
79
+ if defined?(StimulusReflex)
80
+ puts "✨ \e[38;5;220mStimulusReflex\e[0m is present in this project ✨"
81
+ puts
82
+ puts "CableReady will be installed with StimulusReflex. Just run: \e[38;5;231mrails stimulus_reflex:install\e[0m"
83
+ puts
84
+ puts "Get help on Discord: \e[4;97mhttps://discord.gg/stimulus-reflex\e[0m. \e[38;5;196mWe are here for you.\e[0m 💙"
85
+ puts
86
+ exit
87
+ end
88
+
89
+ if install_complete.exist?
90
+ puts "✨ \e[38;5;220mCableReady\e[0m is already installed ✨"
91
+ puts
92
+ puts "To restart the installation process, run: \e[38;5;231mrails cable_ready:install:restart\e[0m"
93
+ puts
94
+ puts "To get started, check out \e[4;97mhttps://cableready.stimulusreflex.com/guide/cableready-101\e[0m"
95
+ puts "or get help on Discord: \e[4;97mhttps://discord.gg/stimulus-reflex\e[0m. \e[38;5;196mWe are here for you.\e[0m 💙"
96
+ puts
97
+ exit
98
+ end
99
+
100
+ # if there is an installation in progress, continue where we left off
101
+ cached_entrypoint = Rails.root.join("tmp/cable_ready_installer/entrypoint")
102
+
103
+ if cached_entrypoint.exist?
104
+ entrypoint = File.read(cached_entrypoint)
105
+ puts "✨ Resuming \e[38;5;220mCableReady\e[0m installation ✨"
106
+ puts
107
+ puts "If you have any setup issues, please consult \e[4;97mhttps://cableready.stimulusreflex.com/hello-world/setup\e[0m"
108
+ puts "or get help on Discord: \e[4;97mhttps://discord.gg/stimulus-reflex\e[0m. \e[38;5;196mWe are here for you.\e[0m 💙"
109
+ puts
110
+ puts "Resuming installation into \e[1m#{entrypoint}\e[22m"
111
+ puts "Run \e[1;94mrails cable_ready:install:restart\e[0m to restart the installation process"
112
+ puts
113
+ else
114
+ puts "✨ Installing \e[38;5;220mCableReady\e[0m ✨"
115
+ puts
116
+ puts "If you have any setup issues, please consult \e[4;97mhttps://cableready.stimulusreflex.com/hello-world/setup\e[0m"
117
+ puts "or get help on Discord: \e[4;97mhttps://discord.gg/stimulus-reflex\e[0m. \e[38;5;196mWe are here for you.\e[0m 💙"
118
+ if Rails.root.join(".git").exist?
119
+ puts
120
+ puts "We recommend running \e[1;94mgit commit\e[0m before proceeding. A diff will be generated at the end."
121
+ end
122
+
123
+ if options.key? "entrypoint"
124
+ entrypoint = options["entrypoint"]
125
+ else
126
+ entrypoint = [
127
+ "app/javascript",
128
+ "app/frontend"
129
+ ].find { |path| File.exist?(Rails.root.join(path)) } || "app/javascript"
130
+
131
+ puts
132
+ puts "Where do JavaScript files live in your app? Our best guess is: \e[1m#{entrypoint}\e[22m 🤔"
133
+ puts "Press enter to accept this, or type a different path."
134
+ print "> "
135
+ input = $stdin.gets.chomp
136
+ entrypoint = input unless input.blank?
137
+ end
138
+ File.write(cached_entrypoint, entrypoint)
139
+ end
140
+
141
+ # verify their bundler before starting, unless they explicitly specified on CLI
142
+ if !bundler
143
+ # auto-detect build tool based on existing packages and configuration
144
+ if Rails.root.join("config/importmap.rb").exist?
145
+ bundler = "importmap"
146
+ elsif Rails.root.join("package.json").exist?
147
+ package_json = File.read(Rails.root.join("package.json"))
148
+ bundler = "webpacker" if package_json.include?('"@rails/webpacker":')
149
+ bundler = "esbuild" if package_json.include?('"esbuild":')
150
+ bundler = "vite" if package_json.include?('"vite":')
151
+ bundler = "shakapacker" if package_json.include?('"shakapacker":')
152
+ if !bundler
153
+ puts "❌ You must be using a node-based bundler such as esbuild, webpacker, vite or shakapacker (package.json) or importmap (config/importmap.rb) to use CableReady."
154
+ exit
155
+ end
156
+ else
157
+ puts "❌ You must be using a node-based bundler such as esbuild, webpacker, vite or shakapacker (package.json) or importmap (config/importmap.rb) to use CableReady."
158
+ exit
159
+ end
160
+
161
+ puts
162
+ puts "It looks like you're using \e[1m#{bundler}\e[22m as your bundler. Is that correct? (Y/n)"
163
+ print "> "
164
+ input = $stdin.gets.chomp
165
+ if input.downcase == "n"
166
+ puts
167
+ puts "CableReady installation supports: esbuild, webpacker, vite, shakapacker and importmap."
168
+ puts "Please run \e[1;94mrails cable_ready:install [bundler]\e[0m to install CableReady."
169
+ exit
170
+ end
171
+ end
172
+
173
+ File.write("tmp/cable_ready_installer/bundler", bundler)
174
+ FileUtils.touch("tmp/cable_ready_installer/backups")
175
+ File.write("tmp/cable_ready_installer/template_src", File.expand_path("../../generators/cable_ready/templates/", __dir__))
176
+
177
+ # do the things
178
+ CR_BUNDLERS[bundler].each do |template|
179
+ run_install_template(template, trace: !!options["trace"])
180
+ end
181
+
182
+ puts
183
+ puts "🎉 \e[1;92mCableReady has been successfully installed!\e[22m 🎉"
184
+ puts
185
+ puts "👉 \e[4;97mhttps://cableready.stimulusreflex.com/guide/cableready-101\e[0m"
186
+ puts
187
+ puts "Join over 2000 CableReady developers on Discord: \e[4;97mhttps://discord.gg/stimulus-reflex\e[0m"
188
+ puts
189
+
190
+ backups = File.readlines("tmp/cable_ready_installer/backups").map(&:chomp)
191
+
192
+ if backups.any?
193
+ puts "🙆 The following files were modified during installation:"
194
+ puts
195
+ backups.each { |backup| puts " #{backup}" }
196
+ puts
197
+ puts "Each of these files has been backed up with a .bak extension. Please review the changes carefully."
198
+ puts "If you're happy with the changes, you can delete the .bak files."
199
+ puts
200
+ end
201
+
202
+ if Rails.root.join(".git").exist?
203
+ system "git diff > tmp/cable_ready_installer.diff"
204
+ puts "🏮 A diff of all changes has been saved to \e[1mtmp/cable_ready_installer.diff\e[22m"
205
+ puts
206
+ end
207
+
208
+ FileUtils.touch(install_complete)
209
+ `pkill -f spring` if Rails.root.join("tmp/cable_ready_installer/kill_spring").exist?
210
+ exit
211
+ end
212
+
213
+ namespace :install do
214
+ desc "Restart CableReady installation"
215
+ task :restart do
216
+ FileUtils.rm_rf Rails.root.join("tmp/cable_ready_installer")
217
+ system "rails cable_ready:install #{ARGV.join(" ")}"
218
+ exit
219
+ end
220
+
221
+ desc <<~DESC
222
+ Re-run specific CableReady install steps
223
+
224
+ #{CR_STEPS.sort.map { |step, description| "#{step.ljust(20)} #{description}" }.join("\n")}
225
+ DESC
226
+
227
+ task :step do
228
+ def warning(step = nil)
229
+ return if step.to_s.include?("=")
230
+ if step
231
+ puts "⚠️ #{step} is not a valid step. Valid steps are: #{CR_STEPS.keys.join(", ")}"
232
+ else
233
+ puts "❌ You must specify a step to re-run. Valid steps are: #{CR_STEPS.keys.join(", ")}"
234
+ puts "Example: \e[1;94mrails cable_ready:install:step initializers\e[0m"
235
+ end
236
+ end
237
+
238
+ warning if ARGV.empty?
239
+
240
+ ARGV.each do |step|
241
+ CR_STEPS.include?(step) ? run_install_template(step, force: true) : warning(step)
242
+ end
243
+
244
+ run_install_template(:bundle, force: true)
245
+ run_install_template(:yarn, force: true)
246
+ exit
247
+ end
248
+ end
249
+ end
data/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "cable_ready",
3
+ "version": "5.0.0-pre10",
4
+ "description": "CableReady helps you create great real-time user experiences by making it simple to trigger client-side DOM changes from server-side Ruby.",
5
+ "keywords": [
6
+ "ruby",
7
+ "rails",
8
+ "websockets",
9
+ "actioncable",
10
+ "cable",
11
+ "ssr",
12
+ "stimulus_reflex",
13
+ "client-side",
14
+ "dom"
15
+ ],
16
+ "homepage": "https://cableready.stimulusreflex.com",
17
+ "bugs": "https://github.com/stimulusreflex/cable_ready/issues",
18
+ "repository": "https://github.com/stimulusreflex/cable_ready",
19
+ "license": "MIT",
20
+ "author": "Nathan Hopkins <natehop@gmail.com>",
21
+ "contributors": [
22
+ "Andrew Mason <andrewmcodes@protonmail.com>",
23
+ "Julian Rubisch <julian@julianrubisch.at>",
24
+ "Marco Roth <marco.roth@intergga.ch>",
25
+ "Nathan Hopkins <natehop@gmail.com>"
26
+ ],
27
+ "main": "./dist/cable_ready.js",
28
+ "module": "./dist/cable_ready.js",
29
+ "browser": "./dist/cable_ready.js",
30
+ "import": "./dist/cable_ready.js",
31
+ "unpkg": "./dist/cable_ready.umd.js",
32
+ "umd": "./dist/cable_ready.umd.js",
33
+ "files": [
34
+ "dist/*",
35
+ "javascript/*"
36
+ ],
37
+ "scripts": {
38
+ "lint": "yarn run prettier-standard:check",
39
+ "format": "yarn run prettier-standard:format",
40
+ "prettier-standard:check": "yarn run prettier-standard --check ./javascript/**/*.js rollup.config.js",
41
+ "prettier-standard:format": "yarn run prettier-standard ./javascript/**/*.js rollup.config.js",
42
+ "build": "yarn rollup -c",
43
+ "watch": "yarn rollup -wc",
44
+ "test": "web-test-runner javascript/test/**/*.test.js"
45
+ },
46
+ "dependencies": {
47
+ "morphdom": "2.6.1"
48
+ },
49
+ "devDependencies": {
50
+ "@open-wc/testing": "^3.1.7",
51
+ "@rollup/plugin-json": "^6.0.0",
52
+ "@rollup/plugin-node-resolve": "^15.0.1",
53
+ "@rollup/plugin-terser": "^0.4.0",
54
+ "@web/dev-server-esbuild": "^0.3.3",
55
+ "@web/dev-server-rollup": "^0.3.21",
56
+ "@web/test-runner": "^0.15.0",
57
+ "prettier-standard": "^16.4.1",
58
+ "rollup": "^3.15.0",
59
+ "sinon": "^15.0.1"
60
+ }
61
+ }
data/rollup.config.mjs ADDED
@@ -0,0 +1,76 @@
1
+ import resolve from '@rollup/plugin-node-resolve'
2
+ import json from '@rollup/plugin-json'
3
+ import terser from '@rollup/plugin-terser'
4
+
5
+ const pretty = () => {
6
+ return terser({
7
+ mangle: false,
8
+ compress: false,
9
+ format: {
10
+ comments: 'all',
11
+ beautify: true,
12
+ indent_level: 2
13
+ }
14
+ })
15
+ }
16
+
17
+ const minify = () => {
18
+ return terser({
19
+ mangle: true,
20
+ compress: true
21
+ })
22
+ }
23
+
24
+ const esConfig = {
25
+ format: 'es',
26
+ inlineDynamicImports: true
27
+ }
28
+
29
+ const umdConfig = {
30
+ name: 'CableReady',
31
+ format: 'umd',
32
+ exports: 'named',
33
+ globals: { morphdom: 'morphdom' }
34
+ }
35
+
36
+ const baseName = 'cable_ready'
37
+ const distFolders = ['dist', 'app/assets/javascripts']
38
+
39
+ const output = distFolders
40
+ .map(distFolder => [
41
+ {
42
+ ...esConfig,
43
+ file: `${distFolder}/${baseName}.js`,
44
+ plugins: [pretty()]
45
+ },
46
+ {
47
+ ...esConfig,
48
+ file: `${distFolder}/${baseName}.min.js`,
49
+ sourcemap: true,
50
+ plugins: [minify()]
51
+ },
52
+ {
53
+ ...umdConfig,
54
+ file: `${distFolder}/${baseName}.umd.js`,
55
+ plugins: [pretty()]
56
+ },
57
+ {
58
+ ...umdConfig,
59
+ file: `${distFolder}/${baseName}.umd.min.js`,
60
+ sourcemap: true,
61
+ plugins: [minify()]
62
+ }
63
+ ])
64
+ .flat()
65
+
66
+ export default [
67
+ {
68
+ external: ['morphdom'],
69
+ input: 'javascript/index.js',
70
+ output,
71
+ plugins: [resolve(), json()],
72
+ watch: {
73
+ include: 'javascript/**'
74
+ }
75
+ }
76
+ ]
@@ -0,0 +1,12 @@
1
+ import rollupJson from '@rollup/plugin-json'
2
+ import { fromRollup } from '@web/dev-server-rollup'
3
+
4
+ const json = fromRollup(rollupJson)
5
+
6
+ export default {
7
+ nodeResolve: true,
8
+ mimeTypes: {
9
+ '**/*.json': 'js'
10
+ },
11
+ plugins: [json({})]
12
+ }