turbo_ready 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,18 @@
1
1
  import invoke from './invoke'
2
2
 
3
- function initialize (streamActions) {
4
- streamActions.invoke = invoke
5
- }
3
+ if (!self['Turbo'])
4
+ throw new Error(
5
+ '`Turbo` is not defined! Be sure to import `turbo_ready` after `@hotwired/turbo` or `@hotwired/turbo-rails`.'
6
+ )
6
7
 
7
- export default { initialize }
8
+ if (!Turbo['StreamActions'])
9
+ throw new Error(
10
+ '`Turbo.StreamActions` is not defined! Verify that you are running >= `7.2.0` of `@hotwired/turbo`.'
11
+ )
12
+
13
+ Turbo.StreamActions.invoke = invoke
14
+ self.TurboReady = { StreamActions: { invoke } }
15
+
16
+ console.info(
17
+ 'TurboReady has initialized and has registered new stream actions with Turbo.'
18
+ )
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TurboReady
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turbo_ready",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Take full control of the DOM with Turbo Streams",
5
5
  "main": "app/javascript/index.js",
6
6
  "repository": "https://github.com/hopsoft/turbo_ready",
@@ -10,14 +10,14 @@
10
10
  "@hotwired/turbo-rails": ">= 7.1"
11
11
  },
12
12
  "devDependencies": {
13
- "esbuild": "^0.15.5",
13
+ "esbuild": "^0.16.3",
14
14
  "eslint": "^8.19.0",
15
15
  "flowbite": "^1.5.3",
16
16
  "prettier-standard": "^16.4.1",
17
17
  "rustywind": "^0.15.1"
18
18
  },
19
19
  "scripts": {
20
- "build": "esbuild app/javascript/index.js --bundle --minify --sourcemap --format=esm --outfile=app/assets/builds/turbo_ready.js"
20
+ "build": "esbuild app/javascript/index.js --bundle --minify --sourcemap --format=esm --target=es2017 --analyze --outfile=app/assets/builds/turbo_ready.js"
21
21
  },
22
22
  "dependencies": {
23
23
  "@alpinejs/morph": ">=3.10.4",