dart-rails 0.3.3 → 0.4.3

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
  SHA1:
3
- metadata.gz: 9ba3b1fec8b574b5d856481449754df86f78731a
4
- data.tar.gz: 53041e94888bc2e5f276b9525a965f157b05af1f
3
+ metadata.gz: b9e7906077bee091c56e149dd43defb9a2b6dbf8
4
+ data.tar.gz: 51e20f466227ef6fa34cc349be2497af7174cf9a
5
5
  SHA512:
6
- metadata.gz: ee0612b33ae83a5a743f9d4af706df4a0a52c0aeeb827bc778633f7699c0bde0400978c6fd95b325e9b1111d2c44ba5234412bbaed616be94c34ea4668cbf9a6
7
- data.tar.gz: 2bfba33ecc72f6967bb7d67a82163305ec580fe7e82573e0c5c2649a5cb44b9b08f8a36dc175936e906539c3c3470826970b8f80c212f96daee8a10ab89db9f9
6
+ metadata.gz: 7b9f1a4ccfc4c8098c2ba2b5633d2372a11d9f406b4251edbc62a27db0af983c6c0663fa1cfec884a008acd9b15a95dd697b0d2adb86dfc20ccc025eebbd426b
7
+ data.tar.gz: 18d9dd1d896e25af465bb011ffd175be3cefe072f1574822c233ae5dd9dc49bf816c2267a84b28586df08c656ca7468e8b48063673fc38e1b17919430e658a50
data/README.md CHANGED
@@ -2,50 +2,90 @@
2
2
 
3
3
  ### Idea ###
4
4
 
5
- Handle [dart](https://www.dartlang.org/ 'dartlang.org') scripts so they get transcoded to js for browsers
5
+ Handle [dart](https://www.dartlang.org/ 'dartlang.org') scripts so they get compiled to js for browsers
6
6
  without dart support. Currently there's only the `Dartium` browser from the development-kit that supports
7
- dart directly.
8
-
9
- For now this is a rather stupid attempt, although it works.
7
+ dart natively.
10
8
 
11
9
  For a working sample check [m0gg/dart-rails-sample](https://github.com/m0gg/dart-rails-sample 'm0gg/dart-rails-sample').
12
10
 
11
+ ## Attention ##
12
+ If you're upgrading from versions prior `0.4.2` and use `sprockets >= 3.0.0` you need to replace your
13
+ `dart_app.js.dart2js` or `dart_app.js` (depends form which version you're upgrading) with a symlink pointing to
14
+ your `dart_app.dart` as `sprockets >= 3.0.0` no longer supports the `//= include` directive.
15
+
16
+ example `ls app/assets/dart/`
17
+ ```bash
18
+ $ ls app/assets/dart/dart_app.*
19
+ app/assets/dart/dart_app.dart app/assets/dart/dart_app.js.dart2js
20
+ ```
21
+
22
+
23
+
13
24
  ### Setup ###
14
25
 
15
- 1. `Gemfile`
26
+ 1. `Gemfile`
16
27
 
17
- ```ruby
18
- gem 'ruby-dart2js'
19
- gem 'dart-rails'
20
- ```
28
+ ```ruby
29
+ gem 'ruby-dart2js'
30
+ gem 'dart-rails'
31
+ ```
21
32
 
22
- 2. run `rails generate dart:assets` this will bring you:
33
+ 2. `rails generate dart:assets`
23
34
 
24
- ```sh
25
- rails g dart:assets
26
- create app/assets/dart
27
- create app/assets/dart/dart_app.dart
28
- create app/assets/dart/dart_app.js
29
- create app/assets/dart/pubspec.yaml
30
- ```
35
+ ```sh
36
+ rails g dart:assets
37
+ create app/assets/dart
38
+ create app/assets/dart/dart_app.dart
39
+ create app/assets/dart/dart_app.js.dart2js
40
+ create app/assets/dart/pubspec.yaml
41
+ ```
31
42
 
32
- 3. Currently you still need to add following to the bottom of your body in the layout:
43
+ 3. asset links
33
44
 
34
- `layout.html.erb` (for instance)
45
+ Now it's up to you wether you want to serve your `.dart` files and it's
46
+ compiled `.js` variant side-by-side or only one of those variants.
35
47
 
36
- ```
37
- <%= dart_include_tag 'dart_app' %>
38
- <%= javascript_include_tag 'dart' %>
39
- ```
48
+ - `.dart` and `.js`
40
49
 
41
- 4. *Optional:* run `rake pub:get` to respect the dependencies in your `pubspec.yaml`.
42
- Initially the pubspec contains `rails_ujs` as dependency, this is just basic for now,
43
- so you probably want to omit it if you're still using JQuery.
50
+ You'll need to add following to the bottom of your body in the layout
51
+ `layout.html.erb` (for instance)
44
52
 
45
- *Note:* you'll need to point `DART_SDK_HOME` to the root of your dart-sdk unless your `pub` executable is in the `PATH`
53
+ ```
54
+ <%= dart_include_tag 'dart_app' %>
55
+ <%= javascript_include_tag 'dart' %>
56
+ ```
46
57
 
47
- ### Compatibility ###
58
+ - `.js` only
59
+
60
+ simply add this to your `application.js`
61
+ ```
62
+ //= require dart_app
63
+ ```
64
+ While this would enable you to add several dart programs, there is no guarantee
65
+ it will work out. (untested)
66
+
67
+ - `.dart` only
68
+
69
+ You just need to add the `dart_include_tag` to the bottom of your body in the layout
70
+ `layout.html.erb` (for instance)
71
+
72
+ ```
73
+ <%= dart_include_tag 'dart_app' %>
74
+ ```
75
+
76
+
77
+ 4. `rake pub:get`
78
+
79
+ run `rake pub:get` to respect the dependencies in your `pubspec.yaml`.
80
+ Initially the pubspec contains `rails_ujs` as dependency, this is just basic for now,
81
+ so you probably want to omit it if you're still using JQuery.
48
82
 
83
+ 5. ruby-dart2js
84
+
85
+ See [ruby-dart2js](https://github.com/m0gg/ruby-dart2js) on github for setup.
86
+
87
+
88
+ ### Compatibility ###
49
89
  ###### UglifyJs ######
50
90
 
51
91
  Don't worry if you're experiencing a
@@ -68,55 +108,45 @@ You may simply disable UglifyJs in the environment file.
68
108
 
69
109
  ###### assets:precompile + native .dart files ######
70
110
 
71
- As of rails 4 we are facing a problem for the productive environments.
72
- See [Inability to compile nondigest and digest assets breaks compatibility with bad gems #49](https://github.com/rails/sprockets-rails/issues/49)
111
+ *This is no longer relevant as there are no browsers that support native dart and
112
+ should be used for production.*
73
113
 
74
- You may optionally add this to your Gemfile
114
+ ~~*Attention* currently not working with `rails >= 4.2`~~
115
+
116
+ ~~As of rails 4 we are facing a problem for the productive environments.
117
+ See [Inability to compile nondigest and digest assets breaks compatibility with bad gems #49](https://github.com/rails/sprockets-rails/issues/49)~~
118
+
119
+ ~~You may optionally add this to your Gemfile~~
75
120
 
76
121
  ```
77
122
  gem 'non-stupid-digest-assets', '>= 1.1', github: 'm0gg/non-stupid-digest-assets'
78
123
  ```
79
124
 
80
- this will enable a workaround for digesting the assets while precompiling dart files as
125
+ ~~this will enable a workaround for digesting the assets while precompiling dart files as
81
126
  seen in [non-stupid-digest-assets](https://github.com/alexspeller/non-stupid-digest-assets) and
82
- additionally rewrite the manifests to use the non-digest files.
83
-
84
- ###### ruby-dart2js ######
127
+ additionally rewrite the manifests to use the non-digest files.~~
85
128
 
86
- This gem is needed for the `dart2js` compiler compatibility.
87
129
 
88
- See [ruby-dart2js](https://github.com/m0gg/ruby-dart2js) on github for setup.
130
+ ### Changelog ###
131
+ v0.4.2 - 16. Dec 2015:
132
+ * full compat with sprockets 2 & 3 by switching to symlinked dart_app.js.dart2js
133
+ * fixed dart2js compilation by data
134
+ * requires `dart2js ~> 0.3.0`
89
135
 
90
- ```
91
- <%= javascript_include_tag 'dart' %>
92
- ```
93
- in the layout needs to stay as it is unless you want to drop
94
- compatibility for browsers without dart support.
95
- It includes the bundled `javascripts/dart.js` from this gem.
96
-
97
- This will parse all script-tags with `type="application/dart"` and replace them with tags that request
98
- the appropriate js file.
99
- ```html
100
- <script type="application/dart" src="/assets/dart_app.dart"></script>
101
- ```
102
- would get
103
- ```html
104
- <script type="application/javascript" src="/assets/dart_app.js"></script>
105
- ```
106
- To provide the transcompiled version of you dart-file you'll need a js template
107
- with a directive which could look like this
108
- ```javascript
109
- //
110
- //= dart dart_app
111
- ```
136
+ v0.4.0 - 4. Dec. 2015:
137
+ * you now need a dart_app.js.dart2js template with following content:
112
138
 
113
- ###### Sprockets ######
139
+ `app/assets/dart/dart_app.js.dart2js`
140
+ ```javascript
141
+ //= include dart_app.dart
142
+ ```
114
143
 
115
- `Dart::SprocketsDirectiveDart2js` extends Sprockets base `DirectiveProcessor` and thus each dart-file
116
- included (via `dart` directive) in `.js` templates get compiled and inserted.
144
+ v0.3.3 - 9. Nov. 2015:
145
+ * support for sprockets-rails > 2.3.0
117
146
 
147
+ v0.3.2-p1 - 9. Nov. 2015:
148
+ * remain support for sprockets-rails prior 2.3.0
118
149
 
119
- ### Changelog ###
120
150
  v0.3.0 - 21. Jan. 2015:
121
151
  * with v0.2.0 of ruby-dart2js, minifying is supported and will bump the feature version of dart-rails with updated dependencies
122
152
 
data/lib/dart-rails.rb CHANGED
@@ -1 +1,11 @@
1
1
  require 'dart/railtie'
2
+ require 'dart/sprockets/dart2js_compiler'
3
+
4
+ module Dart
5
+ case Sprockets::VERSION
6
+ when /^2/
7
+ Sprockets.register_engine '.dart2js', Dart2JsCompiler
8
+ when /^3/
9
+ Sprockets.register_engine '.dart2js', Dart2JsCompiler, mime_type: 'application/javascript'
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ import 'package:rails_ujs/rails_ujs.dart';
2
+
3
+ RailsUjs ujsHelper;
4
+
5
+ void main() {
6
+ ujsHelper = new RailsUjs();
7
+ }
@@ -7,26 +7,11 @@ module Dart #:nodoc:
7
7
  # Handle gem provided javascripts
8
8
  initializer :assets do |app|
9
9
 
10
- #initialize dart2js dir
11
- hash = (Digest::MD5.new << Time.now.to_s).to_s
12
- DART2JS_OUT_DIR = app.root.join('tmp', 'cache', 'assets', 'development', 'dart', hash)
13
- FileUtils.mkdir_p DART2JS_OUT_DIR unless File.directory?(DART2JS_OUT_DIR)
14
-
15
10
  # make dart.js compatibility-script accessible for sprockets
16
11
  app.assets.append_path(File.join(root, 'lib', 'assets', 'javascripts'))
17
12
 
18
- # make dart2js results accessible for sprockets
19
- app.assets.append_path(Dart::Rails::JsCompatEngine::DART2JS_OUT_DIR)
20
-
21
13
  # precompile compatibility-script(s)
22
- # TODO: does not work with `app.assets.precompile += ...`
23
14
  ::Rails.application.config.assets.precompile += %w(dart_app.js dart.js)
24
-
25
-
26
- # Mixin process_dart_directive in standard DirectiveProcessor for JS
27
- Sprockets::DirectiveProcessor.instance_eval do
28
- include Dart::DirectiveProcessorDart2js
29
- end
30
15
  end
31
16
  end
32
17
  end
@@ -1,5 +1,5 @@
1
1
  module Dart #:nodoc:
2
2
  module Rails #:nodoc:
3
- VERSION = '0.3.3'
3
+ VERSION = '0.4.3'
4
4
  end
5
5
  end
data/lib/dart/railtie.rb CHANGED
@@ -1,33 +1,14 @@
1
1
  require 'rails'
2
2
  require 'rails/railtie'
3
- require 'dart/sprockets/directive_processor_dart2js'
4
3
  require 'dart/rails/version'
5
- require 'dart/rails/js_compat_engine'
6
4
  require 'dart/rails/dart_asset_helper'
5
+ require 'dart/rails/js_compat_engine'
7
6
  require 'dart/rails/generators/assets/generator'
8
- require 'dart/rails/template_handler'
9
7
 
10
8
 
11
9
  module Dart #:nodoc:
12
10
  class Railtie < ::Rails::Railtie
13
11
 
14
- # [Optionally via: https://github.com/m0gg/non-stupid-digest-assets]
15
- # do not digest .dart files
16
- # digest during compilation breaks darts 'import' functionality
17
- # currently sprockets-rails does not allow mixed procompilation of digest and non-digest assets
18
- # see https://github.com/rails/sprockets-rails/issues/49
19
- # workaround is a 51-liner gem 'non-stupid-digest-assets'
20
- # https://github.com/alexspeller/non-stupid-digest-assets
21
- #
22
- begin
23
- require 'non-stupid-digest-assets'
24
- if defined? NonStupidDigestAssets
25
- NonStupidDigestAssets.whitelist += [ /.*\.dart/, 'dart_app.js', 'dart_app' ]
26
- end
27
- rescue Exception => e
28
- puts 'No non-stupid-digest-assets support. You may face issues with native dart-support!'
29
- end
30
-
31
12
  config.after_initialize do |app|
32
13
  # Mixin helper-module in ActionView
33
14
  ActionView::Base.instance_eval do
@@ -0,0 +1,33 @@
1
+ require 'tilt/template'
2
+ require 'dart2js'
3
+
4
+ module Dart
5
+ class Dart2JsCompiler < Tilt::Template
6
+ self.default_mime_type = 'application/javascript'
7
+
8
+ def self.engine_initialized?
9
+ defined? ::Dart2Js
10
+ end
11
+
12
+ def initialize_engine
13
+ unless defined? ::Dart2Js
14
+ require_template_library 'dart2js'
15
+ end
16
+ end
17
+
18
+ def prepare
19
+ end
20
+
21
+ def self.call(input)
22
+ # it's necessary for dart2js to have the dart file in th same directory as its depencencies
23
+ compiler = ::Dart2Js.new(input[:data], pwd: File.dirname(input[:filename]))
24
+ result = compiler.compile
25
+ compiler.close
26
+ result
27
+ end
28
+
29
+ def evaluate(context, locals, &block)
30
+ self.class.call({ filename: context.pathname, data: data })
31
+ end
32
+ end
33
+ end
metadata CHANGED
@@ -1,81 +1,61 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dart-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcel Sackermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-08 00:00:00.000000000 Z
11
+ date: 2015-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 4.0.0
20
- - - "<"
17
+ - - "~>"
21
18
  - !ruby/object:Gem::Version
22
- version: 5.0.0
19
+ version: '4.1'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: 4.0.0
30
- - - "<"
24
+ - - "~>"
31
25
  - !ruby/object:Gem::Version
32
- version: 5.0.0
26
+ version: '4.1'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: ruby-dart2js
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
31
  - - "~>"
38
32
  - !ruby/object:Gem::Version
39
- version: 0.2.2
33
+ version: 0.3.0
40
34
  type: :runtime
41
35
  prerelease: false
42
36
  version_requirements: !ruby/object:Gem::Requirement
43
37
  requirements:
44
38
  - - "~>"
45
39
  - !ruby/object:Gem::Version
46
- version: 0.2.2
47
- - !ruby/object:Gem::Dependency
48
- name: sprockets-rails
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: 2.3.0
54
- type: :runtime
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- version: 2.3.0
40
+ version: 0.3.0
61
41
  - !ruby/object:Gem::Dependency
62
42
  name: sprockets
63
43
  requirement: !ruby/object:Gem::Requirement
64
44
  requirements:
65
- - - ">="
45
+ - - ">"
66
46
  - !ruby/object:Gem::Version
67
- version: 3.0.0
68
- - - "<="
47
+ version: 2.0.0
48
+ - - "<"
69
49
  - !ruby/object:Gem::Version
70
50
  version: 4.0.0
71
51
  type: :runtime
72
52
  prerelease: false
73
53
  version_requirements: !ruby/object:Gem::Requirement
74
54
  requirements:
75
- - - ">="
55
+ - - ">"
76
56
  - !ruby/object:Gem::Version
77
- version: 3.0.0
78
- - - "<="
57
+ version: 2.0.0
58
+ - - "<"
79
59
  - !ruby/object:Gem::Version
80
60
  version: 4.0.0
81
61
  description: Delivers .dart directly to Dartium-browser and compiles via ruby-dart2js
@@ -92,16 +72,14 @@ files:
92
72
  - lib/assets/javascripts/dart.js
93
73
  - lib/dart-rails.rb
94
74
  - lib/dart/rails/dart_asset_helper.rb
95
- - lib/dart/rails/dart_engine.rb
96
75
  - lib/dart/rails/generators/assets/generator.rb
97
76
  - lib/dart/rails/generators/assets/templates/dart/dart_app.dart
98
- - lib/dart/rails/generators/assets/templates/dart/dart_app.js
77
+ - lib/dart/rails/generators/assets/templates/dart/dart_app.js.dart2js
99
78
  - lib/dart/rails/generators/assets/templates/dart/pubspec.yaml
100
79
  - lib/dart/rails/js_compat_engine.rb
101
- - lib/dart/rails/template_handler.rb
102
80
  - lib/dart/rails/version.rb
103
81
  - lib/dart/railtie.rb
104
- - lib/dart/sprockets/directive_processor_dart2js.rb
82
+ - lib/dart/sprockets/dart2js_compiler.rb
105
83
  - lib/tasks/dart-rails_tasks.rake
106
84
  - test/dart-rails_test.rb
107
85
  - test/dummy/README.rdoc
@@ -158,33 +136,33 @@ signing_key:
158
136
  specification_version: 4
159
137
  summary: Provides Sprockets based handling of .dart files
160
138
  test_files:
161
- - test/dart-rails_test.rb
162
- - test/dummy/config.ru
139
+ - test/test_helper.rb
140
+ - test/dummy/Rakefile
141
+ - test/dummy/config/application.rb
142
+ - test/dummy/config/locales/en.yml
163
143
  - test/dummy/config/boot.rb
144
+ - test/dummy/config/routes.rb
164
145
  - test/dummy/config/environment.rb
165
- - test/dummy/config/initializers/mime_types.rb
146
+ - test/dummy/config/environments/test.rb
147
+ - test/dummy/config/environments/development.rb
148
+ - test/dummy/config/environments/production.rb
149
+ - test/dummy/config/database.yml
166
150
  - test/dummy/config/initializers/secret_token.rb
167
151
  - test/dummy/config/initializers/inflections.rb
168
- - test/dummy/config/initializers/session_store.rb
152
+ - test/dummy/config/initializers/mime_types.rb
169
153
  - test/dummy/config/initializers/backtrace_silencers.rb
154
+ - test/dummy/config/initializers/session_store.rb
170
155
  - test/dummy/config/initializers/wrap_parameters.rb
171
- - test/dummy/config/application.rb
172
- - test/dummy/config/locales/en.yml
173
- - test/dummy/config/environments/production.rb
174
- - test/dummy/config/environments/test.rb
175
- - test/dummy/config/environments/development.rb
176
- - test/dummy/config/routes.rb
177
- - test/dummy/config/database.yml
178
- - test/dummy/Rakefile
179
156
  - test/dummy/README.rdoc
157
+ - test/dummy/config.ru
180
158
  - test/dummy/script/rails
159
+ - test/dummy/public/500.html
181
160
  - test/dummy/public/favicon.ico
182
- - test/dummy/public/404.html
183
161
  - test/dummy/public/422.html
184
- - test/dummy/public/500.html
162
+ - test/dummy/public/404.html
163
+ - test/dummy/app/assets/javascripts/application.js
164
+ - test/dummy/app/assets/stylesheets/application.css
185
165
  - test/dummy/app/controllers/application_controller.rb
186
166
  - test/dummy/app/helpers/application_helper.rb
187
- - test/dummy/app/assets/stylesheets/application.css
188
- - test/dummy/app/assets/javascripts/application.js
189
167
  - test/dummy/app/views/layouts/application.html.erb
190
- - test/test_helper.rb
168
+ - test/dart-rails_test.rb
@@ -1,14 +0,0 @@
1
- require 'rails/engine'
2
-
3
- module Dart #:nodoc:
4
- module Rails #:nodoc:
5
- class DartEngine < ::Rails::Engine
6
-
7
- initializer :assets do |app|
8
-
9
- # Register mime-types
10
- app.assets.register_mime_type 'application/dart', '.dart'
11
- end
12
- end
13
- end
14
- end
@@ -1,2 +0,0 @@
1
- // dart directive issues dart2js-compilation
2
- //= dart dart_app
@@ -1,22 +0,0 @@
1
- module Dart #:nodoc:
2
- module Rails #:nodoc:
3
-
4
- # TemplateHandler for dart scripts
5
- class TemplateHandler
6
- def self.erb_handler
7
- debugger
8
- @@erb_handler ||= ActionView::Template.registered_template_handler(:erb)
9
- end
10
-
11
- def self.call(template)
12
- debugger
13
- erb_handler.call(template)
14
- end
15
- end
16
- end
17
- end
18
-
19
- # Finally register TemplateHandler in ActionView
20
- ActiveSupport.on_load(:action_view) do
21
- ActionView::Template.register_template_handler :dart, Dart::Rails::TemplateHandler
22
- end
@@ -1,63 +0,0 @@
1
- require 'fileutils'
2
- require 'dart2js'
3
-
4
- module Dart #:nodoc:
5
- module DirectiveProcessorDart2js
6
-
7
- def process_dart_directive(path)
8
- dart_path = resolve([path, '.dart'].join, { base_path: @dirname })
9
-
10
- process_depend_on_directive(dart_path)
11
- dart_get_dependencies(dart_path).each do |dep|
12
- process_depend_on_directive(dep)
13
- end
14
-
15
- #update Timestamp so we can compare possible changes
16
- FileUtils.touch @filename
17
-
18
- dart2js_compiler = ::Dart2Js.new(File.new(URI(dart_path).path), { out_dir: dart2js_out_dir })
19
- result = dart2js_compiler.compile
20
-
21
- if result.respond_to?(:exception)
22
- puts "\n------------- dart2js compilation exception -------------\n#{result.message}\n#{result.result}\n------------- dart2js compilation exception -------------"
23
- raise result
24
- end
25
-
26
- require_paths({ dart2js_compiler.out_file => @environment.stat(dart2js_compiler.out_file) }, Set.new)
27
- end
28
-
29
- private
30
-
31
- DART_EGREP = /^(import|part) ['"]((dart:){0}|(package:))[0-9a-zA-Z_\/\.\-]+\.dart['"];/
32
- DART_EGREP_PATH = /['"](package:)?(.*)['"]/
33
-
34
- def dart_get_dependencies(pathname, exceptions=[])
35
- deps = []
36
- #recursive search
37
- imports = dart_find_imports(pathname)
38
- imports.each do |dep|
39
- deps << dep unless deps.include?(dep)
40
- end
41
- (deps-exceptions).each do |path|
42
- dart_get_dependencies(path, deps)
43
- end
44
- deps
45
- end
46
-
47
- def dart_find_imports(pathname)
48
- deps = []
49
- File.exists?(pathname) && File.readlines(pathname).each do |l|
50
- #relevant line (import)?
51
- next unless DART_EGREP =~ l
52
- m = l.match(DART_EGREP_PATH)
53
- #package or part?
54
- deps << (m[1] ? resolve("packages/#{m[2]}") : "#{pathname.to_s.slice /^.*\//}#{m[2]}")
55
- end
56
- deps
57
- end
58
-
59
- def dart2js_out_dir
60
- Dart::Rails::JsCompatEngine::DART2JS_OUT_DIR
61
- end
62
- end
63
- end