New Upstream Snapshot - node-to-absolute-glob

Ready changes

Summary

Merged new upstream version: 3.0.0 (was: 2.0.2).

Diff

diff --git a/.editorconfig b/.editorconfig
deleted file mode 100644
index 818e072..0000000
--- a/.editorconfig
+++ /dev/null
@@ -1,13 +0,0 @@
-root = true
-
-[*]
-indent_style = space
-end_of_line = lf
-charset = utf-8
-indent_size = 2
-trim_trailing_whitespace = true
-insert_final_newline = true
-
-[{**/{actual,fixtures,expected,templates}/**,*.md}]
-trim_trailing_whitespace = false
-insert_final_newline = false
\ No newline at end of file
diff --git a/.eslintrc.json b/.eslintrc.json
deleted file mode 100644
index 948dbdb..0000000
--- a/.eslintrc.json
+++ /dev/null
@@ -1,122 +0,0 @@
-{
-  "ecmaFeatures": {
-    "modules": true,
-    "experimentalObjectRestSpread": true
-  },
-
-  "env": {
-    "browser": false,
-    "es6": true,
-    "node": true,
-    "mocha": true
-  },
-
-  "globals": {
-    "document": false,
-    "navigator": false,
-    "window": false
-  },
-
-  "rules": {
-    "accessor-pairs": 2,
-    "arrow-spacing": [2, { "before": true, "after": true }],
-    "block-spacing": [2, "always"],
-    "brace-style": [2, "1tbs", { "allowSingleLine": true }],
-    "comma-dangle": [2, "never"],
-    "comma-spacing": [2, { "before": false, "after": true }],
-    "comma-style": [2, "last"],
-    "constructor-super": 2,
-    "curly": [2, "multi-line"],
-    "dot-location": [2, "property"],
-    "eol-last": 2,
-    "eqeqeq": [2, "allow-null"],
-    "generator-star-spacing": [2, { "before": true, "after": true }],
-    "handle-callback-err": [2, "^(err|error)$" ],
-    "indent": [2, 2, { "SwitchCase": 1 }],
-    "key-spacing": [2, { "beforeColon": false, "afterColon": true }],
-    "keyword-spacing": [2, { "before": true, "after": true }],
-    "new-cap": [2, { "newIsCap": true, "capIsNew": false }],
-    "new-parens": 2,
-    "no-array-constructor": 2,
-    "no-caller": 2,
-    "no-class-assign": 2,
-    "no-cond-assign": 2,
-    "no-const-assign": 2,
-    "no-control-regex": 2,
-    "no-debugger": 2,
-    "no-delete-var": 2,
-    "no-dupe-args": 2,
-    "no-dupe-class-members": 2,
-    "no-dupe-keys": 2,
-    "no-duplicate-case": 2,
-    "no-empty-character-class": 2,
-    "no-eval": 2,
-    "no-ex-assign": 2,
-    "no-extend-native": 2,
-    "no-extra-bind": 2,
-    "no-extra-boolean-cast": 2,
-    "no-extra-parens": [2, "functions"],
-    "no-fallthrough": 2,
-    "no-floating-decimal": 2,
-    "no-func-assign": 2,
-    "no-implied-eval": 2,
-    "no-inner-declarations": [2, "functions"],
-    "no-invalid-regexp": 2,
-    "no-irregular-whitespace": 2,
-    "no-iterator": 2,
-    "no-label-var": 2,
-    "no-labels": 2,
-    "no-lone-blocks": 2,
-    "no-mixed-spaces-and-tabs": 2,
-    "no-multi-spaces": 2,
-    "no-multi-str": 2,
-    "no-multiple-empty-lines": [2, { "max": 1 }],
-    "no-native-reassign": 0,
-    "no-negated-in-lhs": 2,
-    "no-new": 2,
-    "no-new-func": 2,
-    "no-new-object": 2,
-    "no-new-require": 2,
-    "no-new-wrappers": 2,
-    "no-obj-calls": 2,
-    "no-octal": 2,
-    "no-octal-escape": 2,
-    "no-proto": 0,
-    "no-redeclare": 2,
-    "no-regex-spaces": 2,
-    "no-return-assign": 2,
-    "no-self-compare": 2,
-    "no-sequences": 2,
-    "no-shadow-restricted-names": 2,
-    "no-spaced-func": 2,
-    "no-sparse-arrays": 2,
-    "no-this-before-super": 2,
-    "no-throw-literal": 2,
-    "no-trailing-spaces": 0,
-    "no-undef": 2,
-    "no-undef-init": 2,
-    "no-unexpected-multiline": 2,
-    "no-unneeded-ternary": [2, { "defaultAssignment": false }],
-    "no-unreachable": 2,
-    "no-unused-vars": [2, { "vars": "all", "args": "none" }],
-    "no-useless-call": 0,
-    "no-with": 2,
-    "one-var": [0, { "initialized": "never" }],
-    "operator-linebreak": [0, "after", { "overrides": { "?": "before", ":": "before" } }],
-    "padded-blocks": [0, "never"],
-    "quotes": [2, "single", "avoid-escape"],
-    "radix": 2,
-    "semi": [2, "always"],
-    "semi-spacing": [2, { "before": false, "after": true }],
-    "space-before-blocks": [2, "always"],
-    "space-before-function-paren": [2, "never"],
-    "space-in-parens": [2, "never"],
-    "space-infix-ops": 2,
-    "space-unary-ops": [2, { "words": true, "nonwords": false }],
-    "spaced-comment": [0, "always", { "markers": ["global", "globals", "eslint", "eslint-disable", "*package", "!", ","] }],
-    "use-isnan": 2,
-    "valid-typeof": 2,
-    "wrap-iife": [2, "any"],
-    "yoda": [2, "never"]
-  }
-}
diff --git a/.verb.md b/.verb.md
deleted file mode 100644
index 75a2ad4..0000000
--- a/.verb.md
+++ /dev/null
@@ -1,88 +0,0 @@
-## Usage
-
-```js
-var toAbsGlob = require('{%= name %}');
-toAbsGlob('a/*.js');
-//=> '/dev/foo/a/*.js'
-```
-
-## Examples
-
-Given the current project folder (cwd) is `/dev/foo/`:
-
-**makes a path absolute**
-
-```js
-toAbsGlob('a');
-//=> '/dev/foo/a'
-```
-
-**makes a glob absolute**
-
-```js
-toAbsGlob('a/*.js');
-//=> '/dev/foo/a/*.js'
-```
-
-**retains trailing slashes**
-
-```js
-toAbsGlob('a/*/');
-//=> '/dev/foo/a/*/'
-```
-
-**retains trailing slashes with cwd**
-
-```js
-toAbsGlob('./fixtures/whatsgoingon/*/', {cwd: __dirname});
-//=> '/dev/foo/'
-```
-
-**makes a negative glob absolute**
-
-```js
-toAbsGlob('!a/*.js');
-//=> '!/dev/foo/a/*.js'
-```
-
-**from a cwd**
-
-```js
-toAbsGlob('a/*.js', {cwd: 'foo'});
-//=> '/dev/foo/foo/a/*.js'
-```
-
-**makes a negative glob absolute from a cwd**
-
-```js
-toAbsGlob('!a/*.js', {cwd: 'foo'});
-//=> '!/dev/foo/foo/a/*.js'
-```
-
-**from a root path**
-
-```js
-toAbsGlob('/a/*.js', {root: 'baz'});
-//=> '/dev/foo/baz/a/*.js'
-```
-
-**from a root slash**
-
-```js
-toAbsGlob('/a/*.js', {root: '/'});
-//=> '/dev/foo/a/*.js'
-```
-
-**from a negative root path**
-
-```js
-toAbsGlob('!/a/*.js', {root: 'baz'});
-//=> '!/dev/foo/baz/a/*.js'
-```
-
-**from a negative root slash**
-
-```js
-toAbsGlob('!/a/*.js', {root: '/'});
-//=> '!/dev/foo/a/*.js'
-```
diff --git a/LICENSE b/LICENSE
index 6525171..9489127 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
 The MIT License (MIT)
 
-Copyright (c) 2015-2016, Jon Schlinkert
+Copyright (c) Jon Schlinkert
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
diff --git a/appveyor.yml b/appveyor.yml
deleted file mode 100644
index 59031e1..0000000
--- a/appveyor.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-# Test against this version of Node.js
-environment:
-  matrix:
-    # node.js
-    - nodejs_version: "6.0"
-    - nodejs_version: "5.0"
-    - nodejs_version: "4.0"
-    - nodejs_version: "0.12"
-    - nodejs_version: "0.10"
-
-# Install scripts. (runs after repo cloning)
-install:
-  # Get the latest stable version of Node.js or io.js
-  - ps: Install-Product node $env:nodejs_version
-  # install modules
-  - npm install
-
-# Post-install test scripts.
-test_script:
-  # Output useful info for debugging.
-  - node --version
-  - npm --version
-  # run tests
-  - npm test
-
-# Don't actually build.
-build: off
diff --git a/debian/changelog b/debian/changelog
index 9e7f0d4..297eb62 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+node-to-absolute-glob (3.0.0-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Wed, 08 Feb 2023 12:20:08 -0000
+
 node-to-absolute-glob (2.0.2-3) unstable; urgency=medium
 
   [ Debian Janitor ]
diff --git a/debian/patches/use-pathisAbsolute.patch b/debian/patches/use-pathisAbsolute.patch
index 1268cf7..1cdb76c 100644
--- a/debian/patches/use-pathisAbsolute.patch
+++ b/debian/patches/use-pathisAbsolute.patch
@@ -2,8 +2,10 @@ Description: Use pathisAbsolute
  Use path.isabsolute instead of is-absolute
 Forwarded: not-needed
 
---- a/index.js
-+++ b/index.js
+Index: node-to-absolute-glob.git/index.js
+===================================================================
+--- node-to-absolute-glob.git.orig/index.js
++++ node-to-absolute-glob.git/index.js
 @@ -2,7 +2,7 @@
  
  var path = require('path');
diff --git a/examples.js b/examples.js
deleted file mode 100644
index bfbe3a0..0000000
--- a/examples.js
+++ /dev/null
@@ -1,15 +0,0 @@
-
-var toAbsGlob = require('./');
-console.log(toAbsGlob('a'))
-console.log(toAbsGlob('a/*.js'))
-console.log(toAbsGlob('a/*/'))
-console.log(toAbsGlob('./fixtures/whatsgoingon/*/', {cwd: __dirname}))
-console.log(toAbsGlob('!a/*.js'))
-console.log(toAbsGlob('a/*.js', {cwd: 'foo'}))
-console.log(toAbsGlob('!a/*.js', {cwd: 'foo'}))
-console.log(toAbsGlob('/a/*.js', {root: 'baz'}))
-console.log(toAbsGlob('/a/*.js', {root: '/'}))
-console.log(toAbsGlob('!/a/*.js', {root: 'baz'}))
-console.log(toAbsGlob('!/a/*.js', {root: '/'}))
-console.log(toAbsGlob('/\\!/a/*.js', {root: '/'}))
-console.log(toAbsGlob('/\\!\\a/*.js', {root: '/'}))
diff --git a/index.js b/index.js
index 268fc47..a09536a 100644
--- a/index.js
+++ b/index.js
@@ -9,16 +9,20 @@ module.exports = function(glob, options) {
   var opts = options || {};
 
   // ensure cwd is absolute
-  var cwd = path.resolve(opts.cwd ? opts.cwd : process.cwd());
+  var cwd = unescape(opts.cwd ? opts.cwd : process.cwd());
+  cwd = path.resolve(cwd);
   cwd = unixify(cwd);
+  cwd = escape(cwd);
 
   var rootDir = opts.root;
   // if `options.root` is defined, ensure it's absolute
   if (rootDir) {
+    rootDir = unescape(rootDir);
     rootDir = unixify(rootDir);
     if (process.platform === 'win32' || !isAbsolute(rootDir)) {
       rootDir = unixify(path.resolve(rootDir));
     }
+    rootDir = escape(rootDir);
   }
 
   // trim starting ./ from glob patterns
@@ -54,6 +58,16 @@ module.exports = function(glob, options) {
   return ing.negated ? '!' + glob : glob;
 };
 
+function escape(path) {
+  return path.replace(/([({[\]})*?!])/g, '\\$1');
+}
+
+function unescape(path) {
+  return path.replace(/\\([({[\]})*?!])/g, '$1');
+}
+
+// Before calling unixify, we remove the escapes and then
+// we add them back afterwards to avoid double-escaping
 function unixify(filepath) {
   return filepath.replace(/\\/g, '/');
 }
diff --git a/package.json b/package.json
index 762ab5c..dc5db47 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
 {
   "name": "to-absolute-glob",
   "description": "Make a glob pattern absolute, ensuring that negative globs and patterns with trailing slashes are correctly handled.",
-  "version": "2.0.2",
+  "version": "3.0.0",
   "homepage": "https://github.com/jonschlinkert/to-absolute-glob",
   "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
   "contributors": [
@@ -30,8 +30,8 @@
     "is-negated-glob": "^1.0.0"
   },
   "devDependencies": {
-    "gulp-format-md": "^0.1.11",
-    "mocha": "^3.0.2"
+    "gulp-format-md": "^2.0.0",
+    "mocha": "^10.1.0"
   },
   "keywords": [
     "absolute",
diff --git a/readme.md b/readme.md
index d93fbed..3941bc6 100644
--- a/readme.md
+++ b/readme.md
@@ -7,13 +7,20 @@
 Install with [npm](https://www.npmjs.com/):
 
 ```sh
-$ npm install --save to-absolute-glob
+npm install to-absolute-glob
+```
+
+
+Or install with [yarn](https://yarnpkg.com/):
+
+```sh
+yarn add to-absolute-glob
 ```
 
 ## Usage
 
 ```js
-var toAbsGlob = require('to-absolute-glob');
+const toAbsGlob = require('to-absolute-glob');
 toAbsGlob('a/*.js');
 //=> '/dev/foo/a/*.js'
 ```
@@ -113,7 +120,7 @@ Pull requests and stars are always welcome. For bugs and feature requests, [plea
 
 ### Contributors
 
-| **Commits** | **Contributor**<br/> | 
+| **Commits** | **Contributor**<br/> |
 | --- | --- |
 | 16 | [doowb](https://github.com/doowb) |
 | 15 | [jonschlinkert](https://github.com/jonschlinkert) |
@@ -147,9 +154,9 @@ $ npm install -d && npm test
 
 ### License
 
-Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
+Copyright (c) [Jon Schlinkert](https://github.com/jonschlinkert).
 Released under the [MIT license](https://github.com/jonschlinkert/to-absolute-glob/blob/master/LICENSE).
 
 ***
 
-_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.2.0, on October 17, 2016._
\ No newline at end of file
+_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v3.0.0, on November 17, 2022._
\ No newline at end of file
diff --git a/test.js b/test.js
deleted file mode 100644
index 4ecbb08..0000000
--- a/test.js
+++ /dev/null
@@ -1,106 +0,0 @@
-'use strict';
-
-require('mocha');
-var path = require('path');
-var assert = require('assert');
-var resolve = require('./');
-var sep = path.sep;
-var fixture;
-var actual;
-
-function unixify(filepath) {
-  return filepath.replace(/\\/g, '/');
-}
-
-describe('resolve', function () {
-  describe('posix', function () {
-    it('should make a path absolute', function () {
-      assert.equal(resolve('a'), unixify(path.resolve('a')));
-    });
-
-    it('should make a glob absolute', function () {
-      assert.equal(resolve('a/*.js'), unixify(path.resolve('a/*.js')));
-    });
-
-    it('should retain trailing slashes', function () {
-      actual = resolve('a/*/');
-      assert.equal(actual, unixify(path.resolve('a/*')) + '/');
-      assert.equal(actual.slice(-1), '/');
-    });
-
-    it('should retain trailing slashes with cwd', function () {
-      fixture = 'fixtures/whatsgoingon/*/';
-      actual = resolve(fixture, {cwd: __dirname});
-      assert.equal(actual, unixify(path.resolve(fixture)) + '/');
-      assert.equal(actual.slice(-1), '/');
-    });
-
-    it('should handle ./ at the beginnnig of a glob', function () {
-      fixture = './fixtures/whatsgoingon/*/';
-      actual = resolve(fixture, {cwd: __dirname});
-      assert.equal(actual, unixify(path.resolve(fixture)) + '/');
-    });
-
-    it('should make a negative glob absolute', function () {
-      actual = resolve('!a/*.js');
-      assert.equal(actual, '!' + unixify(path.resolve('a/*.js')));
-    });
-
-    it('should make a negative extglob absolute', function () {
-      actual = resolve('!(foo)');
-      assert.equal(actual, unixify(path.resolve('!(foo)')));
-    });
-
-    it('should make an escaped negative extglob absolute', function () {
-      actual = resolve('\\!(foo)');
-      assert.equal(actual, unixify(path.resolve('.')) + '/\\!(foo)');
-    });
-
-    it('should make a glob absolute from a cwd', function () {
-      actual = resolve('a/*.js', {cwd: 'foo'});
-      assert.equal(actual, unixify(path.resolve('foo/a/*.js')));
-    });
-
-    it('should make a negative glob absolute from a cwd', function () {
-      actual = resolve('!a/*.js', {cwd: 'foo'});
-      assert.equal(actual, '!' + unixify(path.resolve('foo/a/*.js')));
-    });
-
-    it('should make a glob absolute from a root path', function () {
-      actual = resolve('/a/*.js', {root: 'foo'});
-      assert.equal(actual, unixify(path.resolve('foo/a/*.js')));
-    });
-
-    it('should make a glob absolute from a root slash', function () {
-      actual = resolve('/a/*.js', {root: '/'});
-      assert.equal(actual, unixify(path.resolve('/a/*.js')));
-    });
-
-    it('should make a glob absolute from a negative root path', function () {
-      actual = resolve('!/a/*.js', {root: 'foo'});
-      assert.equal(actual, '!' + unixify(path.resolve('foo/a/*.js')));
-    });
-
-    it('should make a negative glob absolute from a negative root path', function () {
-      actual = resolve('!/a/*.js', {root: '/'})
-      assert.equal(actual, '!' + unixify(path.resolve('/a/*.js')));
-    });
-  });
-
-  describe('windows', function () {
-    it('should make an escaped negative extglob absolute', function () {
-      actual = resolve('foo/bar\\!(baz)');
-      assert.equal(actual, unixify(path.resolve('foo/bar')) + '\\!(baz)');
-    });
-
-    it('should make a glob absolute from a root path', function () {
-      actual = resolve('/a/*.js', {root: 'foo\\bar\\baz'});
-      assert.equal(actual, unixify(path.resolve('foo/bar/baz/a/*.js')));
-    });
-
-    it('should make a glob absolute from a root slash', function () {
-      actual = resolve('/a/*.js', {root: '\\'});
-      assert.equal(actual, unixify(path.resolve('/a/*.js')));
-    });
-  });
-});

More details

Full run details

Historical runs