modif comtabilite
This commit is contained in:
-2
@@ -1,2 +0,0 @@
|
||||
.*
|
||||
!.jshintrc
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Simon Lydell
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "source-map-url",
|
||||
"version": "0.3.0",
|
||||
"version": "0.4.0",
|
||||
"author": "Simon Lydell",
|
||||
"license": "MIT",
|
||||
"description": "Tools for working with sourceMappingURL comments.",
|
||||
|
||||
+10
@@ -1,3 +1,13 @@
|
||||
### Version 0.4.0 (2015-11-12) ###
|
||||
|
||||
- Changed: sourceMappingURL comments used to be matched only when placed at
|
||||
the end of the script. However, since several commonly used JavaScript
|
||||
libraries do not follow this convention and all popular web browsers accept
|
||||
non-trailing comments, this has been revised.
|
||||
|
||||
So now non-trailing SourceMappingURL comments are matched as well.
|
||||
|
||||
|
||||
### Version 0.3.0 (2014-08-16) ###
|
||||
|
||||
- Changed: sourceMappingURL comments used to be matched only if they appeared
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "source-map-url",
|
||||
"version": "0.3.0",
|
||||
"version": "0.4.0",
|
||||
"author": "Simon Lydell",
|
||||
"license": "MIT",
|
||||
"description": "Tools for working with sourceMappingURL comments.",
|
||||
@@ -15,4 +15,4 @@
|
||||
"scripts": [
|
||||
"source-map-url.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
+14
-17
@@ -1,38 +1,35 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"source-map-url@0.3.0",
|
||||
"/mnt/data/Sites/anissabensalah.net/user/themes/anissabensalah"
|
||||
]
|
||||
],
|
||||
"_from": "source-map-url@0.3.0",
|
||||
"_id": "source-map-url@0.3.0",
|
||||
"_from": "source-map-url@^0.4.0",
|
||||
"_id": "source-map-url@0.4.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-fsrxO1e80J2opAxdJp2zN5nUqvk=",
|
||||
"_integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=",
|
||||
"_location": "/source-map-url",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "source-map-url@0.3.0",
|
||||
"raw": "source-map-url@^0.4.0",
|
||||
"name": "source-map-url",
|
||||
"escapedName": "source-map-url",
|
||||
"rawSpec": "0.3.0",
|
||||
"rawSpec": "^0.4.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.3.0"
|
||||
"fetchSpec": "^0.4.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/source-map-resolve"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.3.0.tgz",
|
||||
"_spec": "0.3.0",
|
||||
"_where": "/mnt/data/Sites/anissabensalah.net/user/themes/anissabensalah",
|
||||
"_resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz",
|
||||
"_shasum": "3e935d7ddd73631b97659956d55128e87b5084a3",
|
||||
"_spec": "source-map-url@^0.4.0",
|
||||
"_where": "/home/kevin/Documents/Sites/anissabensalah.net/user/themes/anissabensalah/node_modules/source-map-resolve",
|
||||
"author": {
|
||||
"name": "Simon Lydell"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/lydell/source-map-url/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Tools for working with sourceMappingURL comments.",
|
||||
"devDependencies": {
|
||||
"expect.js": "~0.3.1",
|
||||
@@ -72,5 +69,5 @@
|
||||
"android-browser/4"
|
||||
]
|
||||
},
|
||||
"version": "0.3.0"
|
||||
"version": "0.4.0"
|
||||
}
|
||||
|
||||
+2
-2
@@ -74,8 +74,8 @@ such comment. Returns the updated `code`.
|
||||
Inserts `string` before the sourceMappingURL comment in `code`. Appends
|
||||
`string` to `code` if there is no such comment.
|
||||
|
||||
Lets you append something to a file without worrying about breaking the
|
||||
sourceMappingURL comment (which needs to be at the end of the file).
|
||||
Lets you append something to a file without worrying about burying the
|
||||
sourceMappingURL comment (by keeping it at the end of the file).
|
||||
|
||||
### `sourceMappingURL.regex` ###
|
||||
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ void (function(root, factory) {
|
||||
"|" +
|
||||
"//(?:" + innerRegex.source + ")" +
|
||||
")" +
|
||||
"\\s*$"
|
||||
"\\s*"
|
||||
)
|
||||
|
||||
return {
|
||||
|
||||
+106
-25
@@ -29,6 +29,34 @@ var comments = {
|
||||
|
||||
}
|
||||
|
||||
var nonTrailingComments = {
|
||||
|
||||
jsLeading: {
|
||||
contents: [
|
||||
"//# sourceMappingURL=foo.js.map",
|
||||
"(function(){})"
|
||||
],
|
||||
solution: [
|
||||
"(function(){})"
|
||||
]
|
||||
},
|
||||
|
||||
mixEmbedded: {
|
||||
contents: [
|
||||
"/*! Library Name v1.0.0",
|
||||
"//# sourceMappingURL=foo.js.map",
|
||||
"*/",
|
||||
"(function(){})"
|
||||
],
|
||||
solution: [
|
||||
"/*! Library Name v1.0.0",
|
||||
"*/",
|
||||
"(function(){})"
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function forEachComment(fn) {
|
||||
forOf(comments, function(name, comment) {
|
||||
var description = "the '" + name + "' syntax with "
|
||||
@@ -37,6 +65,23 @@ function forEachComment(fn) {
|
||||
})
|
||||
}
|
||||
|
||||
function forEachNonTrailingComment(fn) {
|
||||
forOf(nonTrailingComments, function(name, comment) {
|
||||
|
||||
var description = "the '" + name + "' syntax with "
|
||||
|
||||
fn({
|
||||
contents: comment.contents.join("\n"),
|
||||
solution: comment.solution.join("\n")
|
||||
}, description + "regular newlines")
|
||||
|
||||
fn({
|
||||
contents: comment.contents.join("\r\n"),
|
||||
solution: comment.solution.join("\r\n")
|
||||
}, description + "Windows newlines")
|
||||
})
|
||||
}
|
||||
|
||||
function forOf(obj, fn) {
|
||||
for (var key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
@@ -65,6 +110,21 @@ describe("sourceMappingURL", function() {
|
||||
|
||||
})
|
||||
|
||||
forEachNonTrailingComment(function(comment, description) {
|
||||
|
||||
it("gets the url from " + description, function() {
|
||||
expect(sourceMappingURL.getFrom("code\n" + comment.contents))
|
||||
.to.equal("foo.js.map")
|
||||
|
||||
expect(sourceMappingURL.getFrom("code" + comment.contents))
|
||||
.to.equal("foo.js.map")
|
||||
|
||||
expect(sourceMappingURL.getFrom(comment.contents))
|
||||
.to.equal("foo.js.map")
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
|
||||
it("returns null if no comment", function() {
|
||||
expect(sourceMappingURL.getFrom("code"))
|
||||
@@ -104,6 +164,21 @@ describe("sourceMappingURL", function() {
|
||||
|
||||
})
|
||||
|
||||
forEachNonTrailingComment(function(comment, description) {
|
||||
|
||||
it("returns true for " + description, function() {
|
||||
expect(sourceMappingURL.existsIn("code\n" + comment.contents))
|
||||
.to.equal(true)
|
||||
|
||||
expect(sourceMappingURL.existsIn("code" + comment.contents))
|
||||
.to.equal(true)
|
||||
|
||||
expect(sourceMappingURL.existsIn(comment.contents))
|
||||
.to.equal(true)
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
|
||||
it("returns false if no comment", function() {
|
||||
expect(sourceMappingURL.existsIn("code"))
|
||||
@@ -137,6 +212,21 @@ describe("sourceMappingURL", function() {
|
||||
|
||||
})
|
||||
|
||||
forEachNonTrailingComment(function(comment, description) {
|
||||
|
||||
it("removes the comment for " + description, function() {
|
||||
expect(sourceMappingURL.removeFrom("code\n" + comment.contents))
|
||||
.to.equal("code\n" + comment.solution)
|
||||
|
||||
expect(sourceMappingURL.removeFrom("code" + comment.contents))
|
||||
.to.equal("code" + comment.solution)
|
||||
|
||||
expect(sourceMappingURL.removeFrom(comment.contents))
|
||||
.to.equal(comment.solution)
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
|
||||
it("does nothing if no comment", function() {
|
||||
expect(sourceMappingURL.removeFrom("code\n"))
|
||||
@@ -171,6 +261,22 @@ describe("sourceMappingURL", function() {
|
||||
})
|
||||
|
||||
|
||||
it("inserts a string before an embedded comment", function() {
|
||||
expect(sourceMappingURL.insertBefore("/*! Library Name v1.0.0\n" +
|
||||
"//# sourceMappingURL=foo.js.map\n*/\n(function(){})", "code\n"))
|
||||
.to.equal("/*! Library Name v1.0.0\ncode\n" +
|
||||
"//# sourceMappingURL=foo.js.map\n*/\n(function(){})")
|
||||
})
|
||||
|
||||
|
||||
it("inserts a string before a leading comment", function() {
|
||||
expect(sourceMappingURL.insertBefore("//# sourceMappingURL=foo.js.map\n" +
|
||||
"(function(){})", "code\n"))
|
||||
.to.equal("code\n//# sourceMappingURL=foo.js.map\n" +
|
||||
"(function(){})")
|
||||
})
|
||||
|
||||
|
||||
it("appends if no comment", function() {
|
||||
expect(sourceMappingURL.insertBefore("code", "\nmore code"))
|
||||
.to.equal("code\nmore code")
|
||||
@@ -220,20 +326,6 @@ describe("sourceMappingURL", function() {
|
||||
match(comment + "\n\n\t\n \t ")
|
||||
})
|
||||
|
||||
|
||||
it("only matches " + description + " at the end of files", function() {
|
||||
noMatch("code\n" + comment + " code")
|
||||
noMatch("code" + comment + " code")
|
||||
noMatch("code\n" + comment + "\ncode")
|
||||
noMatch("code" + comment + "\ncode")
|
||||
noMatch("code\n" + comment + "\n// Generated by foobar")
|
||||
noMatch("code" + comment + "\n// Generated by foobar")
|
||||
noMatch("alert\n('\\" + comment + "')")
|
||||
noMatch("alert('\\" + comment + "')")
|
||||
noMatch('alert\n("\\' + comment + '")')
|
||||
noMatch('alert("\\' + comment + '")')
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
|
||||
@@ -242,17 +334,6 @@ describe("sourceMappingURL", function() {
|
||||
"/* # sourceMappingURL=foo */"
|
||||
)
|
||||
|
||||
noMatch(
|
||||
"/*\n" +
|
||||
" //# sourceMappingURL=foo\n" +
|
||||
"*/"
|
||||
)
|
||||
|
||||
noMatch(
|
||||
"/*//# sourceMappingURL=foo\n" +
|
||||
"*/"
|
||||
)
|
||||
|
||||
noMatch(
|
||||
"// # sourceMappingURL=foo"
|
||||
)
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
name: "source-map-url",
|
||||
version: "0.3.0",
|
||||
version: "0.4.0",
|
||||
author: "Simon Lydell",
|
||||
license: "MIT",
|
||||
description: "Tools for working with sourceMappingURL comments.",
|
||||
|
||||
Reference in New Issue
Block a user