packaged-path-parse
Advanced tools
Comparing version 9.11.1-rc2 to 9.11.1
@@ -5,3 +5,3 @@ 'use strict'; | ||
* A builder helper. | ||
* | ||
* | ||
* WARNING: this works on specific versions and is just a handy tool to reduce | ||
@@ -34,6 +34,6 @@ * manual errors. The results of this have to be re-checked, and it is expected | ||
); | ||
return; | ||
throw new Error('Node.js version mismatch'); | ||
} | ||
const fun2str = (fun) => Function.prototype.toString.call(fun); | ||
const fun2str = fun => Function.prototype.toString.call(fun); | ||
@@ -51,2 +51,6 @@ function generateTestdata() { | ||
function functionRe(name) { | ||
return new RegExp(`(\\n+//.*)?\\nfunction ${name}\\([\\s\\S]*?\\n}\\n+`); | ||
} | ||
function build() { | ||
@@ -57,13 +61,13 @@ const constants = require('./node/internal/constants'); | ||
.replace(/errors\.TypeError/g, 'TypeError') | ||
.replace(/(\n+\/\/.*)?\nfunction normalizeString\([\s\S]*?\n}\n+/, '\n') | ||
.replace(/(\n+\/\/.*)?\nfunction _format\([\s\S]*?\n}\n+/, '\n') | ||
.replace(/(\n+\/\/.*)?\nfunction isPosixPathSeparator\([\s\S]*?\n}\n+/, '\n') | ||
.replace(functionRe('normalizeString'), '\n') | ||
.replace(functionRe('_format'), '\n') | ||
.replace(functionRe('isPosixPathSeparator'), '\n') | ||
.replace("const errors = require('internal/errors');", '') | ||
.replace(/const {((?:\s*[A-Z_]+,\n)+)} = require\('internal\/constants'\);/, | ||
(...match) => { | ||
const names = match[1].split(',').map(x => x.trim()).filter(x => x); | ||
for (const name of names) { | ||
assert.ok(constants[name] !== 'undefined'); | ||
const keys = match[1].split(',').map(x => x.trim()).filter(x => x); | ||
for (const key of keys) { | ||
assert.ok(constants[key] !== 'undefined'); | ||
} | ||
return names.map(name => `const ${name} = ${constants[name]};`).join('\n'); | ||
return keys.map(key => `const ${key} = ${constants[key]};`).join('\n'); | ||
} | ||
@@ -73,3 +77,5 @@ ) | ||
const head = source.replace(/const (win32|posix) = {[\s\S]*/m, ''); | ||
const obj = new Function(`const module = {};${source};return module.exports`)(); | ||
const obj = new Function( | ||
`const module = {};${source};return module.exports` | ||
)(); | ||
const win32 = fun2str(obj.win32.parse); | ||
@@ -119,3 +125,3 @@ const posix = fun2str(obj.posix.parse); | ||
'module.exports', 'require', 'internals/', | ||
'constants.', 'process.', 'errors.' | ||
'process.', 'constants', 'errors', 'global', 'window' | ||
]) { | ||
@@ -126,3 +132,3 @@ assert.equal(funCode.includes(text), false); | ||
// Let's now run tests on top of assert instead of tape | ||
const test = {...assert}; | ||
const test = { ...assert }; | ||
test.end = () => {}; | ||
@@ -147,5 +153,4 @@ test.deepEqual = test.deepStrictEqual; | ||
console.log('Transpliting...'); | ||
const es3code = babel.transform(code, | ||
JSON.parse(fs.readFileSync('.babelrc', 'utf-8')) | ||
).code; | ||
const babelrc = JSON.parse(fs.readFileSync('.babelrc', 'utf-8')); | ||
const es3code = `${babel.transform(code, babelrc).code.trim()}\n`; | ||
console.log('Transpliting complete, verifying...'); | ||
@@ -152,0 +157,0 @@ verify(es3code, false); |
@@ -274,2 +274,2 @@ // packaged-path-parse - path.parse() extracted from Node.js v9.11.1 | ||
}(); | ||
if (typeof module !== 'undefined') module.exports = pathParse; | ||
if (typeof module !== 'undefined') module.exports = pathParse; |
{ | ||
"name": "packaged-path-parse", | ||
"version": "9.11.1-rc2", | ||
"version": "9.11.1", | ||
"description": "path.parse() from Node.js as a standalone package", | ||
"main": "index.js", | ||
"scripts": { | ||
"browserify-test": "browserify --external tape test/run-simple.js > test/run-browserify.js && tape test/run-browserify.js", | ||
"lint": "eslint builder.js test/*.js", | ||
"build": "node ./builder.js && npm t", | ||
"buildtest": "node ./builder.js check && npm t", | ||
"simpletest": "node test/run-simple.js", | ||
"test": "tape test/run-all.js" | ||
"test": "npm run lint && tape test/run-all.js" | ||
}, | ||
@@ -42,2 +44,5 @@ "keywords": [ | ||
"deep-equal": "^1.0.1", | ||
"eslint-config-airbnb-base": "^12.1.0", | ||
"eslint-plugin-import": "^2.10.0", | ||
"eslint": "^4.19.1", | ||
"tape": "^4.9.0" | ||
@@ -44,0 +49,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
23049
386
1
11