tiny-lite-sys 0.0.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 +7 -0
- data/tiny-lite-sys.gemspec +11 -0
- data/webpacker-5.4.4/CHANGELOG.md +1074 -0
- data/webpacker-5.4.4/CONTRIBUTING.md +33 -0
- data/webpacker-5.4.4/Gemfile +13 -0
- data/webpacker-5.4.4/Gemfile.lock +183 -0
- data/webpacker-5.4.4/MIT-LICENSE +20 -0
- data/webpacker-5.4.4/README.md +427 -0
- data/webpacker-5.4.4/Rakefile +11 -0
- data/webpacker-5.4.4/docs/assets.md +119 -0
- data/webpacker-5.4.4/docs/cloud9.md +310 -0
- data/webpacker-5.4.4/docs/css.md +308 -0
- data/webpacker-5.4.4/docs/deployment.md +130 -0
- data/webpacker-5.4.4/docs/docker.md +68 -0
- data/webpacker-5.4.4/docs/engines.md +213 -0
- data/webpacker-5.4.4/docs/env.md +63 -0
- data/webpacker-5.4.4/docs/es6.md +72 -0
- data/webpacker-5.4.4/docs/folder-structure.md +66 -0
- data/webpacker-5.4.4/docs/integrations.md +220 -0
- data/webpacker-5.4.4/docs/misc.md +23 -0
- data/webpacker-5.4.4/docs/props.md +223 -0
- data/webpacker-5.4.4/docs/target.md +22 -0
- data/webpacker-5.4.4/docs/testing.md +136 -0
- data/webpacker-5.4.4/docs/troubleshooting.md +158 -0
- data/webpacker-5.4.4/docs/typescript.md +190 -0
- data/webpacker-5.4.4/docs/v4-upgrade.md +142 -0
- data/webpacker-5.4.4/docs/webpack-dev-server.md +92 -0
- data/webpacker-5.4.4/docs/webpack.md +364 -0
- data/webpacker-5.4.4/docs/yarn.md +23 -0
- data/webpacker-5.4.4/gemfiles/Gemfile-rails-edge +12 -0
- data/webpacker-5.4.4/gemfiles/Gemfile-rails.5.2.x +9 -0
- data/webpacker-5.4.4/gemfiles/Gemfile-rails.6.0.x +9 -0
- data/webpacker-5.4.4/lib/install/angular.rb +23 -0
- data/webpacker-5.4.4/lib/install/bin/webpack +18 -0
- data/webpacker-5.4.4/lib/install/bin/webpack-dev-server +18 -0
- data/webpacker-5.4.4/lib/install/binstubs.rb +4 -0
- data/webpacker-5.4.4/lib/install/coffee.rb +25 -0
- data/webpacker-5.4.4/lib/install/config/babel.config.js +82 -0
- data/webpacker-5.4.4/lib/install/config/postcss.config.js +12 -0
- data/webpacker-5.4.4/lib/install/config/webpack/development.js +5 -0
- data/webpacker-5.4.4/lib/install/config/webpack/environment.js +3 -0
- data/webpacker-5.4.4/lib/install/config/webpack/production.js +5 -0
- data/webpacker-5.4.4/lib/install/config/webpack/test.js +5 -0
- data/webpacker-5.4.4/lib/install/config/webpacker.yml +92 -0
- data/webpacker-5.4.4/lib/install/elm.rb +39 -0
- data/webpacker-5.4.4/lib/install/erb.rb +25 -0
- data/webpacker-5.4.4/lib/install/examples/angular/hello_angular/app/app.component.ts +9 -0
- data/webpacker-5.4.4/lib/install/examples/angular/hello_angular/app/app.module.ts +16 -0
- data/webpacker-5.4.4/lib/install/examples/angular/hello_angular/index.ts +8 -0
- data/webpacker-5.4.4/lib/install/examples/angular/hello_angular/polyfills.ts +73 -0
- data/webpacker-5.4.4/lib/install/examples/angular/hello_angular.js +7 -0
- data/webpacker-5.4.4/lib/install/examples/coffee/hello_coffee.coffee +4 -0
- data/webpacker-5.4.4/lib/install/examples/elm/Main.elm +55 -0
- data/webpacker-5.4.4/lib/install/examples/elm/hello_elm.js +16 -0
- data/webpacker-5.4.4/lib/install/examples/erb/hello_erb.js.erb +6 -0
- data/webpacker-5.4.4/lib/install/examples/react/babel.config.js +99 -0
- data/webpacker-5.4.4/lib/install/examples/react/hello_react.jsx +26 -0
- data/webpacker-5.4.4/lib/install/examples/react/tsconfig.json +21 -0
- data/webpacker-5.4.4/lib/install/examples/stimulus/application.js +1 -0
- data/webpacker-5.4.4/lib/install/examples/stimulus/controllers/hello_controller.js +18 -0
- data/webpacker-5.4.4/lib/install/examples/stimulus/controllers/index.js +9 -0
- data/webpacker-5.4.4/lib/install/examples/svelte/app.svelte +11 -0
- data/webpacker-5.4.4/lib/install/examples/svelte/hello_svelte.js +20 -0
- data/webpacker-5.4.4/lib/install/examples/typescript/hello_typescript.ts +4 -0
- data/webpacker-5.4.4/lib/install/examples/typescript/tsconfig.json +24 -0
- data/webpacker-5.4.4/lib/install/examples/vue/app.vue +22 -0
- data/webpacker-5.4.4/lib/install/examples/vue/hello_vue.js +72 -0
- data/webpacker-5.4.4/lib/install/javascript/packs/application.js +18 -0
- data/webpacker-5.4.4/lib/install/loaders/coffee.js +6 -0
- data/webpacker-5.4.4/lib/install/loaders/elm.js +25 -0
- data/webpacker-5.4.4/lib/install/loaders/erb.js +11 -0
- data/webpacker-5.4.4/lib/install/loaders/svelte.js +9 -0
- data/webpacker-5.4.4/lib/install/loaders/vue.js +6 -0
- data/webpacker-5.4.4/lib/install/react.rb +18 -0
- data/webpacker-5.4.4/lib/install/stimulus.rb +12 -0
- data/webpacker-5.4.4/lib/install/svelte.rb +29 -0
- data/webpacker-5.4.4/lib/install/template.rb +63 -0
- data/webpacker-5.4.4/lib/install/typescript.rb +39 -0
- data/webpacker-5.4.4/lib/install/vue.rb +49 -0
- data/webpacker-5.4.4/lib/tasks/installers.rake +42 -0
- data/webpacker-5.4.4/lib/tasks/webpacker/binstubs.rake +13 -0
- data/webpacker-5.4.4/lib/tasks/webpacker/check_binstubs.rake +12 -0
- data/webpacker-5.4.4/lib/tasks/webpacker/check_node.rake +31 -0
- data/webpacker-5.4.4/lib/tasks/webpacker/check_yarn.rake +30 -0
- data/webpacker-5.4.4/lib/tasks/webpacker/clean.rake +25 -0
- data/webpacker-5.4.4/lib/tasks/webpacker/clobber.rake +20 -0
- data/webpacker-5.4.4/lib/tasks/webpacker/compile.rake +43 -0
- data/webpacker-5.4.4/lib/tasks/webpacker/info.rake +19 -0
- data/webpacker-5.4.4/lib/tasks/webpacker/install.rake +13 -0
- data/webpacker-5.4.4/lib/tasks/webpacker/verify_install.rake +13 -0
- data/webpacker-5.4.4/lib/tasks/webpacker/yarn_install.rake +16 -0
- data/webpacker-5.4.4/lib/tasks/webpacker.rake +28 -0
- data/webpacker-5.4.4/lib/webpacker/commands.rb +74 -0
- data/webpacker-5.4.4/lib/webpacker/compiler.rb +111 -0
- data/webpacker-5.4.4/lib/webpacker/configuration.rb +128 -0
- data/webpacker-5.4.4/lib/webpacker/dev_server.rb +66 -0
- data/webpacker-5.4.4/lib/webpacker/dev_server_proxy.rb +33 -0
- data/webpacker-5.4.4/lib/webpacker/dev_server_runner.rb +72 -0
- data/webpacker-5.4.4/lib/webpacker/env.rb +43 -0
- data/webpacker-5.4.4/lib/webpacker/helper.rb +195 -0
- data/webpacker-5.4.4/lib/webpacker/instance.rb +37 -0
- data/webpacker-5.4.4/lib/webpacker/manifest.rb +118 -0
- data/webpacker-5.4.4/lib/webpacker/railtie.rb +55 -0
- data/webpacker-5.4.4/lib/webpacker/runner.rb +23 -0
- data/webpacker-5.4.4/lib/webpacker/version.rb +4 -0
- data/webpacker-5.4.4/lib/webpacker/webpack_runner.rb +32 -0
- data/webpacker-5.4.4/lib/webpacker.rb +46 -0
- data/webpacker-5.4.4/package/__tests__/config.js +66 -0
- data/webpacker-5.4.4/package/__tests__/dev_server.js +45 -0
- data/webpacker-5.4.4/package/__tests__/development.js +43 -0
- data/webpacker-5.4.4/package/__tests__/env.js +46 -0
- data/webpacker-5.4.4/package/__tests__/production.js +29 -0
- data/webpacker-5.4.4/package/__tests__/staging.js +29 -0
- data/webpacker-5.4.4/package/__tests__/test.js +26 -0
- data/webpacker-5.4.4/package/config.js +40 -0
- data/webpacker-5.4.4/package/configPath.js +3 -0
- data/webpacker-5.4.4/package/config_types/__tests__/config_list.js +118 -0
- data/webpacker-5.4.4/package/config_types/__tests__/config_object.js +43 -0
- data/webpacker-5.4.4/package/config_types/config_list.js +75 -0
- data/webpacker-5.4.4/package/config_types/config_object.js +55 -0
- data/webpacker-5.4.4/package/config_types/index.js +7 -0
- data/webpacker-5.4.4/package/dev_server.js +20 -0
- data/webpacker-5.4.4/package/env.js +18 -0
- data/webpacker-5.4.4/package/environments/__tests__/base.js +101 -0
- data/webpacker-5.4.4/package/environments/base.js +176 -0
- data/webpacker-5.4.4/package/environments/development.js +53 -0
- data/webpacker-5.4.4/package/environments/production.js +77 -0
- data/webpacker-5.4.4/package/environments/test.js +3 -0
- data/webpacker-5.4.4/package/index.js +24 -0
- data/webpacker-5.4.4/package/rules/babel.js +28 -0
- data/webpacker-5.4.4/package/rules/css.js +3 -0
- data/webpacker-5.4.4/package/rules/file.js +21 -0
- data/webpacker-5.4.4/package/rules/index.js +20 -0
- data/webpacker-5.4.4/package/rules/module.css.js +3 -0
- data/webpacker-5.4.4/package/rules/module.sass.js +8 -0
- data/webpacker-5.4.4/package/rules/node_modules.js +22 -0
- data/webpacker-5.4.4/package/rules/sass.js +17 -0
- data/webpacker-5.4.4/package/utils/__tests__/deep_assign.js +32 -0
- data/webpacker-5.4.4/package/utils/__tests__/deep_merge.js +10 -0
- data/webpacker-5.4.4/package/utils/__tests__/get_style_rule.js +65 -0
- data/webpacker-5.4.4/package/utils/__tests__/objectify.js +9 -0
- data/webpacker-5.4.4/package/utils/deep_assign.js +22 -0
- data/webpacker-5.4.4/package/utils/deep_merge.js +22 -0
- data/webpacker-5.4.4/package/utils/get_style_rule.js +45 -0
- data/webpacker-5.4.4/package/utils/helpers.js +58 -0
- data/webpacker-5.4.4/package/utils/objectify.js +3 -0
- data/webpacker-5.4.4/package.json +82 -0
- data/webpacker-5.4.4/test/command_test.rb +33 -0
- data/webpacker-5.4.4/test/compiler_test.rb +80 -0
- data/webpacker-5.4.4/test/configuration_test.rb +109 -0
- data/webpacker-5.4.4/test/dev_server_runner_test.rb +51 -0
- data/webpacker-5.4.4/test/dev_server_test.rb +47 -0
- data/webpacker-5.4.4/test/env_test.rb +23 -0
- data/webpacker-5.4.4/test/helper_test.rb +157 -0
- data/webpacker-5.4.4/test/manifest_test.rb +73 -0
- data/webpacker-5.4.4/test/rake_tasks_test.rb +80 -0
- data/webpacker-5.4.4/test/test_app/Rakefile +3 -0
- data/webpacker-5.4.4/test/test_app/app/javascript/packs/application.js +10 -0
- data/webpacker-5.4.4/test/test_app/app/javascript/packs/multi_entry.css +4 -0
- data/webpacker-5.4.4/test/test_app/app/javascript/packs/multi_entry.js +4 -0
- data/webpacker-5.4.4/test/test_app/bin/webpack +14 -0
- data/webpacker-5.4.4/test/test_app/bin/webpack-dev-server +14 -0
- data/webpacker-5.4.4/test/test_app/config/application.rb +11 -0
- data/webpacker-5.4.4/test/test_app/config/environment.rb +4 -0
- data/webpacker-5.4.4/test/test_app/config/webpack/development.js +0 -0
- data/webpacker-5.4.4/test/test_app/config/webpacker.yml +103 -0
- data/webpacker-5.4.4/test/test_app/config/webpacker_public_root.yml +19 -0
- data/webpacker-5.4.4/test/test_app/config.ru +5 -0
- data/webpacker-5.4.4/test/test_app/package.json +13 -0
- data/webpacker-5.4.4/test/test_app/public/packs/manifest.json +32 -0
- data/webpacker-5.4.4/test/test_app/yarn.lock +11 -0
- data/webpacker-5.4.4/test/test_helper.rb +33 -0
- data/webpacker-5.4.4/test/webpack_runner_test.rb +51 -0
- data/webpacker-5.4.4/test/webpacker_test.rb +13 -0
- data/webpacker-5.4.4/webpacker.gemspec +31 -0
- data/webpacker-5.4.4/yarn.lock +8271 -0
- metadata +215 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
require "test_helper"
|
|
2
|
+
|
|
3
|
+
class ManifestTest < Minitest::Test
|
|
4
|
+
def test_lookup_exception!
|
|
5
|
+
asset_file = "calendar.js"
|
|
6
|
+
|
|
7
|
+
error = assert_raises_manifest_missing_entry_error do
|
|
8
|
+
Webpacker.manifest.lookup!(asset_file)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
assert_match "Webpacker can't find #{asset_file} in #{manifest_path}", error.message
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def test_lookup_with_type_exception!
|
|
15
|
+
asset_file = "calendar"
|
|
16
|
+
|
|
17
|
+
error = assert_raises_manifest_missing_entry_error do
|
|
18
|
+
Webpacker.manifest.lookup!(asset_file, type: :javascript)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
assert_match "Webpacker can't find #{asset_file}.js in #{manifest_path}", error.message
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def test_lookup_success!
|
|
25
|
+
assert_equal Webpacker.manifest.lookup!("bootstrap.js"), "/packs/bootstrap-300631c4f0e0f9c865bc.js"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def test_lookup_nil
|
|
29
|
+
assert_nil Webpacker.manifest.lookup("foo.js")
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def test_lookup_chunks_nil
|
|
33
|
+
assert_nil Webpacker.manifest.lookup_pack_with_chunks("foo.js")
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def test_lookup_success
|
|
37
|
+
assert_equal Webpacker.manifest.lookup("bootstrap.js"), "/packs/bootstrap-300631c4f0e0f9c865bc.js"
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def test_lookup_entrypoint_exception!
|
|
41
|
+
asset_file = "calendar"
|
|
42
|
+
|
|
43
|
+
error = assert_raises_manifest_missing_entry_error do
|
|
44
|
+
Webpacker.manifest.lookup_pack_with_chunks!(asset_file, type: :javascript)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
assert_match "Webpacker can't find #{asset_file}.js in #{manifest_path}", error.message
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def test_lookup_entrypoint
|
|
51
|
+
application_entrypoints = [
|
|
52
|
+
"/packs/vendors~application~bootstrap-c20632e7baf2c81200d3.chunk.js",
|
|
53
|
+
"/packs/vendors~application-e55f2aae30c07fb6d82a.chunk.js",
|
|
54
|
+
"/packs/application-k344a6d59eef8632c9d1.js"
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
assert_equal Webpacker.manifest.lookup_pack_with_chunks!("application", type: :javascript), application_entrypoints
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
private
|
|
61
|
+
|
|
62
|
+
def assert_raises_manifest_missing_entry_error(&block)
|
|
63
|
+
error = nil
|
|
64
|
+
Webpacker.config.stub :compile?, false do
|
|
65
|
+
error = assert_raises Webpacker::Manifest::MissingEntryError, &block
|
|
66
|
+
end
|
|
67
|
+
error
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def manifest_path
|
|
71
|
+
File.expand_path File.join(File.dirname(__FILE__), "test_app/public/packs", "manifest.json").to_s
|
|
72
|
+
end
|
|
73
|
+
end
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
require "test_helper"
|
|
2
|
+
|
|
3
|
+
class RakeTasksTest < Minitest::Test
|
|
4
|
+
def test_rake_tasks
|
|
5
|
+
output = Dir.chdir(test_app_path) { `rake -T` }
|
|
6
|
+
assert_includes output, "webpacker"
|
|
7
|
+
assert_includes output, "webpacker:check_binstubs"
|
|
8
|
+
assert_includes output, "webpacker:check_node"
|
|
9
|
+
assert_includes output, "webpacker:check_yarn"
|
|
10
|
+
assert_includes output, "webpacker:clean"
|
|
11
|
+
assert_includes output, "webpacker:clobber"
|
|
12
|
+
assert_includes output, "webpacker:compile"
|
|
13
|
+
assert_includes output, "webpacker:install"
|
|
14
|
+
assert_includes output, "webpacker:install:angular"
|
|
15
|
+
assert_includes output, "webpacker:install:coffee"
|
|
16
|
+
assert_includes output, "webpacker:install:elm"
|
|
17
|
+
assert_includes output, "webpacker:install:erb"
|
|
18
|
+
assert_includes output, "webpacker:install:react"
|
|
19
|
+
assert_includes output, "webpacker:install:svelte"
|
|
20
|
+
assert_includes output, "webpacker:install:stimulus"
|
|
21
|
+
assert_includes output, "webpacker:install:typescript"
|
|
22
|
+
assert_includes output, "webpacker:install:vue"
|
|
23
|
+
assert_includes output, "webpacker:verify_install"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def test_rake_task_webpacker_check_binstubs
|
|
27
|
+
output = Dir.chdir(test_app_path) { `rake webpacker:check_binstubs 2>&1` }
|
|
28
|
+
refute_includes output, "webpack binstubs not found."
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def test_check_node_version
|
|
32
|
+
output = Dir.chdir(test_app_path) { `rake webpacker:check_node 2>&1` }
|
|
33
|
+
refute_includes output, "Webpacker requires Node.js"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def test_check_yarn_version
|
|
37
|
+
output = Dir.chdir(test_app_path) { `rake webpacker:check_yarn 2>&1` }
|
|
38
|
+
refute_includes output, "Yarn not installed"
|
|
39
|
+
refute_includes output, "Webpacker requires Yarn"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def test_rake_webpacker_yarn_install_in_non_production_environments
|
|
43
|
+
assert_includes test_app_dev_dependencies, "right-pad"
|
|
44
|
+
|
|
45
|
+
Webpacker.with_node_env("test") do
|
|
46
|
+
Dir.chdir(test_app_path) do
|
|
47
|
+
`bundle exec rake webpacker:yarn_install`
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
assert_includes installed_node_module_names, "right-pad",
|
|
52
|
+
"Expected dev dependencies to be installed"
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def test_rake_webpacker_yarn_install_in_production_environment
|
|
56
|
+
Webpacker.with_node_env("production") do
|
|
57
|
+
Dir.chdir(test_app_path) do
|
|
58
|
+
`bundle exec rake webpacker:yarn_install`
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
refute_includes installed_node_module_names, "right-pad",
|
|
63
|
+
"Expected only production dependencies to be installed"
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
private
|
|
67
|
+
def test_app_path
|
|
68
|
+
File.expand_path("test_app", __dir__)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def test_app_dev_dependencies
|
|
72
|
+
package_json = File.expand_path("package.json", test_app_path)
|
|
73
|
+
JSON.parse(File.read(package_json))["devDependencies"]
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def installed_node_module_names
|
|
77
|
+
node_modules_path = File.expand_path("node_modules", test_app_path)
|
|
78
|
+
Dir.chdir(node_modules_path) { Dir.glob("*") }
|
|
79
|
+
end
|
|
80
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* eslint no-console:0 */
|
|
2
|
+
// This file is automatically compiled by Webpack, along with any other files
|
|
3
|
+
// present in this directory. You're encouraged to place your actual application logic in
|
|
4
|
+
// a relevant structure within app/javascript and only use these pack files to reference
|
|
5
|
+
// that code so it'll be compiled.
|
|
6
|
+
//
|
|
7
|
+
// To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
|
|
8
|
+
// layout file, like app/views/layouts/application.html.erb
|
|
9
|
+
|
|
10
|
+
console.log('Hello World from Webpacker')
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
|
|
4
|
+
ENV["NODE_ENV"] ||= ENV["RAILS_ENV"]
|
|
5
|
+
|
|
6
|
+
require "pathname"
|
|
7
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
|
8
|
+
Pathname.new(__FILE__).realpath)
|
|
9
|
+
|
|
10
|
+
require "bundler/setup"
|
|
11
|
+
|
|
12
|
+
require "webpacker"
|
|
13
|
+
require "webpacker/webpack_runner"
|
|
14
|
+
Webpacker::WebpackRunner.run(ARGV)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
|
|
4
|
+
ENV["NODE_ENV"] ||= ENV["RAILS_ENV"]
|
|
5
|
+
|
|
6
|
+
require "pathname"
|
|
7
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
|
8
|
+
Pathname.new(__FILE__).realpath)
|
|
9
|
+
|
|
10
|
+
require "bundler/setup"
|
|
11
|
+
|
|
12
|
+
require "webpacker"
|
|
13
|
+
require "webpacker/dev_server_runner"
|
|
14
|
+
Webpacker::DevServerRunner.run(ARGV)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require "action_controller/railtie"
|
|
2
|
+
require "action_view/railtie"
|
|
3
|
+
require "webpacker"
|
|
4
|
+
|
|
5
|
+
module TestApp
|
|
6
|
+
class Application < ::Rails::Application
|
|
7
|
+
config.secret_key_base = "abcdef"
|
|
8
|
+
config.eager_load = true
|
|
9
|
+
config.active_support.test_order = :sorted
|
|
10
|
+
end
|
|
11
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Note: You must restart bin/webpack-dev-server for changes to take effect
|
|
2
|
+
|
|
3
|
+
default: &default
|
|
4
|
+
source_path: app/javascript
|
|
5
|
+
source_entry_path: packs
|
|
6
|
+
public_root_path: public
|
|
7
|
+
public_output_path: packs
|
|
8
|
+
cache_path: tmp/cache/webpacker
|
|
9
|
+
webpack_compile_output: false
|
|
10
|
+
|
|
11
|
+
# Additional paths webpack should lookup modules
|
|
12
|
+
# ['app/assets', 'engine/foo/app/assets']
|
|
13
|
+
additional_paths:
|
|
14
|
+
- app/assets
|
|
15
|
+
- /etc/yarn
|
|
16
|
+
|
|
17
|
+
# This configuration option is deprecated and is only here for testing, to
|
|
18
|
+
# ensure backwards-compatibility. Please use `additional_paths`.
|
|
19
|
+
resolved_paths:
|
|
20
|
+
- app/elm
|
|
21
|
+
|
|
22
|
+
# Reload manifest.json on all requests so we reload latest compiled packs
|
|
23
|
+
cache_manifest: false
|
|
24
|
+
|
|
25
|
+
# Extract and emit a css file
|
|
26
|
+
extract_css: false
|
|
27
|
+
|
|
28
|
+
static_assets_extensions:
|
|
29
|
+
- .jpg
|
|
30
|
+
- .jpeg
|
|
31
|
+
- .png
|
|
32
|
+
- .gif
|
|
33
|
+
- .tiff
|
|
34
|
+
- .ico
|
|
35
|
+
- .svg
|
|
36
|
+
|
|
37
|
+
extensions:
|
|
38
|
+
- .mjs
|
|
39
|
+
- .js
|
|
40
|
+
- .sass
|
|
41
|
+
- .scss
|
|
42
|
+
- .css
|
|
43
|
+
- .module.sass
|
|
44
|
+
- .module.scss
|
|
45
|
+
- .module.css
|
|
46
|
+
- .png
|
|
47
|
+
- .svg
|
|
48
|
+
- .gif
|
|
49
|
+
- .jpeg
|
|
50
|
+
- .jpg
|
|
51
|
+
- .elm
|
|
52
|
+
|
|
53
|
+
development:
|
|
54
|
+
<<: *default
|
|
55
|
+
compile: true
|
|
56
|
+
|
|
57
|
+
# Reference: https://webpack.js.org/configuration/dev-server/
|
|
58
|
+
dev_server:
|
|
59
|
+
https: false
|
|
60
|
+
host: localhost
|
|
61
|
+
port: 3035
|
|
62
|
+
public: localhost:3035
|
|
63
|
+
hmr: false
|
|
64
|
+
# Inline should be set to true if using HMR
|
|
65
|
+
inline: true
|
|
66
|
+
overlay: true
|
|
67
|
+
disable_host_check: true
|
|
68
|
+
use_local_ip: false
|
|
69
|
+
pretty: false
|
|
70
|
+
|
|
71
|
+
test:
|
|
72
|
+
<<: *default
|
|
73
|
+
compile: true
|
|
74
|
+
|
|
75
|
+
# Compile test packs to a separate directory
|
|
76
|
+
public_output_path: packs-test
|
|
77
|
+
|
|
78
|
+
production:
|
|
79
|
+
<<: *default
|
|
80
|
+
|
|
81
|
+
# Production depends on precompilation of packs prior to booting for performance.
|
|
82
|
+
compile: false
|
|
83
|
+
|
|
84
|
+
# Extract and emit a css file
|
|
85
|
+
extract_css: true
|
|
86
|
+
|
|
87
|
+
# Cache manifest.json for performance
|
|
88
|
+
cache_manifest: true
|
|
89
|
+
|
|
90
|
+
staging:
|
|
91
|
+
<<: *default
|
|
92
|
+
|
|
93
|
+
# Production depends on precompilation of packs prior to booting for performance.
|
|
94
|
+
compile: false
|
|
95
|
+
|
|
96
|
+
# Extract and emit a css file
|
|
97
|
+
extract_css: true
|
|
98
|
+
|
|
99
|
+
# Cache manifest.json for performance
|
|
100
|
+
cache_manifest: true
|
|
101
|
+
|
|
102
|
+
# Compile staging packs to a separate directory
|
|
103
|
+
public_output_path: packs-staging
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Note: You must restart bin/webpack-dev-server for changes to take effect
|
|
2
|
+
|
|
3
|
+
default: &default
|
|
4
|
+
public_root_path: ../public
|
|
5
|
+
|
|
6
|
+
development:
|
|
7
|
+
<<: *default
|
|
8
|
+
compile: true
|
|
9
|
+
|
|
10
|
+
test:
|
|
11
|
+
<<: *default
|
|
12
|
+
compile: true
|
|
13
|
+
public_output_path: packs-test
|
|
14
|
+
|
|
15
|
+
production:
|
|
16
|
+
<<: *default
|
|
17
|
+
compile: false
|
|
18
|
+
extract_css: true
|
|
19
|
+
cache_manifest: true
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"bootstrap.css": "/packs/bootstrap-c38deda30895059837cf.css",
|
|
3
|
+
"application.css": "/packs/application-dd6b1cd38bfa093df600.css",
|
|
4
|
+
"bootstrap.js": "/packs/bootstrap-300631c4f0e0f9c865bc.js",
|
|
5
|
+
"application.js": "/packs/application-k344a6d59eef8632c9d1.js",
|
|
6
|
+
"application.png": "/packs/application-k344a6d59eef8632c9d1.png",
|
|
7
|
+
"fonts/fa-regular-400.woff2": "/packs/fonts/fa-regular-400-944fb546bd7018b07190a32244f67dc9.woff2",
|
|
8
|
+
"media/images/image.jpg": "/packs/media/images/image-c38deda30895059837cf.jpg",
|
|
9
|
+
"media/images/image-2x.jpg": "/packs/media/images/image-2x-7cca48e6cae66ec07b8e.jpg",
|
|
10
|
+
"media/images/nested/image.jpg": "/packs/media/images/nested/image-c38deda30895059837cf.jpg",
|
|
11
|
+
"media/images/mb-icon.png": "/packs/media/images/mb-icon-c38deda30895059837cf.png",
|
|
12
|
+
"media/images/nested/mb-icon.png": "/packs/media/images/nested/mb-icon-c38deda30895059837cf.png",
|
|
13
|
+
"entrypoints": {
|
|
14
|
+
"application": {
|
|
15
|
+
"js": [
|
|
16
|
+
"/packs/vendors~application~bootstrap-c20632e7baf2c81200d3.chunk.js",
|
|
17
|
+
"/packs/vendors~application-e55f2aae30c07fb6d82a.chunk.js",
|
|
18
|
+
"/packs/application-k344a6d59eef8632c9d1.js"
|
|
19
|
+
],
|
|
20
|
+
"css": [
|
|
21
|
+
"/packs/1-c20632e7baf2c81200d3.chunk.css",
|
|
22
|
+
"/packs/application-k344a6d59eef8632c9d1.chunk.css"
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
"hello_stimulus": {
|
|
26
|
+
"css": [
|
|
27
|
+
"/packs/1-c20632e7baf2c81200d3.chunk.css",
|
|
28
|
+
"/packs/hello_stimulus-k344a6d59eef8632c9d1.chunk.css"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
2
|
+
# yarn lockfile v1
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
left-pad@^1.2.0:
|
|
6
|
+
version "1.2.0"
|
|
7
|
+
resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.2.0.tgz#d30a73c6b8201d8f7d8e7956ba9616087a68e0ee"
|
|
8
|
+
|
|
9
|
+
right-pad@^1.0.1:
|
|
10
|
+
version "1.0.1"
|
|
11
|
+
resolved "https://registry.yarnpkg.com/right-pad/-/right-pad-1.0.1.tgz#8ca08c2cbb5b55e74dafa96bf7fd1a27d568c8d0"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require "minitest/autorun"
|
|
3
|
+
require "rails"
|
|
4
|
+
require "rails/test_help"
|
|
5
|
+
require "byebug"
|
|
6
|
+
|
|
7
|
+
require_relative "test_app/config/environment"
|
|
8
|
+
|
|
9
|
+
Rails.env = "production"
|
|
10
|
+
|
|
11
|
+
Webpacker.instance = ::Webpacker::Instance.new
|
|
12
|
+
|
|
13
|
+
class Webpacker::Test < Minitest::Test
|
|
14
|
+
private
|
|
15
|
+
def reloaded_config
|
|
16
|
+
Webpacker.instance.instance_variable_set(:@env, nil)
|
|
17
|
+
Webpacker.instance.instance_variable_set(:@config, nil)
|
|
18
|
+
Webpacker.instance.instance_variable_set(:@dev_server, nil)
|
|
19
|
+
Webpacker.env
|
|
20
|
+
Webpacker.config
|
|
21
|
+
Webpacker.dev_server
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def with_rails_env(env)
|
|
25
|
+
original = Rails.env
|
|
26
|
+
Rails.env = ActiveSupport::StringInquirer.new(env)
|
|
27
|
+
reloaded_config
|
|
28
|
+
yield
|
|
29
|
+
ensure
|
|
30
|
+
Rails.env = ActiveSupport::StringInquirer.new(original)
|
|
31
|
+
reloaded_config
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
require "test_helper"
|
|
2
|
+
require "webpacker/webpack_runner"
|
|
3
|
+
|
|
4
|
+
class WebpackRunnerTest < Webpacker::Test
|
|
5
|
+
def setup
|
|
6
|
+
@original_node_env, ENV["NODE_ENV"] = ENV["NODE_ENV"], "development"
|
|
7
|
+
@original_rails_env, ENV["RAILS_ENV"] = ENV["RAILS_ENV"], "development"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def teardown
|
|
11
|
+
ENV["NODE_ENV"] = @original_node_env
|
|
12
|
+
ENV["RAILS_ENV"] = @original_rails_env
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def test_run_cmd_via_node_modules
|
|
16
|
+
cmd = ["#{test_app_path}/node_modules/.bin/webpack", "--config", "#{test_app_path}/config/webpack/development.js"]
|
|
17
|
+
|
|
18
|
+
verify_command(cmd, use_node_modules: true)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_run_cmd_via_yarn
|
|
22
|
+
cmd = ["yarn", "webpack", "--config", "#{test_app_path}/config/webpack/development.js"]
|
|
23
|
+
|
|
24
|
+
verify_command(cmd, use_node_modules: false)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
def test_app_path
|
|
29
|
+
File.expand_path("test_app", __dir__)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def verify_command(cmd, use_node_modules: true)
|
|
33
|
+
cwd = Dir.pwd
|
|
34
|
+
Dir.chdir(test_app_path)
|
|
35
|
+
|
|
36
|
+
klass = Webpacker::WebpackRunner
|
|
37
|
+
instance = klass.new([])
|
|
38
|
+
mock = Minitest::Mock.new
|
|
39
|
+
mock.expect(:call, nil, [Webpacker::Compiler.env, *cmd])
|
|
40
|
+
|
|
41
|
+
klass.stub(:new, instance) do
|
|
42
|
+
instance.stub(:node_modules_bin_exist?, use_node_modules) do
|
|
43
|
+
Kernel.stub(:exec, mock) { klass.run([]) }
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
mock.verify
|
|
48
|
+
ensure
|
|
49
|
+
Dir.chdir(cwd)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require "test_helper"
|
|
2
|
+
|
|
3
|
+
class WebpackerTest < Webpacker::Test
|
|
4
|
+
def test_config_params
|
|
5
|
+
assert_equal Rails.env, Webpacker.config.env
|
|
6
|
+
assert_equal Webpacker.instance.root_path, Webpacker.config.root_path
|
|
7
|
+
assert_equal Webpacker.instance.config_path, Webpacker.config.config_path
|
|
8
|
+
|
|
9
|
+
with_rails_env("test") do
|
|
10
|
+
assert_equal "test", Webpacker.config.env
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
|
2
|
+
require "webpacker/version"
|
|
3
|
+
|
|
4
|
+
Gem::Specification.new do |s|
|
|
5
|
+
s.name = "webpacker"
|
|
6
|
+
s.version = Webpacker::VERSION
|
|
7
|
+
s.authors = [ "David Heinemeier Hansson", "Gaurav Tiwari" ]
|
|
8
|
+
s.email = [ "david@basecamp.com", "gaurav@gauravtiwari.co.uk" ]
|
|
9
|
+
s.summary = "Use webpack to manage app-like JavaScript modules in Rails"
|
|
10
|
+
s.homepage = "https://github.com/rails/webpacker"
|
|
11
|
+
s.license = "MIT"
|
|
12
|
+
|
|
13
|
+
s.metadata = {
|
|
14
|
+
"source_code_uri" => "https://github.com/rails/webpacker/tree/v#{Webpacker::VERSION}",
|
|
15
|
+
"changelog_uri" => "https://github.com/rails/webpacker/blob/v#{Webpacker::VERSION}/CHANGELOG.md"
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
s.required_ruby_version = ">= 2.4.0"
|
|
19
|
+
|
|
20
|
+
s.add_dependency "activesupport", ">= 5.2"
|
|
21
|
+
s.add_dependency "railties", ">= 5.2"
|
|
22
|
+
s.add_dependency "rack-proxy", ">= 0.6.1"
|
|
23
|
+
s.add_dependency "semantic_range", ">= 2.3.0"
|
|
24
|
+
|
|
25
|
+
s.add_development_dependency "bundler", ">= 1.3.0"
|
|
26
|
+
s.add_development_dependency "rubocop", "0.93.1"
|
|
27
|
+
s.add_development_dependency "rubocop-performance"
|
|
28
|
+
|
|
29
|
+
s.files = `git ls-files`.split("\n")
|
|
30
|
+
s.test_files = `git ls-files -- test/*`.split("\n")
|
|
31
|
+
end
|