Fix m.version to not depend on package.json (#2464)
* Fix `m.version` to not depend on `package.json` Created an accidental breaking change. * Update changelog * Fix a failing test
This commit is contained in:
parent
1f4b2cf49a
commit
1434ba313f
7 changed files with 13 additions and 15 deletions
|
|
@ -24,10 +24,6 @@ module.exports = function (input) {
|
|||
var include = /(?:((?:var|let|const|,|)[\t ]*)([\w_$\.\[\]"'`]+)(\s*=\s*))?require\(([^\)]+)\)(\s*[`\.\(\[])?/gm
|
||||
var uuid = 0
|
||||
var process = function(filepath, data) {
|
||||
// HACK: inline Mithril's `package.json` keys without reading the whole file.
|
||||
data = data.replace(/require\((['"])\.\/package\.json\1\)\.(\w+)/, function (match, quote, key) {
|
||||
return JSON.stringify(pkg[key])
|
||||
})
|
||||
data.replace(declaration, function(match, binding) {bindings[binding] = 0})
|
||||
|
||||
return data.replace(include, function(match, def, variable, eq, dep, rest) {
|
||||
|
|
|
|||
|
|
@ -320,11 +320,4 @@ o.spec("bundler", function() {
|
|||
remove("a.js")
|
||||
remove("b.js")
|
||||
})
|
||||
o("reads package.json keys", function() {
|
||||
write("a.js", 'var b = require("./package.json").version')
|
||||
|
||||
o(bundle(ns + "a.js")).equals(";(function() {\nvar b = " + JSON.stringify(pkg.version) + "\n}());")
|
||||
|
||||
remove("a.js")
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue