quickjs-polyfill-intl 0.1.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.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/DESIGN.md +60 -0
  3. data/LICENSE +21 -0
  4. data/README.md +119 -0
  5. data/Rakefile +20 -0
  6. data/js/package.json +25 -0
  7. data/js/rolldown.config.mjs +22 -0
  8. data/js/src/collator-en.js +1 -0
  9. data/js/src/datetimeformat-en.js +3 -0
  10. data/js/src/displaynames-en.js +2 -0
  11. data/js/src/durationformat.js +1 -0
  12. data/js/src/getcanonicallocales.js +1 -0
  13. data/js/src/listformat-en.js +2 -0
  14. data/js/src/locale.js +1 -0
  15. data/js/src/numberformat-en.js +2 -0
  16. data/js/src/pluralrules-en.js +2 -0
  17. data/js/src/relativetimeformat-en.js +2 -0
  18. data/js/src/segmenter.js +1 -0
  19. data/js/src/supportedvaluesof.js +1 -0
  20. data/lib/quickjs-polyfill-intl/all.rb +8 -0
  21. data/lib/quickjs-polyfill-intl/collator.rb +18 -0
  22. data/lib/quickjs-polyfill-intl/datetimeformat.rb +18 -0
  23. data/lib/quickjs-polyfill-intl/displaynames.rb +18 -0
  24. data/lib/quickjs-polyfill-intl/durationformat.rb +19 -0
  25. data/lib/quickjs-polyfill-intl/getcanonicallocales.rb +15 -0
  26. data/lib/quickjs-polyfill-intl/listformat.rb +18 -0
  27. data/lib/quickjs-polyfill-intl/locale.rb +18 -0
  28. data/lib/quickjs-polyfill-intl/numberformat.rb +18 -0
  29. data/lib/quickjs-polyfill-intl/pluralrules.rb +18 -0
  30. data/lib/quickjs-polyfill-intl/relativetimeformat.rb +18 -0
  31. data/lib/quickjs-polyfill-intl/segmenter.rb +18 -0
  32. data/lib/quickjs-polyfill-intl/supportedvaluesof.rb +18 -0
  33. data/lib/quickjs-polyfill-intl/vendor/collator-en.min.js +1 -0
  34. data/lib/quickjs-polyfill-intl/vendor/datetimeformat-en.min.js +1 -0
  35. data/lib/quickjs-polyfill-intl/vendor/displaynames-en.min.js +1 -0
  36. data/lib/quickjs-polyfill-intl/vendor/durationformat.min.js +1 -0
  37. data/lib/quickjs-polyfill-intl/vendor/getcanonicallocales.min.js +1 -0
  38. data/lib/quickjs-polyfill-intl/vendor/listformat-en.min.js +1 -0
  39. data/lib/quickjs-polyfill-intl/vendor/locale.min.js +1 -0
  40. data/lib/quickjs-polyfill-intl/vendor/numberformat-en.min.js +3 -0
  41. data/lib/quickjs-polyfill-intl/vendor/pluralrules-en.min.js +2 -0
  42. data/lib/quickjs-polyfill-intl/vendor/relativetimeformat-en.min.js +1 -0
  43. data/lib/quickjs-polyfill-intl/vendor/segmenter.min.js +1 -0
  44. data/lib/quickjs-polyfill-intl/vendor/supportedvaluesof.min.js +1 -0
  45. data/lib/quickjs-polyfill-intl/version.rb +9 -0
  46. data/lib/quickjs-polyfill-intl.rb +6 -0
  47. metadata +102 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0c8d1650264b2e1c472bc714731e3a246ac0c01dd69f479175a02ec1e63ac478
