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,58 @@
|
|
|
1
|
+
const { stringify } = require('flatted')
|
|
2
|
+
|
|
3
|
+
const isObject = (value) => typeof value === 'object'
|
|
4
|
+
&& value !== null
|
|
5
|
+
&& (value.length === undefined || value.length === null)
|
|
6
|
+
|
|
7
|
+
const isNotObject = (value) => !isObject(value)
|
|
8
|
+
|
|
9
|
+
const isBoolean = (str) => /^true/.test(str) || /^false/.test(str)
|
|
10
|
+
|
|
11
|
+
const isEmpty = (value) => value === null || value === undefined
|
|
12
|
+
|
|
13
|
+
const isString = (key) => key && typeof key === 'string'
|
|
14
|
+
|
|
15
|
+
const isStrPath = (key) => {
|
|
16
|
+
if (!isString(key)) throw new Error(`Key ${key} should be string`)
|
|
17
|
+
return isString(key) && key.includes('.')
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const isArray = (value) => Array.isArray(value)
|
|
21
|
+
|
|
22
|
+
const isEqual = (target, source) => stringify(target) === stringify(source)
|
|
23
|
+
|
|
24
|
+
const canMerge = (value) => isObject(value) || isArray(value)
|
|
25
|
+
|
|
26
|
+
const prettyPrint = (obj) => JSON.stringify(obj, null, 2)
|
|
27
|
+
|
|
28
|
+
const chdirTestApp = () => {
|
|
29
|
+
try {
|
|
30
|
+
return process.chdir('test/test_app')
|
|
31
|
+
} catch (e) {
|
|
32
|
+
return null
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const chdirCwd = () => process.chdir(process.cwd())
|
|
37
|
+
|
|
38
|
+
const resetEnv = () => {
|
|
39
|
+
process.env = {}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const ensureTrailingSlash = (path) => (path.endsWith('/') ? path : `${path}/`)
|
|
43
|
+
|
|
44
|
+
module.exports = {
|
|
45
|
+
chdirTestApp,
|
|
46
|
+
chdirCwd,
|
|
47
|
+
ensureTrailingSlash,
|
|
48
|
+
isObject,
|
|
49
|
+
isNotObject,
|
|
50
|
+
isBoolean,
|
|
51
|
+
isArray,
|
|
52
|
+
isEqual,
|
|
53
|
+
isEmpty,
|
|
54
|
+
isStrPath,
|
|
55
|
+
canMerge,
|
|
56
|
+
prettyPrint,
|
|
57
|
+
resetEnv
|
|
58
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rails/webpacker",
|
|
3
|
+
"version": "5.4.3",
|
|
4
|
+
"description": "Use webpack to manage app-like JavaScript modules in Rails",
|
|
5
|
+
"main": "package/index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"package",
|
|
8
|
+
"lib/install/config/webpacker.yml"
|
|
9
|
+
],
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=10.17.0",
|
|
12
|
+
"yarn": ">=1 <4"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@babel/core": "^7.15.0",
|
|
16
|
+
"@babel/plugin-proposal-class-properties": "^7.14.5",
|
|
17
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.14.7",
|
|
18
|
+
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
19
|
+
"@babel/plugin-transform-destructuring": "^7.14.7",
|
|
20
|
+
"@babel/plugin-transform-regenerator": "^7.14.5",
|
|
21
|
+
"@babel/plugin-transform-runtime": "^7.15.0",
|
|
22
|
+
"@babel/preset-env": "^7.15.0",
|
|
23
|
+
"@babel/runtime": "^7.15.3",
|
|
24
|
+
"babel-loader": "^8.2.2",
|
|
25
|
+
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
26
|
+
"babel-plugin-macros": "^2.8.0",
|
|
27
|
+
"case-sensitive-paths-webpack-plugin": "^2.4.0",
|
|
28
|
+
"compression-webpack-plugin": "^4.0.1",
|
|
29
|
+
"core-js": "^3.16.2",
|
|
30
|
+
"css-loader": "^3.6.0",
|
|
31
|
+
"file-loader": "^6.2.0",
|
|
32
|
+
"flatted": "^3.2.2",
|
|
33
|
+
"glob": "^7.1.7",
|
|
34
|
+
"js-yaml": "^3.14.1",
|
|
35
|
+
"mini-css-extract-plugin": "^0.9.0",
|
|
36
|
+
"optimize-css-assets-webpack-plugin": "^5.0.8",
|
|
37
|
+
"path-complete-extname": "^1.0.0",
|
|
38
|
+
"pnp-webpack-plugin": "^1.7.0",
|
|
39
|
+
"postcss-flexbugs-fixes": "^4.2.1",
|
|
40
|
+
"postcss-import": "^12.0.1",
|
|
41
|
+
"postcss-loader": "^3.0.0",
|
|
42
|
+
"postcss-preset-env": "^6.7.0",
|
|
43
|
+
"postcss-safe-parser": "^4.0.2",
|
|
44
|
+
"regenerator-runtime": "^0.13.9",
|
|
45
|
+
"sass": "^1.38.0",
|
|
46
|
+
"sass-loader": "10.1.1",
|
|
47
|
+
"style-loader": "^1.3.0",
|
|
48
|
+
"terser-webpack-plugin": "^4.2.3",
|
|
49
|
+
"webpack": "^4.46.0",
|
|
50
|
+
"webpack-assets-manifest": "^3.1.1",
|
|
51
|
+
"webpack-cli": "^3.3.12",
|
|
52
|
+
"webpack-sources": "^1.4.3"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"eslint": "^7.32.0",
|
|
56
|
+
"eslint-config-airbnb": "^18.2.1",
|
|
57
|
+
"eslint-plugin-import": "^2.24.0",
|
|
58
|
+
"eslint-plugin-jsx-a11y": "^6.4.1",
|
|
59
|
+
"eslint-plugin-react": "^7.24.0",
|
|
60
|
+
"jest": "^27.0.6"
|
|
61
|
+
},
|
|
62
|
+
"jest": {
|
|
63
|
+
"testRegex": "(/__tests__/.*|(\\.|/))\\.jsx?$",
|
|
64
|
+
"roots": [
|
|
65
|
+
"<rootDir>/package"
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
"scripts": {
|
|
69
|
+
"test": "jest",
|
|
70
|
+
"lint": "eslint package/"
|
|
71
|
+
},
|
|
72
|
+
"repository": {
|
|
73
|
+
"type": "git",
|
|
74
|
+
"url": "git+https://github.com/rails/webpacker.git"
|
|
75
|
+
},
|
|
76
|
+
"author": "David Heinemeier Hansson <david@basecamp.com>",
|
|
77
|
+
"license": "MIT",
|
|
78
|
+
"bugs": {
|
|
79
|
+
"url": "https://github.com/rails/webpacker/issues"
|
|
80
|
+
},
|
|
81
|
+
"homepage": "https://github.com/rails/webpacker"
|
|
82
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require "test_helper"
|
|
2
|
+
|
|
3
|
+
class CommandTest < Minitest::Test
|
|
4
|
+
def test_compile_command_returns_success_status_when_stale
|
|
5
|
+
Webpacker.compiler.stub :stale?, true do
|
|
6
|
+
Webpacker.compiler.stub :run_webpack, true do
|
|
7
|
+
assert_equal true, Webpacker.commands.compile
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def test_compile_command_returns_success_status_when_fresh
|
|
13
|
+
Webpacker.compiler.stub :stale?, false do
|
|
14
|
+
Webpacker.compiler.stub :run_webpack, true do
|
|
15
|
+
assert_equal true, Webpacker.commands.compile
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def test_compile_command_returns_failure_status_when_stale
|
|
21
|
+
Webpacker.compiler.stub :stale?, true do
|
|
22
|
+
Webpacker.compiler.stub :run_webpack, false do
|
|
23
|
+
assert_equal false, Webpacker.commands.compile
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def test_clean_command_works_with_nested_hashes_and_without_any_compiled_files
|
|
29
|
+
File.stub :delete, true do
|
|
30
|
+
assert Webpacker.commands.clean
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
require "test_helper"
|
|
2
|
+
|
|
3
|
+
class CompilerTest < Minitest::Test
|
|
4
|
+
def remove_compilation_digest_path
|
|
5
|
+
Webpacker.compiler.send(:compilation_digest_path).tap do |path|
|
|
6
|
+
path.delete if path.exist?
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def setup
|
|
11
|
+
remove_compilation_digest_path
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def teardown
|
|
15
|
+
remove_compilation_digest_path
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def test_custom_environment_variables
|
|
19
|
+
assert_nil Webpacker.compiler.send(:webpack_env)["FOO"]
|
|
20
|
+
Webpacker.compiler.env["FOO"] = "BAR"
|
|
21
|
+
assert Webpacker.compiler.send(:webpack_env)["FOO"] == "BAR"
|
|
22
|
+
ensure
|
|
23
|
+
Webpacker.compiler.env = {}
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def test_default_watched_paths
|
|
27
|
+
assert_equal Webpacker.compiler.send(:default_watched_paths), [
|
|
28
|
+
"app/assets/**/*{.mjs,.js,.sass,.scss,.css,.module.sass,.module.scss,.module.css,.png,.svg,.gif,.jpeg,.jpg,.elm}",
|
|
29
|
+
"/etc/yarn/**/*{.mjs,.js,.sass,.scss,.css,.module.sass,.module.scss,.module.css,.png,.svg,.gif,.jpeg,.jpg,.elm}",
|
|
30
|
+
"app/elm/**/*{.mjs,.js,.sass,.scss,.css,.module.sass,.module.scss,.module.css,.png,.svg,.gif,.jpeg,.jpg,.elm}",
|
|
31
|
+
"app/javascript/**/*{.mjs,.js,.sass,.scss,.css,.module.sass,.module.scss,.module.css,.png,.svg,.gif,.jpeg,.jpg,.elm}",
|
|
32
|
+
"yarn.lock",
|
|
33
|
+
"package.json",
|
|
34
|
+
"config/webpack/**/*"
|
|
35
|
+
]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def test_freshness
|
|
39
|
+
assert Webpacker.compiler.stale?
|
|
40
|
+
assert !Webpacker.compiler.fresh?
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def test_compile
|
|
44
|
+
assert !Webpacker.compiler.compile
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def test_freshness_on_compile_success
|
|
48
|
+
status = OpenStruct.new(success?: true)
|
|
49
|
+
|
|
50
|
+
assert Webpacker.compiler.stale?
|
|
51
|
+
Open3.stub :capture3, [:sterr, :stdout, status] do
|
|
52
|
+
Webpacker.compiler.compile
|
|
53
|
+
assert Webpacker.compiler.fresh?
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def test_freshness_on_compile_fail
|
|
58
|
+
status = OpenStruct.new(success?: false)
|
|
59
|
+
|
|
60
|
+
assert Webpacker.compiler.stale?
|
|
61
|
+
Open3.stub :capture3, [:sterr, :stdout, status] do
|
|
62
|
+
Webpacker.compiler.compile
|
|
63
|
+
assert Webpacker.compiler.fresh?
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def test_compilation_digest_path
|
|
68
|
+
assert_equal Webpacker.compiler.send(:compilation_digest_path).basename.to_s, "last-compilation-digest-#{Webpacker.env}"
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def test_external_env_variables
|
|
72
|
+
assert_nil Webpacker.compiler.send(:webpack_env)["WEBPACKER_ASSET_HOST"]
|
|
73
|
+
assert_nil Webpacker.compiler.send(:webpack_env)["WEBPACKER_RELATIVE_URL_ROOT"]
|
|
74
|
+
|
|
75
|
+
ENV["WEBPACKER_ASSET_HOST"] = "foo.bar"
|
|
76
|
+
ENV["WEBPACKER_RELATIVE_URL_ROOT"] = "/baz"
|
|
77
|
+
assert_equal Webpacker.compiler.send(:webpack_env)["WEBPACKER_ASSET_HOST"], "foo.bar"
|
|
78
|
+
assert_equal Webpacker.compiler.send(:webpack_env)["WEBPACKER_RELATIVE_URL_ROOT"], "/baz"
|
|
79
|
+
end
|
|
80
|
+
end
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
require "test_helper"
|
|
2
|
+
|
|
3
|
+
class ConfigurationTest < Webpacker::Test
|
|
4
|
+
def setup
|
|
5
|
+
@config = Webpacker::Configuration.new(
|
|
6
|
+
root_path: Pathname.new(File.expand_path("test_app", __dir__)),
|
|
7
|
+
config_path: Pathname.new(File.expand_path("./test_app/config/webpacker.yml", __dir__)),
|
|
8
|
+
env: "production"
|
|
9
|
+
)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def test_source_path
|
|
13
|
+
source_path = File.expand_path File.join(File.dirname(__FILE__), "test_app/app/javascript").to_s
|
|
14
|
+
assert_equal source_path, @config.source_path.to_s
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def test_source_path_globbed
|
|
18
|
+
assert_equal @config.source_path_globbed,
|
|
19
|
+
"app/javascript/**/*{.mjs,.js,.sass,.scss,.css,.module.sass,.module.scss,.module.css,.png,.svg,.gif,.jpeg,.jpg,.elm}"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def test_source_entry_path
|
|
23
|
+
source_entry_path = File.expand_path File.join(File.dirname(__FILE__), "test_app/app/javascript", "packs").to_s
|
|
24
|
+
assert_equal @config.source_entry_path.to_s, source_entry_path
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def test_public_root_path
|
|
28
|
+
public_root_path = File.expand_path File.join(File.dirname(__FILE__), "test_app/public").to_s
|
|
29
|
+
assert_equal @config.public_path.to_s, public_root_path
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def test_public_output_path
|
|
33
|
+
public_output_path = File.expand_path File.join(File.dirname(__FILE__), "test_app/public/packs").to_s
|
|
34
|
+
assert_equal @config.public_output_path.to_s, public_output_path
|
|
35
|
+
|
|
36
|
+
@config = Webpacker::Configuration.new(
|
|
37
|
+
root_path: @config.root_path,
|
|
38
|
+
config_path: Pathname.new(File.expand_path("./test_app/config/webpacker_public_root.yml", __dir__)),
|
|
39
|
+
env: "production"
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
public_output_path = File.expand_path File.join(File.dirname(__FILE__), "public/packs").to_s
|
|
43
|
+
assert_equal @config.public_output_path.to_s, public_output_path
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def test_public_manifest_path
|
|
47
|
+
public_manifest_path = File.expand_path File.join(File.dirname(__FILE__), "test_app/public/packs", "manifest.json").to_s
|
|
48
|
+
assert_equal @config.public_manifest_path.to_s, public_manifest_path
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def test_cache_path
|
|
52
|
+
cache_path = File.expand_path File.join(File.dirname(__FILE__), "test_app/tmp/cache/webpacker").to_s
|
|
53
|
+
assert_equal @config.cache_path.to_s, cache_path
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def test_additional_paths
|
|
57
|
+
assert_equal @config.additional_paths, ["app/assets", "/etc/yarn", "app/elm"]
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def test_additional_paths_globbed
|
|
61
|
+
assert_equal @config.additional_paths_globbed, [
|
|
62
|
+
"app/assets/**/*{.mjs,.js,.sass,.scss,.css,.module.sass,.module.scss,.module.css,.png,.svg,.gif,.jpeg,.jpg,.elm}",
|
|
63
|
+
"/etc/yarn/**/*{.mjs,.js,.sass,.scss,.css,.module.sass,.module.scss,.module.css,.png,.svg,.gif,.jpeg,.jpg,.elm}",
|
|
64
|
+
"app/elm/**/*{.mjs,.js,.sass,.scss,.css,.module.sass,.module.scss,.module.css,.png,.svg,.gif,.jpeg,.jpg,.elm}"
|
|
65
|
+
]
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def test_extensions
|
|
69
|
+
config_path = File.expand_path File.join(File.dirname(__FILE__), "test_app/config/webpacker.yml").to_s
|
|
70
|
+
webpacker_yml = YAML.load_file(config_path)
|
|
71
|
+
assert_equal @config.extensions, webpacker_yml["default"]["extensions"]
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def test_cache_manifest?
|
|
75
|
+
assert @config.cache_manifest?
|
|
76
|
+
|
|
77
|
+
with_rails_env("development") do
|
|
78
|
+
refute Webpacker.config.cache_manifest?
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
with_rails_env("test") do
|
|
82
|
+
refute Webpacker.config.cache_manifest?
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def test_compile?
|
|
87
|
+
refute @config.compile?
|
|
88
|
+
|
|
89
|
+
with_rails_env("development") do
|
|
90
|
+
assert Webpacker.config.compile?
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
with_rails_env("test") do
|
|
94
|
+
assert Webpacker.config.compile?
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def test_extract_css?
|
|
99
|
+
assert @config.extract_css?
|
|
100
|
+
|
|
101
|
+
with_rails_env("development") do
|
|
102
|
+
refute Webpacker.config.extract_css?
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
with_rails_env("test") do
|
|
106
|
+
refute Webpacker.config.extract_css?
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
require "test_helper"
|
|
2
|
+
require "webpacker/dev_server_runner"
|
|
3
|
+
|
|
4
|
+
class DevServerRunnerTest < 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-dev-server", "--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-dev-server", "--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::DevServerRunner
|
|
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,47 @@
|
|
|
1
|
+
require "test_helper"
|
|
2
|
+
|
|
3
|
+
class DevServerTest < Webpacker::Test
|
|
4
|
+
def test_running?
|
|
5
|
+
refute Webpacker.dev_server.running?
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def test_host
|
|
9
|
+
with_rails_env("development") do
|
|
10
|
+
assert_equal Webpacker.dev_server.host, "localhost"
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def test_port
|
|
15
|
+
with_rails_env("development") do
|
|
16
|
+
assert_equal Webpacker.dev_server.port, 3035
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def test_https?
|
|
21
|
+
with_rails_env("development") do
|
|
22
|
+
assert_equal Webpacker.dev_server.https?, false
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def test_protocol
|
|
27
|
+
with_rails_env("development") do
|
|
28
|
+
assert_equal Webpacker.dev_server.protocol, "http"
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def test_host_with_port
|
|
33
|
+
with_rails_env("development") do
|
|
34
|
+
assert_equal Webpacker.dev_server.host_with_port, "localhost:3035"
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def test_pretty?
|
|
39
|
+
with_rails_env("development") do
|
|
40
|
+
refute Webpacker.dev_server.pretty?
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def test_default_env_prefix
|
|
45
|
+
assert_equal Webpacker::DevServer::DEFAULT_ENV_PREFIX, "WEBPACKER_DEV_SERVER"
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require "test_helper"
|
|
2
|
+
|
|
3
|
+
class EnvTest < Webpacker::Test
|
|
4
|
+
def test_current
|
|
5
|
+
assert_equal Webpacker.env, Rails.env
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def test_custom_without_config
|
|
9
|
+
with_rails_env("foo") do
|
|
10
|
+
assert_equal Webpacker.env, "production"
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def test_custom_with_config
|
|
15
|
+
with_rails_env("staging") do
|
|
16
|
+
assert_equal Webpacker.env, "staging"
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def test_default
|
|
21
|
+
assert_equal Webpacker::Env::DEFAULT, "production"
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
require "test_helper"
|
|
2
|
+
|
|
3
|
+
class HelperTest < ActionView::TestCase
|
|
4
|
+
tests Webpacker::Helper
|
|
5
|
+
|
|
6
|
+
attr_reader :request
|
|
7
|
+
|
|
8
|
+
def setup
|
|
9
|
+
@request = Class.new do
|
|
10
|
+
def send_early_hints(links) end
|
|
11
|
+
def base_url
|
|
12
|
+
"https://example.com"
|
|
13
|
+
end
|
|
14
|
+
end.new
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def test_asset_pack_path
|
|
18
|
+
assert_equal "/packs/bootstrap-300631c4f0e0f9c865bc.js", asset_pack_path("bootstrap.js")
|
|
19
|
+
assert_equal "/packs/bootstrap-c38deda30895059837cf.css", asset_pack_path("bootstrap.css")
|
|
20
|
+
|
|
21
|
+
Webpacker.config.stub :extract_css?, false do
|
|
22
|
+
assert_nil asset_pack_path("bootstrap.css")
|
|
23
|
+
assert_equal "/packs/application-k344a6d59eef8632c9d1.png", asset_pack_path("application.png")
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def test_asset_pack_url
|
|
28
|
+
assert_equal "https://example.com/packs/bootstrap-300631c4f0e0f9c865bc.js", asset_pack_url("bootstrap.js")
|
|
29
|
+
assert_equal "https://example.com/packs/bootstrap-c38deda30895059837cf.css", asset_pack_url("bootstrap.css")
|
|
30
|
+
|
|
31
|
+
Webpacker.config.stub :extract_css?, false do
|
|
32
|
+
assert_nil asset_pack_path("bootstrap.css")
|
|
33
|
+
assert_equal "https://example.com/packs/application-k344a6d59eef8632c9d1.png", asset_pack_url("application.png")
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def test_image_pack_tag
|
|
38
|
+
assert_equal \
|
|
39
|
+
"<img alt=\"Edit Entry\" src=\"/packs/application-k344a6d59eef8632c9d1.png\" width=\"16\" height=\"10\" />",
|
|
40
|
+
image_pack_tag("application.png", size: "16x10", alt: "Edit Entry")
|
|
41
|
+
assert_equal \
|
|
42
|
+
"<img alt=\"Edit Entry\" src=\"/packs/media/images/image-c38deda30895059837cf.jpg\" width=\"16\" height=\"10\" />",
|
|
43
|
+
image_pack_tag("image.jpg", size: "16x10", alt: "Edit Entry")
|
|
44
|
+
assert_equal \
|
|
45
|
+
"<img alt=\"Edit Entry\" src=\"/packs/media/images/image-c38deda30895059837cf.jpg\" width=\"16\" height=\"10\" />",
|
|
46
|
+
image_pack_tag("media/images/image.jpg", size: "16x10", alt: "Edit Entry")
|
|
47
|
+
assert_equal \
|
|
48
|
+
"<img alt=\"Edit Entry\" src=\"/packs/media/images/nested/image-c38deda30895059837cf.jpg\" width=\"16\" height=\"10\" />",
|
|
49
|
+
image_pack_tag("nested/image.jpg", size: "16x10", alt: "Edit Entry")
|
|
50
|
+
assert_equal \
|
|
51
|
+
"<img alt=\"Edit Entry\" src=\"/packs/media/images/nested/image-c38deda30895059837cf.jpg\" width=\"16\" height=\"10\" />",
|
|
52
|
+
image_pack_tag("media/images/nested/image.jpg", size: "16x10", alt: "Edit Entry")
|
|
53
|
+
assert_equal \
|
|
54
|
+
"<img srcset=\"/packs/media/images/image-2x-7cca48e6cae66ec07b8e.jpg 2x\" src=\"/packs/media/images/image-c38deda30895059837cf.jpg\" />",
|
|
55
|
+
image_pack_tag("media/images/image.jpg", srcset: { "media/images/image-2x.jpg" => "2x" })
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def test_favicon_pack_tag
|
|
59
|
+
assert_equal \
|
|
60
|
+
"<link rel=\"apple-touch-icon\" type=\"image/png\" href=\"/packs/application-k344a6d59eef8632c9d1.png\" />",
|
|
61
|
+
favicon_pack_tag("application.png", rel: "apple-touch-icon", type: "image/png")
|
|
62
|
+
assert_equal \
|
|
63
|
+
"<link rel=\"apple-touch-icon\" type=\"image/png\" href=\"/packs/media/images/mb-icon-c38deda30895059837cf.png\" />",
|
|
64
|
+
favicon_pack_tag("mb-icon.png", rel: "apple-touch-icon", type: "image/png")
|
|
65
|
+
assert_equal \
|
|
66
|
+
"<link rel=\"apple-touch-icon\" type=\"image/png\" href=\"/packs/media/images/mb-icon-c38deda30895059837cf.png\" />",
|
|
67
|
+
favicon_pack_tag("media/images/mb-icon.png", rel: "apple-touch-icon", type: "image/png")
|
|
68
|
+
assert_equal \
|
|
69
|
+
"<link rel=\"apple-touch-icon\" type=\"image/png\" href=\"/packs/media/images/nested/mb-icon-c38deda30895059837cf.png\" />",
|
|
70
|
+
favicon_pack_tag("nested/mb-icon.png", rel: "apple-touch-icon", type: "image/png")
|
|
71
|
+
assert_equal \
|
|
72
|
+
"<link rel=\"apple-touch-icon\" type=\"image/png\" href=\"/packs/media/images/nested/mb-icon-c38deda30895059837cf.png\" />",
|
|
73
|
+
favicon_pack_tag("media/images/nested/mb-icon.png", rel: "apple-touch-icon", type: "image/png")
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def test_javascript_pack_tag
|
|
77
|
+
assert_equal \
|
|
78
|
+
%(<script src="/packs/bootstrap-300631c4f0e0f9c865bc.js"></script>),
|
|
79
|
+
javascript_pack_tag("bootstrap.js")
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def test_javascript_pack_tag_symbol
|
|
83
|
+
assert_equal \
|
|
84
|
+
%(<script src="/packs/bootstrap-300631c4f0e0f9c865bc.js"></script>),
|
|
85
|
+
javascript_pack_tag(:bootstrap)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def test_javascript_pack_tag_splat
|
|
89
|
+
assert_equal \
|
|
90
|
+
%(<script src="/packs/bootstrap-300631c4f0e0f9c865bc.js" defer="defer"></script>\n) +
|
|
91
|
+
%(<script src="/packs/application-k344a6d59eef8632c9d1.js" defer="defer"></script>),
|
|
92
|
+
javascript_pack_tag("bootstrap.js", "application.js", defer: true)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def test_javascript_pack_tag_split_chunks
|
|
96
|
+
assert_equal \
|
|
97
|
+
%(<script src="/packs/vendors~application~bootstrap-c20632e7baf2c81200d3.chunk.js"></script>\n) +
|
|
98
|
+
%(<script src="/packs/vendors~application-e55f2aae30c07fb6d82a.chunk.js"></script>\n) +
|
|
99
|
+
%(<script src="/packs/application-k344a6d59eef8632c9d1.js"></script>),
|
|
100
|
+
javascript_packs_with_chunks_tag("application")
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def test_preload_pack_asset
|
|
104
|
+
if self.class.method_defined?(:preload_link_tag)
|
|
105
|
+
assert_equal \
|
|
106
|
+
%(<link rel="preload" href="/packs/fonts/fa-regular-400-944fb546bd7018b07190a32244f67dc9.woff2" as="font" type="font/woff2" crossorigin="anonymous">),
|
|
107
|
+
preload_pack_asset("fonts/fa-regular-400.woff2")
|
|
108
|
+
else
|
|
109
|
+
error = assert_raises do
|
|
110
|
+
preload_pack_asset("fonts/fa-regular-400.woff2")
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
assert_equal \
|
|
114
|
+
"You need Rails >= 5.2 to use this tag.",
|
|
115
|
+
error.message
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def test_stylesheet_pack_tag_split_chunks
|
|
120
|
+
assert_equal stylesheet_packs_with_chunks_tag("application", "hello_stimulus").in?([
|
|
121
|
+
%(<link rel="stylesheet" href="/packs/1-c20632e7baf2c81200d3.chunk.css" media="screen" />\n) +
|
|
122
|
+
%(<link rel="stylesheet" href="/packs/application-k344a6d59eef8632c9d1.chunk.css" media="screen" />\n) +
|
|
123
|
+
%(<link rel="stylesheet" href="/packs/hello_stimulus-k344a6d59eef8632c9d1.chunk.css" media="screen" />),
|
|
124
|
+
|
|
125
|
+
%(<link rel="stylesheet" media="screen" href="/packs/1-c20632e7baf2c81200d3.chunk.css" />\n) +
|
|
126
|
+
%(<link rel="stylesheet" media="screen" href="/packs/application-k344a6d59eef8632c9d1.chunk.css" />\n) +
|
|
127
|
+
%(<link rel="stylesheet" media="screen" href="/packs/hello_stimulus-k344a6d59eef8632c9d1.chunk.css" />),
|
|
128
|
+
]),
|
|
129
|
+
true
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def test_stylesheet_pack_tag
|
|
133
|
+
assert_equal stylesheet_pack_tag("bootstrap.css").in?([
|
|
134
|
+
%(<link rel="stylesheet" href="/packs/bootstrap-c38deda30895059837cf.css" media="screen" />),
|
|
135
|
+
|
|
136
|
+
%(<link rel="stylesheet" media="screen" href="/packs/bootstrap-c38deda30895059837cf.css" />),
|
|
137
|
+
]), true
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def test_stylesheet_pack_tag_symbol
|
|
141
|
+
assert_equal stylesheet_pack_tag(:bootstrap).in?([
|
|
142
|
+
%(<link rel="stylesheet" href="/packs/bootstrap-c38deda30895059837cf.css" media="screen" />),
|
|
143
|
+
|
|
144
|
+
%(<link rel="stylesheet" media="screen" href="/packs/bootstrap-c38deda30895059837cf.css" />),
|
|
145
|
+
]), true
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def test_stylesheet_pack_tag_splat
|
|
149
|
+
assert_equal stylesheet_pack_tag("bootstrap.css", "application.css", media: "all").in?([
|
|
150
|
+
%(<link rel="stylesheet" href="/packs/bootstrap-c38deda30895059837cf.css" media="all" />\n) +
|
|
151
|
+
%(<link rel="stylesheet" href="/packs/application-dd6b1cd38bfa093df600.css" media="all" />),
|
|
152
|
+
|
|
153
|
+
%(<link rel="stylesheet" media="all" href="/packs/bootstrap-c38deda30895059837cf.css" />\n) +
|
|
154
|
+
%(<link rel="stylesheet" media="all" href="/packs/application-dd6b1cd38bfa093df600.css" />),
|
|
155
|
+
]), true
|
|
156
|
+
end
|
|
157
|
+
end
|