vue_live 0.1.0 → 0.1.1
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/CHANGELOG.md +3 -3
- data/README.md +12 -12
- data/lib/vue_live/cli.rb +3 -3
- data/lib/vue_live/compiler/node/compile.js +2 -2
- data/lib/vue_live/compiler.rb +1 -1
- data/lib/vue_live/configuration.rb +1 -1
- data/lib/vue_live/node_tools.rb +3 -3
- data/lib/vue_live/version.rb +1 -1
- metadata +7 -7
- /data/exe/{vue-live → vue_live} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b902545c0af7baa4c630504595275d9ce2ffdc811efc963590a214575515f78a
|
|
4
|
+
data.tar.gz: df805dffdf463a0125b370f62e31c5997006b280127255ece72bf08c0bf6b60f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1b1945dc95bc59d2474622152d4a031b026396c2b1c97639bfa725db542989e31abcd2515693db3679ed4b4fe33407af5c55bdece59b4e3bf2a3eea8e996b789
|
|
7
|
+
data.tar.gz: fe52d0057fc840aa7e748b7178eea2aee2cbdb4b25e469fbc4a40ad97ff5a7e5732b62bc07e60a905a980145f3057c9ad412a53af81c1b9d9d3477d7715905b8
|
data/CHANGELOG.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* Framework-agnostic helpers, Sinatra extension, Rails Railtie (middleware, helpers with CSP
|
|
13
13
|
nonces, `config.vue_live`, `config/vue_live.yml`, generator, rake tasks, importmap-rails pin).
|
|
14
14
|
* Precompiler writing static `.vue.js` modules and a manifest.
|
|
15
|
-
* `
|
|
15
|
+
* `vue_live` CLI: `init`, `compile`, `clobber`, `check`, `node-setup`, `info`.
|
|
16
16
|
* Development live reload over Server-Sent Events (`<prefix>/-/events`, `<prefix>/-/reload.js`),
|
|
17
17
|
included automatically by `vue_live_mount_tag`.
|
|
18
18
|
* Persistent Node worker for the Node backend (a few ms per compile after start-up).
|
|
@@ -23,6 +23,6 @@
|
|
|
23
23
|
* `rake test:setup` installs the Node packages and Chromium the optional tests need; those tests
|
|
24
24
|
auto-detect them instead of requiring environment variables.
|
|
25
25
|
* RuboCop configuration and CI job.
|
|
26
|
-
* TypeScript on Node.js < 22.13: `rake test:setup` and `
|
|
27
|
-
Node cannot strip types itself, `VUE_LIVE_TS_TRANSPILER` pins a transpiler, `
|
|
26
|
+
* TypeScript on Node.js < 22.13: `rake test:setup` and `vue_live node-setup` install sucrase when
|
|
27
|
+
Node cannot strip types itself, `VUE_LIVE_TS_TRANSPILER` pins a transpiler, `vue_live check`
|
|
28
28
|
warns about the gap, and CI covers Node 20 (#3).
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# vue_live
|
|
2
2
|
|
|
3
|
-
[](https://github.com/danielpclark/vue_live/actions/workflows/ci.yml)
|
|
4
4
|
|
|
5
5
|
**Serve Vue single-file components straight from Ruby, in production, with no build step.**
|
|
6
6
|
|
|
@@ -68,7 +68,7 @@ without tying itself to Rails or to any asset pipeline.
|
|
|
68
68
|
# Gemfile
|
|
69
69
|
gem 'vue_live'
|
|
70
70
|
# Until the first release is on RubyGems:
|
|
71
|
-
# gem 'vue_live', github: 'danielpclark/
|
|
71
|
+
# gem 'vue_live', github: 'danielpclark/vue_live'
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
Requires Ruby 3.0+. Node.js is **not** required unless you opt into the
|
|
@@ -147,7 +147,7 @@ end
|
|
|
147
147
|
`set :vue_live` has to come first. `config/vue_live.yml` is read as well, if present.
|
|
148
148
|
Classic-style apps (`require 'sinatra'`) call `register VueLive::Sinatra` at the top level.
|
|
149
149
|
|
|
150
|
-
`
|
|
150
|
+
`vue_live init` scaffolds `config/vue_live.yml` and `app/vue/HelloVueLive.vue` in any project.
|
|
151
151
|
|
|
152
152
|
## Quick start: plain Rack
|
|
153
153
|
|
|
@@ -303,8 +303,8 @@ compile instead.
|
|
|
303
303
|
Enable the Node backend with:
|
|
304
304
|
|
|
305
305
|
```sh
|
|
306
|
-
|
|
307
|
-
|
|
306
|
+
vue_live node-setup # npm/yarn add @vue/compiler-sfc vue
|
|
307
|
+
vue_live node-setup --with sass # plus preprocessors you use
|
|
308
308
|
bin/rails vue_live:node_setup # the same, under Rails
|
|
309
309
|
```
|
|
310
310
|
|
|
@@ -314,10 +314,10 @@ installed its package manager detection is reused, so projects already built wit
|
|
|
314
314
|
nothing extra.
|
|
315
315
|
|
|
316
316
|
**TypeScript.** Node.js 22.13+ strips types itself. On older Node.js a transpiler package is
|
|
317
|
-
needed; `
|
|
317
|
+
needed; `vue_live node-setup` adds [sucrase](https://github.com/alangpierce/sucrase) automatically
|
|
318
318
|
in that case (pure JavaScript, keeps line numbers so source maps stay exact).
|
|
319
319
|
`VUE_LIVE_TS_TRANSPILER=node|sucrase|esbuild|typescript|babel` pins one when several are
|
|
320
|
-
installed, and `
|
|
320
|
+
installed, and `vue_live check` warns when a Node.js that cannot strip types has no transpiler.
|
|
321
321
|
|
|
322
322
|
## Development: live reload, errors, source maps
|
|
323
323
|
|
|
@@ -347,7 +347,7 @@ installed, and `vue-live check` warns when a Node.js that cannot strip types has
|
|
|
347
347
|
* Responses carry an `ETag`; URLs from `vue_live_path` include `?v=<digest>` and are served with
|
|
348
348
|
`Cache-Control: public, max-age=31536000, immutable` in production.
|
|
349
349
|
* In production a component that fails to compile is a 500 with the details in the log.
|
|
350
|
-
* `
|
|
350
|
+
* `vue_live compile` / `bin/rails vue_live:precompile` writes every component as a static
|
|
351
351
|
`.vue.js` file plus `manifest.json` to `public/vue`, for a CDN or `nginx`. When the manifest
|
|
352
352
|
exists in production, `vue_live_path` reads URLs from it, so a web server or CDN in front of
|
|
353
353
|
`public/` serves the files and the app never compiles them. Without one, the middleware still
|
|
@@ -362,7 +362,7 @@ installed, and `vue-live check` warns when a Node.js that cannot strip types has
|
|
|
362
362
|
| Precompile | Run `bin/rails vue_live:precompile` in your build (Dockerfile, CI, or `hook_assets_precompile: true`). | CDNs, `nginx` serving `public/`, zero compile cost at runtime |
|
|
363
363
|
|
|
364
364
|
In production the CDN URL switches to `vue.esm-browser.prod.js` automatically, and
|
|
365
|
-
`
|
|
365
|
+
`vue_live check` / `bin/rails vue_live:check` verifies that every component compiles before you ship.
|
|
366
366
|
|
|
367
367
|
## Browser support and trade-offs
|
|
368
368
|
|
|
@@ -408,7 +408,7 @@ the current environment's section), then Ruby (`VueLive.configure` or `config.vu
|
|
|
408
408
|
| `import_map` | `{}` | extra import-map entries |
|
|
409
409
|
| `extensions` | `.vue .js .mjs .css .json` + images/fonts | files the middleware will serve from `source_path` |
|
|
410
410
|
| `node_bin` | `node` | Node executable |
|
|
411
|
-
| `precompile_path` | `public/vue` | output of `
|
|
411
|
+
| `precompile_path` | `public/vue` | output of `vue_live compile` |
|
|
412
412
|
| `use_manifest` | auto | read `public/vue/manifest.json` for URLs (auto: in production when it exists) |
|
|
413
413
|
| `middleware` | `true` | mount automatically (Railtie / Sinatra); set `false` to `use` it yourself |
|
|
414
414
|
| `importmap_pin` | `true` | pin `vue` into importmap-rails |
|
|
@@ -429,10 +429,10 @@ Environment variables:
|
|
|
429
429
|
|
|
430
430
|
## Command line and rake tasks
|
|
431
431
|
|
|
432
|
-
The gem ships a `
|
|
432
|
+
The gem ships a `vue_live` executable for any project and the same operations as rake tasks
|
|
433
433
|
under Rails:
|
|
434
434
|
|
|
435
|
-
| `
|
|
435
|
+
| `vue_live` | Rails | Does |
|
|
436
436
|
| --- | --- | --- |
|
|
437
437
|
| `init [--force] [--node]` | `bin/rails generate vue_live:install [--node] [--skip-example]` | create `config/vue_live.yml` and `app/vue/HelloVueLive.vue` |
|
|
438
438
|
| `compile [--out DIR]` | `bin/rails vue_live:precompile` | write static `.vue.js` modules + `manifest.json` |
|
data/lib/vue_live/cli.rb
CHANGED
|
@@ -4,14 +4,14 @@ require 'fileutils'
|
|
|
4
4
|
require_relative '../vue_live'
|
|
5
5
|
|
|
6
6
|
module VueLive
|
|
7
|
-
# The `
|
|
7
|
+
# The `vue_live` executable.
|
|
8
8
|
class CLI
|
|
9
9
|
TEMPLATE_DIR = File.expand_path('templates', __dir__)
|
|
10
10
|
|
|
11
11
|
USAGE = <<~TEXT.freeze
|
|
12
|
-
|
|
12
|
+
vue_live #{VueLive::VERSION}
|
|
13
13
|
|
|
14
|
-
Usage:
|
|
14
|
+
Usage: vue_live <command> [options]
|
|
15
15
|
|
|
16
16
|
Commands:
|
|
17
17
|
init Create config/vue_live.yml and app/vue/ with an example component
|
|
@@ -32,7 +32,7 @@ try {
|
|
|
32
32
|
sfc = require(entry)
|
|
33
33
|
sfcDir = path.dirname(entry)
|
|
34
34
|
} catch (e) {
|
|
35
|
-
const err = { errors: ['@vue/compiler-sfc is not installed in ' + root + ' (run `
|
|
35
|
+
const err = { errors: ['@vue/compiler-sfc is not installed in ' + root + ' (run `vue_live node-setup`)'] }
|
|
36
36
|
process.stdout.write(JSON.stringify(err) + '\n')
|
|
37
37
|
process.exit(1)
|
|
38
38
|
}
|
|
@@ -274,7 +274,7 @@ function stripTypes(code, filename, lang) {
|
|
|
274
274
|
if (real) throw real
|
|
275
275
|
throw new Error(
|
|
276
276
|
'<script lang="ts"> needs a TypeScript transpiler and none is available (Node.js ' + process.version +
|
|
277
|
-
' has no built-in one; that needs >= 22.13). Install one in the project: `
|
|
277
|
+
' has no built-in one; that needs >= 22.13). Install one in the project: `vue_live node-setup --with sucrase`' +
|
|
278
278
|
'(or esbuild, @babel/core + @babel/plugin-transform-typescript, typescript < 7); for this gem\'s own tests run `rake test:setup`.'
|
|
279
279
|
)
|
|
280
280
|
}
|
data/lib/vue_live/compiler.rb
CHANGED
|
@@ -40,7 +40,7 @@ module VueLive
|
|
|
40
40
|
else
|
|
41
41
|
raise UnsupportedFeature.new(
|
|
42
42
|
"uses #{descriptor.advanced_features.join(', ')}, which the pure Ruby compiler cannot handle. " \
|
|
43
|
-
'Install Node.js and @vue/compiler-sfc (`
|
|
43
|
+
'Install Node.js and @vue/compiler-sfc (`vue_live node-setup`) to enable the Node backend,' \
|
|
44
44
|
'or rewrite the component with a plain <script> / <style> block.',
|
|
45
45
|
file: descriptor.filename
|
|
46
46
|
)
|
|
@@ -46,7 +46,7 @@ module VueLive
|
|
|
46
46
|
attr_accessor :node_bin
|
|
47
47
|
# Allowed file extensions under +source_path+.
|
|
48
48
|
attr_accessor :extensions
|
|
49
|
-
# Output directory for +
|
|
49
|
+
# Output directory for +vue_live compile+ (precompiled, static ES modules).
|
|
50
50
|
attr_accessor :precompile_path
|
|
51
51
|
# Use public/vue/manifest.json for URLs instead of the live middleware. nil = auto
|
|
52
52
|
# (true in production when the manifest exists).
|
data/lib/vue_live/node_tools.rb
CHANGED
|
@@ -88,18 +88,18 @@ module VueLive
|
|
|
88
88
|
true
|
|
89
89
|
end
|
|
90
90
|
|
|
91
|
-
# Human-readable status for `
|
|
91
|
+
# Human-readable status for `vue_live check`.
|
|
92
92
|
def problems(config = VueLive.config)
|
|
93
93
|
problems = []
|
|
94
94
|
problems << "component directory does not exist: #{config.source_dir}" unless File.directory?(config.source_dir)
|
|
95
95
|
if %i[node].include?(config.compiler.to_sym)
|
|
96
96
|
problems << 'Node.js was not found in PATH (required by compiler: node)' unless node_version(config)
|
|
97
|
-
problems << '@vue/compiler-sfc is not installed (run `
|
|
97
|
+
problems << '@vue/compiler-sfc is not installed (run `vue_live node-setup`)' unless compiler_sfc_version(config.root)
|
|
98
98
|
end
|
|
99
99
|
if %i[node auto].include?(config.compiler.to_sym) && node_version(config) && !node_strips_types?(config) &&
|
|
100
100
|
installed_ts_transpilers(config.root).empty?
|
|
101
101
|
problems << "Node.js #{node_version(config)} cannot strip TypeScript and no transpiler is installed; " \
|
|
102
|
-
'<script lang="ts"> components will fail (run `
|
|
102
|
+
'<script lang="ts"> components will fail (run `vue_live node-setup --with sucrase`)'
|
|
103
103
|
end
|
|
104
104
|
problems
|
|
105
105
|
end
|
data/lib/vue_live/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vue_live
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel P. Clark
|
|
@@ -222,7 +222,7 @@ description: |-
|
|
|
222
222
|
email:
|
|
223
223
|
- 6ftdan@gmail.com
|
|
224
224
|
executables:
|
|
225
|
-
-
|
|
225
|
+
- vue_live
|
|
226
226
|
extensions: []
|
|
227
227
|
extra_rdoc_files: []
|
|
228
228
|
files:
|
|
@@ -230,7 +230,7 @@ files:
|
|
|
230
230
|
- LICENSE-APACHE
|
|
231
231
|
- LICENSE-MIT
|
|
232
232
|
- README.md
|
|
233
|
-
- exe/
|
|
233
|
+
- exe/vue_live
|
|
234
234
|
- lib/generators/vue_live/install/install_generator.rb
|
|
235
235
|
- lib/vue_live.rb
|
|
236
236
|
- lib/vue_live/assets/reload.js
|
|
@@ -262,14 +262,14 @@ files:
|
|
|
262
262
|
- lib/vue_live/templates/HelloVueLive.vue
|
|
263
263
|
- lib/vue_live/templates/vue_live.yml
|
|
264
264
|
- lib/vue_live/version.rb
|
|
265
|
-
homepage: https://github.com/danielpclark/
|
|
265
|
+
homepage: https://github.com/danielpclark/vue_live
|
|
266
266
|
licenses:
|
|
267
267
|
- MIT
|
|
268
268
|
- Apache-2.0
|
|
269
269
|
metadata:
|
|
270
|
-
source_code_uri: https://github.com/danielpclark/
|
|
271
|
-
changelog_uri: https://github.com/danielpclark/
|
|
272
|
-
bug_tracker_uri: https://github.com/danielpclark/
|
|
270
|
+
source_code_uri: https://github.com/danielpclark/vue_live
|
|
271
|
+
changelog_uri: https://github.com/danielpclark/vue_live/blob/main/CHANGELOG.md
|
|
272
|
+
bug_tracker_uri: https://github.com/danielpclark/vue_live/issues
|
|
273
273
|
rubygems_mfa_required: 'true'
|
|
274
274
|
rdoc_options: []
|
|
275
275
|
require_paths:
|
/data/exe/{vue-live → vue_live}
RENAMED
|
File without changes
|