4
+ data.tar.gz: 919abf233fbbf004487475c421e1cd0d81cb86cff55e2937a7824199a732c0fc
5
+ SHA512:
6
+ metadata.gz: f2c8a04c542dc388c97a166f0191b8839a53308a7904766f15918f7f6a1a1f139efe6565ac167784eca75b696d2f6a667e85367267d305e0149d3e792a747613
7
+ data.tar.gz: f81f6d36edce3555b56f9bd9348e88aa58a3353c7be4e3a31d03dc1735cf8fef1786c5246b20b085698e6297cda1b4cda44057ae53694e87becdabd4b379f4bd
data/DESIGN.md ADDED
@@ -0,0 +1,60 @@
1
+ # Design Notes
2
+
3
+ ## Why a companion gem?
4
+
5
+ The original `quickjs.rb` embedded the FormatJS Intl bundle as pre-compiled QuickJS bytecode baked into the `.so` at build time. This had two costs:
6
+
7
+ - ~2.1 MB of bytecode shipped to every installer, regardless of whether they used Intl at all
8
+ - The main gem had to track FormatJS npm packages, version-lock locale data, and run `qjsc` as part of the build
9
+
10
+ Extracting Intl into a companion gem gives downstreams an explicit opt-in and lets the polyfill versioning evolve independently of the QuickJS C extension. The main gem stays focused on the runtime; this gem focuses on the Intl surface.
11
+
12
+ ## register_polyfill API
13
+
14
+ This gem depends on `Quickjs.register_polyfill(name, source:, init: nil)` introduced in `quickjs >= 0.19.0`. The API works as follows:
15
+
16
+ - `name` — a Symbol that consumers pass in `features:` when constructing a VM
17
+ - `source:` — a String or Proc returning one; the Proc form defers the file read until a VM actually opts into the feature
18
+ - `init:` — optional JS that runs before the source in the same compilation unit
19
+
20
+ The first VM that enables a given polyfill pays the parse cost (source compiled to QuickJS bytecode on a disposable VM); all subsequent VMs reuse the cached bytecode. The polyfill load bypasses the user VM's `timeout_msec` budget.
21
+
22
+ All registrations in this gem use the Proc form for `source:` so the JS files are only read when needed.
23
+
24
+ ## Minimal bundles + `_all` convention
25
+
26
+ Each Intl API ships as two registrations:
27
+
28
+ **Minimal (`:<name>`)**: the bundle contains only that API's own code — no dependencies embedded. Works correctly only when all dependency symbols also appear in `features:`, in topological order. Useful when loading multiple Intl APIs into one VM; each minimal bundle has its own bytecode cache entry, so shared deps aren't re-parsed.
29
+
30
+ **Self-contained (`:<name>_all`)**: the bundle concatenates the full dependency chain at source level. One symbol, works standalone. The concatenation happens inside a lazy Proc, so no extra build artifact is needed — the same minimal `.min.js` files serve both paths.
31
+
32
+ The `_all` suffix was chosen over a `depends_on:` parameter on `register_polyfill` to avoid requiring an API change in the main gem. The companion gem handles dependency wiring entirely at the Ruby layer.
33
+
34
+ ## Ruby require chain
35
+
36
+ Each `.rb` file `require_relative`s its direct dependency:
37
+
38
+ ```
39
+ durationformat → datetimeformat → numberformat → pluralrules → locale → getcanonicallocales
40
+ ↘ listformat ↗
41
+ relativetimeformat → numberformat
42
+ supportedvaluesof → datetimeformat
43
+ displaynames → locale
44
+ ```
45
+
46
+ `require 'quickjs-polyfill-intl/datetimeformat'` therefore registers all symbols from `getcanonicallocales` up through `datetimeformat` (both minimal and `_all` variants). Ruby's `require` is idempotent so the chain is safe to traverse multiple times.
47
+
48
+ `require 'quickjs-polyfill-intl/all'` is a convenience that chains through `durationformat` (the deepest node that covers the main chain + listformat) then adds the remaining independent branches: `displaynames`, `relativetimeformat`, `supportedvaluesof`.
49
+
50
+ ## Symbol naming
51
+
52
+ All symbols follow `polyfill_intl_<api_name>` / `polyfill_intl_<api_name>_all`. The prefix matches the convention established by `Quickjs::POLYFILL_INTL` (`:feature_polyfill_intl`) in the main gem. No constants are defined in the `Quickjs` namespace from this gem — consumers use the symbols directly or define their own constants.
53
+
54
+ ## JS build tooling
55
+
56
+ JS sources live in `js/src/` (one file per API, minimal — no deps). Rolldown bundles each into `lib/quickjs-polyfill-intl/vendor/` as an IIFE. The `js/` directory name distinguishes the npm workspace from the Ruby gem content; `vendor/` inside `lib/` mirrors the convention used in the main gem (`ext/quickjsrb/vendor/`).
57
+
58
+ Built files are committed to the repository so consumers don't need Node.js. To rebuild after bumping FormatJS versions: `rake js:build`.
59
+
60
+ APIs with locale data (`displaynames`, `listformat`, `pluralrules`, `numberformat`, `relativetimeformat`, `datetimeformat`) ship English locale only, matching the scope of the original main-gem bundle. Additional locale support is a future concern for this gem.
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kengo Hamasaki
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,119 @@
1
+ # quickjs-polyfill-intl
2
+
3
+ FormatJS Intl polyfills for [quickjs.rb](https://github.com/hmsk/quickjs.rb) — granular, dependency-aware, English locale.
4
+
5
+ [![Gem Version](https://img.shields.io/gem/v/quickjs-polyfill-intl?style=for-the-badge)](https://rubygems.org/gems/quickjs-polyfill-intl) [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/hmsk/quickjs-polyfill-intl/ci.yml?style=for-the-badge)](https://github.com/hmsk/quickjs-polyfill-intl/actions/workflows/ci.yml)
6
+
7
+ ## Installation
8
+
9
+ ```
10
+ gem install quickjs-polyfill-intl
11
+ ```
12
+
13
+ ```rb
14
+ gem 'quickjs-polyfill-intl'
15
+ ```
16
+
17
+ Requires `quickjs >= 0.19.0.pre2`.
18
+
19
+ ## Usage
20
+
21
+ Each Intl API has its own require path. Requiring a path registers two feature symbols:
22
+
23
+ - **`:<name>`** — the API's own bundle only; you must include all dependencies in `features:` yourself (in order).
24
+ - **`:<name>_all`** — a self-contained bundle with all dependencies included; works standalone.
25
+
26
+ ### Standalone (`_all`)
27
+
28
+ The simplest way: one symbol, no manual dependency management.
29
+
30
+ ```rb
31
+ require 'quickjs'
32
+ require 'quickjs-polyfill-intl/datetimeformat'
33
+
34
+ vm = Quickjs::VM.new(features: [:polyfill_intl_datetimeformat_all])
35
+ vm.eval_code('new Intl.DateTimeFormat("en", { year: "numeric" }).format(new Date(0))')
36
+ # => "1970"
37
+ ```
38
+
39
+ ### Granular (minimal symbols)
40
+
41
+ Load each API separately and list them all in `features:` in dependency order. Useful when combining multiple Intl APIs in one VM — each minimal bundle is cached independently, so shared deps aren't recompiled.
42
+
43
+ ```rb
44
+ require 'quickjs'
45
+ require 'quickjs-polyfill-intl/datetimeformat' # chains all deps automatically
46
+
47
+ vm = Quickjs::VM.new(features: [
48
+ :polyfill_intl_getcanonicallocales,
49
+ :polyfill_intl_locale,
50
+ :polyfill_intl_pluralrules,
51
+ :polyfill_intl_numberformat,
52
+ :polyfill_intl_datetimeformat,
53
+ ])
54
+ ```
55
+
56
+ ### Load everything
57
+
58
+ ```rb
59
+ require 'quickjs-polyfill-intl/all'
60
+
61
+ vm = Quickjs::VM.new(features: [:polyfill_intl_datetimeformat_all, :polyfill_intl_listformat_all])
62
+ ```
63
+
64
+ ## Available polyfills
65
+
66
+ | Require path | Symbol | `_all` symbol | Depends on |
67
+ |---|---|---|---|
68
+ | `quickjs-polyfill-intl/getcanonicallocales` | `:polyfill_intl_getcanonicallocales` | `:polyfill_intl_getcanonicallocales_all` | — |
69
+ | `quickjs-polyfill-intl/locale` | `:polyfill_intl_locale` | `:polyfill_intl_locale_all` | getcanonicallocales |
70
+ | `quickjs-polyfill-intl/collator` | `:polyfill_intl_collator` | `:polyfill_intl_collator_all` | locale |
71
+ | `quickjs-polyfill-intl/displaynames` | `:polyfill_intl_displaynames` | `:polyfill_intl_displaynames_all` | locale |
72
+ | `quickjs-polyfill-intl/listformat` | `:polyfill_intl_listformat` | `:polyfill_intl_listformat_all` | locale |
73
+ | `quickjs-polyfill-intl/pluralrules` | `:polyfill_intl_pluralrules` | `:polyfill_intl_pluralrules_all` | locale |
74
+ | `quickjs-polyfill-intl/segmenter` | `:polyfill_intl_segmenter` | `:polyfill_intl_segmenter_all` | locale |
75
+ | `quickjs-polyfill-intl/numberformat` | `:polyfill_intl_numberformat` | `:polyfill_intl_numberformat_all` | pluralrules |
76
+ | `quickjs-polyfill-intl/relativetimeformat` | `:polyfill_intl_relativetimeformat` | `:polyfill_intl_relativetimeformat_all` | numberformat |
77
+ | `quickjs-polyfill-intl/datetimeformat` | `:polyfill_intl_datetimeformat` | `:polyfill_intl_datetimeformat_all` | numberformat |
78
+ | `quickjs-polyfill-intl/supportedvaluesof` | `:polyfill_intl_supportedvaluesof` | `:polyfill_intl_supportedvaluesof_all` | datetimeformat |
79
+ | `quickjs-polyfill-intl/durationformat` | `:polyfill_intl_durationformat` | `:polyfill_intl_durationformat_all` | datetimeformat + listformat |
80
+
81
+ Requiring a path also requires its full dependency chain, so all dependent symbols are registered automatically.
82
+
83
+ ## Building the JS bundles
84
+
85
+ The minified bundles in `lib/quickjs-polyfill-intl/vendor/` are committed to the repo. To rebuild after updating FormatJS package versions:
86
+
87
+ ```
88
+ rake js:build
89
+ ```
90
+
91
+ Requires Node.js and npm.
92
+
93
+ ## Acknowledgements
94
+
95
+ - [@ursm](https://github.com/ursm) — for the `Quickjs.register_polyfill` API that makes this gem possible
96
+
97
+ ## License
98
+
99
+ - `lib/quickjs-polyfill-intl/vendor/` ([bundled and minified from `js/`](https://github.com/hmsk/quickjs-polyfill-intl/tree/main/js))
100
+ - MIT License Copyright (c) 2022 FormatJS
101
+ - [@formatjs/intl-supportedvaluesof](https://github.com/formatjs/formatjs/blob/main/packages/intl-supportedvaluesof/LICENSE.md)
102
+ - [@formatjs/intl-segmenter](https://github.com/formatjs/formatjs/blob/main/packages/intl-segmenter/LICENSE.md)
103
+ - MIT License Copyright (c) 2023 FormatJS
104
+ - [@formatjs/intl-getcanonicallocales](https://github.com/formatjs/formatjs/blob/main/packages/intl-getcanonicallocales/LICENSE.md)
105
+ - [@formatjs/intl-locale](https://github.com/formatjs/formatjs/blob/main/packages/intl-locale/LICENSE.md)
106
+ - [@formatjs/intl-displaynames](https://github.com/formatjs/formatjs/blob/main/packages/intl-displaynames/LICENSE.md)
107
+ - [@formatjs/intl-listformat](https://github.com/formatjs/formatjs/blob/main/packages/intl-listformat/LICENSE.md)
108
+ - [@formatjs/intl-pluralrules](https://github.com/formatjs/formatjs/blob/main/packages/intl-pluralrules/LICENSE.md)
109
+ - [@formatjs/intl-numberformat](https://github.com/formatjs/formatjs/blob/main/packages/intl-numberformat/LICENSE.md)
110
+ - [@formatjs/intl-relativetimeformat](https://github.com/formatjs/formatjs/blob/main/packages/intl-relativetimeformat/LICENSE.md)
111
+ - [@formatjs/intl-datetimeformat](https://github.com/formatjs/formatjs/blob/main/packages/intl-datetimeformat/LICENSE.md)
112
+ - [@formatjs/intl-durationformat](https://github.com/formatjs/formatjs/blob/main/packages/intl-durationformat/LICENSE.md)
113
+ - [@formatjs/fast-memoize](https://github.com/formatjs/formatjs/blob/main/packages/fast-memoize/LICENSE.md)
114
+ - [@formatjs/intl-localematcher](https://github.com/formatjs/formatjs/blob/main/packages/intl-localematcher/LICENSE.md)
115
+ - MIT License Copyright (c) 2026 FormatJS
116
+ - [@formatjs/bigdecimal](https://github.com/formatjs/formatjs/blob/main/packages/bigdecimal/LICENSE.md)
117
+ - [@formatjs/intl-collator](https://github.com/formatjs/formatjs/blob/main/packages/intl-collator/LICENSE.md)
118
+
119
+ Otherwise, [the MIT License, Copyright 2026 by Kengo Hamasaki](/LICENSE).
data/Rakefile ADDED
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rake/testtask'
4
+
5
+ Rake::TestTask.new(:test) do |t|
6
+ t.libs << 'test' << 'lib'
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ namespace :js do
11
+ desc 'Rebuild the Intl bundle (requires npm)'
12
+ task :build do
13
+ Dir.chdir('js') do
14
+ sh 'npm install'
15
+ sh 'npm run build'
16
+ end
17
+ end
18
+ end
19
+
20
+ task default: :test
data/js/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "quickjs-polyfill-intl-polyfills",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "build": "rolldown -c rolldown.config.mjs"
7
+ },
8
+ "devDependencies": {
9
+ "rolldown": "^1.0.0-rc.14"
10
+ },
11
+ "dependencies": {
12
+ "@formatjs/intl-collator": "^0.2.3",
13
+ "@formatjs/intl-datetimeformat": "^7.3.1",
14
+ "@formatjs/intl-displaynames": "^7.3.9",
15
+ "@formatjs/intl-durationformat": "^0.10.13",
16
+ "@formatjs/intl-getcanonicallocales": "^3.2.2",
17
+ "@formatjs/intl-listformat": "^8.3.9",
18
+ "@formatjs/intl-locale": "^5.3.1",
19
+ "@formatjs/intl-numberformat": "^9.3.1",
20
+ "@formatjs/intl-pluralrules": "^6.3.1",
21
+ "@formatjs/intl-relativetimeformat": "^12.3.9",
22
+ "@formatjs/intl-segmenter": "^12.2.9",
23
+ "@formatjs/intl-supportedvaluesof": "^2.3.7"
24
+ }
25
+ }
@@ -0,0 +1,22 @@
1
+ import { defineConfig } from "rolldown";
2
+
3
+ const output = (name) => ({
4
+ file: `../lib/quickjs-polyfill-intl/vendor/${name}.min.js`,
5
+ format: "iife",
6
+ minify: true,
7
+ });
8
+
9
+ export default [
10
+ defineConfig({ input: "src/getcanonicallocales.js", output: output("getcanonicallocales") }),
11
+ defineConfig({ input: "src/locale.js", output: output("locale") }),
12
+ defineConfig({ input: "src/collator-en.js", output: output("collator-en") }),
13
+ defineConfig({ input: "src/segmenter.js", output: output("segmenter") }),
14
+ defineConfig({ input: "src/displaynames-en.js", output: output("displaynames-en") }),
15
+ defineConfig({ input: "src/listformat-en.js", output: output("listformat-en") }),
16
+ defineConfig({ input: "src/pluralrules-en.js", output: output("pluralrules-en") }),
17
+ defineConfig({ input: "src/numberformat-en.js", output: output("numberformat-en") }),
18
+ defineConfig({ input: "src/relativetimeformat-en.js", output: output("relativetimeformat-en") }),
19
+ defineConfig({ input: "src/datetimeformat-en.js", output: output("datetimeformat-en") }),
20
+ defineConfig({ input: "src/supportedvaluesof.js", output: output("supportedvaluesof") }),
21
+ defineConfig({ input: "src/durationformat.js", output: output("durationformat") }),
22
+ ];
@@ -0,0 +1 @@
1
+ import "@formatjs/intl-collator/polyfill-force.js";
@@ -0,0 +1,3 @@
1
+ import "@formatjs/intl-datetimeformat/polyfill-force.js";
2
+ import "@formatjs/intl-datetimeformat/locale-data/en";
3
+ import "@formatjs/intl-datetimeformat/add-all-tz.js";
@@ -0,0 +1,2 @@
1
+ import "@formatjs/intl-displaynames/polyfill-force.js";
2
+ import "@formatjs/intl-displaynames/locale-data/en";
@@ -0,0 +1 @@
1
+ import "@formatjs/intl-durationformat/polyfill-force.js";
@@ -0,0 +1 @@
1
+ import "@formatjs/intl-getcanonicallocales/polyfill-force.js";
@@ -0,0 +1,2 @@
1
+ import "@formatjs/intl-listformat/polyfill-force.js";
2
+ import "@formatjs/intl-listformat/locale-data/en";
data/js/src/locale.js ADDED
@@ -0,0 +1 @@
1
+ import "@formatjs/intl-locale/polyfill-force.js";
@@ -0,0 +1,2 @@
1
+ import "@formatjs/intl-numberformat/polyfill-force.js";
2
+ import "@formatjs/intl-numberformat/locale-data/en";
@@ -0,0 +1,2 @@
1
+ import "@formatjs/intl-pluralrules/polyfill-force.js";
2
+ import "@formatjs/intl-pluralrules/locale-data/en";
@@ -0,0 +1,2 @@
1
+ import "@formatjs/intl-relativetimeformat/polyfill-force.js";
2
+ import "@formatjs/intl-relativetimeformat/locale-data/en";
@@ -0,0 +1 @@
1
+ import "@formatjs/intl-segmenter/polyfill-force.js";
@@ -0,0 +1 @@
1
+ import "@formatjs/intl-supportedvaluesof/polyfill-force.js";
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'durationformat' # chains: getcanonicallocales, locale, listformat, pluralrules, numberformat, datetimeformat, durationformat
4
+ require_relative 'collator' # adds: collator
5
+ require_relative 'segmenter' # adds: segmenter
6
+ require_relative 'displaynames' # adds: displaynames
7
+ require_relative 'relativetimeformat' # adds: relativetimeformat
8
+ require_relative 'supportedvaluesof' # adds: supportedvaluesof
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'quickjs'
4
+ require_relative 'locale'
5
+
6
+ Quickjs.register_polyfill(
7
+ :polyfill_intl_collator,
8
+ source: -> { File.read(File.expand_path('vendor/collator-en.min.js', __dir__)) },
9
+ init: 'globalThis.Intl ||= {};'
10
+ )
11
+
12
+ Quickjs.register_polyfill(
13
+ :polyfill_intl_collator_all,
14
+ source: -> {
15
+ %w[getcanonicallocales locale collator-en].map { File.read(File.expand_path("vendor/#{_1}.min.js", __dir__)) }.join("\n")
16
+ },
17
+ init: 'globalThis.Intl ||= {};'
18
+ )
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'quickjs'
4
+ require_relative 'numberformat'
5
+
6
+ Quickjs.register_polyfill(
7
+ :polyfill_intl_datetimeformat,
8
+ source: -> { File.read(File.expand_path('vendor/datetimeformat-en.min.js', __dir__)) },
9
+ init: 'globalThis.Intl ||= {};'
10
+ )
11
+
12
+ Quickjs.register_polyfill(
13
+ :polyfill_intl_datetimeformat_all,
14
+ source: -> {
15
+ %w[getcanonicallocales locale pluralrules-en numberformat-en datetimeformat-en].map { File.read(File.expand_path("vendor/#{_1}.min.js", __dir__)) }.join("\n")
16
+ },
17
+ init: 'globalThis.Intl ||= {};'
18
+ )
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'quickjs'
4
+ require_relative 'locale'
5
+
6
+ Quickjs.register_polyfill(
7
+ :polyfill_intl_displaynames,
8
+ source: -> { File.read(File.expand_path('vendor/displaynames-en.min.js', __dir__)) },
9
+ init: 'globalThis.Intl ||= {};'
10
+ )
11
+
12
+ Quickjs.register_polyfill(
13
+ :polyfill_intl_displaynames_all,
14
+ source: -> {
15
+ %w[getcanonicallocales locale displaynames-en].map { File.read(File.expand_path("vendor/#{_1}.min.js", __dir__)) }.join("\n")
16
+ },
17
+ init: 'globalThis.Intl ||= {};'
18
+ )
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'quickjs'
4
+ require_relative 'datetimeformat'
5
+ require_relative 'listformat'
6
+
7
+ Quickjs.register_polyfill(
8
+ :polyfill_intl_durationformat,
9
+ source: -> { File.read(File.expand_path('vendor/durationformat.min.js', __dir__)) },
10
+ init: 'globalThis.Intl ||= {};'
11
+ )
12
+
13
+ Quickjs.register_polyfill(
14
+ :polyfill_intl_durationformat_all,
15
+ source: -> {
16
+ %w[getcanonicallocales locale pluralrules-en numberformat-en datetimeformat-en listformat-en durationformat].map { File.read(File.expand_path("vendor/#{_1}.min.js", __dir__)) }.join("\n")
17
+ },
18
+ init: 'globalThis.Intl ||= {};'
19
+ )
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'quickjs'
4
+
5
+ Quickjs.register_polyfill(
6
+ :polyfill_intl_getcanonicallocales,
7
+ source: -> { File.read(File.expand_path('vendor/getcanonicallocales.min.js', __dir__)) },
8
+ init: 'globalThis.Intl ||= {};'
9
+ )
10
+
11
+ Quickjs.register_polyfill(
12
+ :polyfill_intl_getcanonicallocales_all,
13
+ source: -> { File.read(File.expand_path('vendor/getcanonicallocales.min.js', __dir__)) },
14
+ init: 'globalThis.Intl ||= {};'
15
+ )
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'quickjs'
4
+ require_relative 'locale'
5
+
6
+ Quickjs.register_polyfill(
7
+ :polyfill_intl_listformat,
8
+ source: -> { File.read(File.expand_path('vendor/listformat-en.min.js', __dir__)) },
9
+ init: 'globalThis.Intl ||= {};'
10
+ )
11
+
12
+ Quickjs.register_polyfill(
13
+ :polyfill_intl_listformat_all,
14
+ source: -> {
15
+ %w[getcanonicallocales locale listformat-en].map { File.read(File.expand_path("vendor/#{_1}.min.js", __dir__)) }.join("\n")
16
+ },
17
+ init: 'globalThis.Intl ||= {};'
18
+ )
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'quickjs'
4
+ require_relative 'getcanonicallocales'
5
+
6
+ Quickjs.register_polyfill(
7
+ :polyfill_intl_locale,
8
+ source: -> { File.read(File.expand_path('vendor/locale.min.js', __dir__)) },
9
+ init: 'globalThis.Intl ||= {};'
10
+ )
11
+
12
+ Quickjs.register_polyfill(
13
+ :polyfill_intl_locale_all,
14
+ source: -> {
15
+ %w[getcanonicallocales locale].map { File.read(File.expand_path("vendor/#{_1}.min.js", __dir__)) }.join("\n")
16
+ },
17
+ init: 'globalThis.Intl ||= {};'
18
+ )
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'quickjs'
4
+ require_relative 'pluralrules'
5
+
6
+ Quickjs.register_polyfill(
7
+ :polyfill_intl_numberformat,
8
+ source: -> { File.read(File.expand_path('vendor/numberformat-en.min.js', __dir__)) },
9
+ init: 'globalThis.Intl ||= {};'
10
+ )
11
+
12
+ Quickjs.register_polyfill(
13
+ :polyfill_intl_numberformat_all,
14
+ source: -> {
15
+ %w[getcanonicallocales locale pluralrules-en numberformat-en].map { File.read(File.expand_path("vendor/#{_1}.min.js", __dir__)) }.join("\n")
16
+ },
17
+ init: 'globalThis.Intl ||= {};'
18
+ )
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'quickjs'
4
+ require_relative 'locale'
5
+
6
+ Quickjs.register_polyfill(
7
+ :polyfill_intl_pluralrules,
8
+ source: -> { File.read(File.expand_path('vendor/pluralrules-en.min.js', __dir__)) },
9
+ init: 'globalThis.Intl ||= {};'
10
+ )
11
+
12
+ Quickjs.register_polyfill(
13
+ :polyfill_intl_pluralrules_all,
14
+ source: -> {
15
+ %w[getcanonicallocales locale pluralrules-en].map { File.read(File.expand_path("vendor/#{_1}.min.js", __dir__)) }.join("\n")
16
+ },
17
+ init: 'globalThis.Intl ||= {};'
18
+ )
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'quickjs'
4
+ require_relative 'numberformat'
5
+
6
+ Quickjs.register_polyfill(
7
+ :polyfill_intl_relativetimeformat,
8
+ source: -> { File.read(File.expand_path('vendor/relativetimeformat-en.min.js', __dir__)) },
9
+ init: 'globalThis.Intl ||= {};'
10
+ )
11
+
12
+ Quickjs.register_polyfill(
13
+ :polyfill_intl_relativetimeformat_all,
14
+ source: -> {
15
+ %w[getcanonicallocales locale pluralrules-en numberformat-en relativetimeformat-en].map { File.read(File.expand_path("vendor/#{_1}.min.js", __dir__)) }.join("\n")
16
+ },
17
+ init: 'globalThis.Intl ||= {};'
18
+ )
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'quickjs'
4
+ require_relative 'locale'
5
+
6
+ Quickjs.register_polyfill(
7
+ :polyfill_intl_segmenter,
8
+ source: -> { File.read(File.expand_path('vendor/segmenter.min.js', __dir__)) },
9
+ init: 'globalThis.Intl ||= {};'
10
+ )
11
+
12
+ Quickjs.register_polyfill(
13
+ :polyfill_intl_segmenter_all,
14
+ source: -> {
15
+ %w[getcanonicallocales locale segmenter].map { File.read(File.expand_path("vendor/#{_1}.min.js", __dir__)) }.join("\n")
16
+ },
17
+ init: 'globalThis.Intl ||= {};'
18
+ )
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'quickjs'
4
+ require_relative 'datetimeformat'
5
+
6
+ Quickjs.register_polyfill(
7
+ :polyfill_intl_supportedvaluesof,
8
+ source: -> { File.read(File.expand_path('vendor/supportedvaluesof.min.js', __dir__)) },
9
+ init: 'globalThis.Intl ||= {};'
10
+ )
11
+
12
+ Quickjs.register_polyfill(
13
+ :polyfill_intl_supportedvaluesof_all,
14
+ source: -> {
15
+ %w[getcanonicallocales locale pluralrules-en numberformat-en datetimeformat-en supportedvaluesof].map { File.read(File.expand_path("vendor/#{_1}.min.js", __dir__)) }.join("\n")
16
+ },
17
+ init: 'globalThis.Intl ||= {};'
18
+ )