Skip to content

Instantly share code, notes, and snippets.

🔮
the only way out is through

isaacs isaacs

🔮
the only way out is through
View GitHub Profile
View pp.js
const Parser = require('tap-parser')
const print = parser => {
parser.on('assert', a => console.log(parser.name, a))
parser.on('complete', res => console.log(parser.name, res))
parser.on('child', c => print(c))
}
const p = new Parser()
print(p)
View notes-links.md
View index.js
// Exhaustively try to break a tee stream usage akin to the weird
// make-fetch-happen/cacache interaction behind
// https://github.com/npm/npm-registry-fetch/issues/23
// make-fetch-happen commit 7f896bef4bbcab73eccb92b5999204b673cdf485
//
// "cache" is a mock akin to cacache.put.stream()
// It is a pipeline containing:
// - a cache writing stream `cache`
// A minipass-flush with an internal writer `cacheContent`, that it proxies
// writes to, and drain events from. The first time the content is written
View inspect.js
debugger
const t = require('./')
t.test('this is a test', t => {
debugger
t.pass('this is only a test')
setTimeout(() => {
debugger
t.pass('this is fine')
View test.js
const pacote = require('../')
const https = require('https')
const fs = require('fs')
const pMap = require('p-map');
https.get('https://replicate.npmjs.com/_all_docs', res => {
const body = []
res.on('data', c => body.push(c))
res.on('end', () => runTest(JSON.parse(Buffer.concat(body).toString())))
})
View gist:c96b32838d3d87132e4853087bf12067
{
"name": "abbrev-link",
"version": undefined,
"location": "",
"path": "/Users/isaacs/dev/js/abbrev-link",
"root": "/Users/isaacs/dev/js/abbrev-link",
"resolved": null,
"edgesOut": {
"abbrev": {
"type": "prod",
View gist:2650b74c43637a5892d945cfc551d2d0
diff --git a/lib/dir.js b/lib/dir.js
index 44dadaa..70a62ee 100644
--- a/lib/dir.js
+++ b/lib/dir.js
@@ -41,18 +41,14 @@ class DirFetcher extends Fetcher {
}
[_tarballFromResolved] () {
- const stream = new Minipass()
- stream.resolved = this.resolved
View gist:d18d5725c6055db4f93db3cd78f66bca
diff --git a/lib/fetcher.js b/lib/fetcher.js
index 4c5efdc..22701df 100644
--- a/lib/fetcher.js
+++ b/lib/fetcher.js
@@ -271,7 +271,8 @@ class FetcherBase {
}. Extracting by manifest.`)
}
return this.resolve().then(() => retry(tryAgain =>
- streamHandler(this[_istream](this[_tarballFromResolved]()))
+ this[_tarballFromResolved]()
View gist:1b9ce18d7f9949750a4830b375ec82db
$ node -e 'const version = require("../libnpmversion"); process.on("log", console.error); version("major").then(console.log,console.error)'
> @npmcli/git@1.0.1 test /Users/isaacs/dev/npm/git
> tap
(node:39130) ExperimentalWarning: Conditional exports is an experimental feature. This feature could change at any time
(node:39131) ExperimentalWarning: Conditional exports is an experimental feature. This feature could change at any time
PASS test/env.js 3 OK 7.574ms
PASS test/find.js 3 OK 53.654ms
PASS test/opts.js 2 OK 72.281ms
View gist:bf87b822a0ffdebe3b010684e27d0856
diff --git a/lib/arborist/build-ideal-tree.js b/lib/arborist/build-ideal-tree.js
index 9464772..5a4f8d7 100644
--- a/lib/arborist/build-ideal-tree.js
+++ b/lib/arborist/build-ideal-tree.js
@@ -208,7 +208,8 @@ module.exports = cls => class IdealTreeBuilder extends Tracker(Virtual(Actual(cl
}
[_rootNodeFromPackage] (pkg) {
- return new Node({
+ const Cls = pkg.workspaces ? Workspace : Node
You can’t perform that action at this time.