nanoc-webpack.rb 0.10.2 → 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nanoc/webpack/filter.rb +7 -11
- data/lib/nanoc/webpack/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c939a1fe4e2fb2f767e80b0fdac38ff132c5beff92aeb46d3019d2b4e5ec12da
|
4
|
+
data.tar.gz: 20b1ef0e1a025de9088dd99bc8047346b51d2f4fcf09fa203b5379c858ca28d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3a31c40abbe1052cd4bdc36ecc11cbefc784b7f97c9733e959837dbe6f88d435b106efccd7337c31ebfa6db06c49e97e23ffc2b6129440081f1ae15f9e581bb
|
7
|
+
data.tar.gz: ce8807fca6f33918d61af7a5df0c1dc0065b51121bf1913d7b60a9be7811b46e4cbf4c6c8267be0ae1d638ec164340c906b22c8303d8d8ecfeaf3247e0ae7e86
|
data/lib/nanoc/webpack/filter.rb
CHANGED
@@ -35,7 +35,7 @@ module Nanoc::Webpack
|
|
35
35
|
# @return [void]
|
36
36
|
def run(content, options = {})
|
37
37
|
options = Ryo.from(options)
|
38
|
-
|
38
|
+
file = temporary_file(content)
|
39
39
|
depend_on dependable(paths: options.depend_on, reject: options.reject)
|
40
40
|
.map { items[_1] }
|
41
41
|
argv = [*(options.argv || []), *default_argv]
|
@@ -44,11 +44,11 @@ module Nanoc::Webpack
|
|
44
44
|
["./node_modules/webpack/bin/webpack.js",
|
45
45
|
*argv,
|
46
46
|
"--entry", File.join(Dir.getwd, item.attributes[:content_filename]),
|
47
|
-
"--output-path", File.dirname(path),
|
48
|
-
"--output-filename", File.basename(path)]
|
49
|
-
File.read(path)
|
47
|
+
"--output-path", File.dirname(file.path),
|
48
|
+
"--output-filename", File.basename(file.path)]
|
49
|
+
File.read(file.path)
|
50
50
|
ensure
|
51
|
-
|
51
|
+
file ? file.tap(&:unlink).close : nil
|
52
52
|
end
|
53
53
|
|
54
54
|
private
|
@@ -58,20 +58,16 @@ module Nanoc::Webpack
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def temporary_file(content)
|
61
|
-
|
61
|
+
tmpdir = File.join(Dir.getwd, "tmp", "webpack")
|
62
62
|
name = item.identifier.to_s
|
63
63
|
file = Tempfile.new(
|
64
64
|
[ File.basename(name), File.extname(name).sub(/\A\.(ts|tsx|jsx)\z/, '.js') ],
|
65
|
-
tmpdir
|
65
|
+
mkdir_p(tmpdir).last
|
66
66
|
)
|
67
67
|
file.write(content)
|
68
68
|
file.tap(&:flush)
|
69
69
|
end
|
70
70
|
|
71
|
-
def tmpdir
|
72
|
-
File.join(Dir.getwd, "tmp", "webpack")
|
73
|
-
end
|
74
|
-
|
75
71
|
def scan(argv)
|
76
72
|
options = argv.filter_map { _1.start_with?("-") ? _1 : nil }
|
77
73
|
builtins = %w[--entry --output-path --output-filename]
|