From 8852c8202a654dc03ad601b085d951b2709ac3c1 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Mon, 9 Dec 2024 15:54:49 -0800 Subject: [PATCH] WIP --- package-lock.json | 30 +++++++++++++++++++++++++++++- package.json | 3 ++- src/utils/sharedlib-emit.ts | 13 +++++-------- 3 files changed, 36 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8c305b7c..c4d5e3d9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,8 @@ "graceful-fs": "^4.2.9", "node-gyp-build": "^4.2.2", "picomatch": "^4.0.2", - "resolve-from": "^5.0.0" + "resolve-from": "^5.0.0", + "tinyglobby": "^0.2.10" }, "bin": { "nft": "out/cli.js" @@ -13512,6 +13513,20 @@ "pend": "~1.2.0" } }, + "node_modules/fdir": { + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.2.tgz", + "integrity": "sha512-KnhMXsKSPZlAhp7+IjUkRZKPb4fUyccpDrdFXbi4QL1qkmFh9kVY09Yox+n4MaOb3lHZ1Tv829C3oaaXoMYPDQ==", + "license": "MIT", + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, "node_modules/fetch-h2": { "version": "2.5.1", "resolved": "https://registry.npmjs.org/fetch-h2/-/fetch-h2-2.5.1.tgz", @@ -29523,6 +29538,19 @@ "integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==", "dev": true }, + "node_modules/tinyglobby": { + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.10.tgz", + "integrity": "sha512-Zc+8eJlFMvgatPZTl6A9L/yht8QqdmUNtURHaKZLmKBE12hNPSrqNkUp2cs3M/UKmNVVAMFQYSjYIVHDjW5zew==", + "license": "MIT", + "dependencies": { + "fdir": "^6.4.2", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/title-case": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/title-case/-/title-case-1.1.2.tgz", diff --git a/package.json b/package.json index 0fd54a05..87014ea8 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,8 @@ "graceful-fs": "^4.2.9", "node-gyp-build": "^4.2.2", "picomatch": "^4.0.2", - "resolve-from": "^5.0.0" + "resolve-from": "^5.0.0", + "tinyglobby": "^0.2.10" }, "devDependencies": { "@azure/cosmos": "^2.1.7", diff --git a/src/utils/sharedlib-emit.ts b/src/utils/sharedlib-emit.ts index 42fbde8d..cd703cca 100644 --- a/src/utils/sharedlib-emit.ts +++ b/src/utils/sharedlib-emit.ts @@ -1,5 +1,5 @@ import os from 'os'; -import glob from 'glob'; +import { convertPathToPattern, glob } from 'tinyglobby'; import { getPackageBase } from './get-package-base'; import { Job } from '../node-file-trace'; @@ -21,12 +21,9 @@ export async function sharedLibEmit(path: string, job: Job) { const pkgPath = getPackageBase(path); if (!pkgPath) return; - const files = await new Promise((resolve, reject) => - glob( - pkgPath + sharedlibGlob, - { ignore: pkgPath + '/**/node_modules/**/*', dot: true }, - (err, files) => (err ? reject(err) : resolve(files)), - ), - ); + const files = await glob(convertPathToPattern(pkgPath) + sharedlibGlob, { + ignore: pkgPath + '/**/node_modules/**/*', + dot: true, + }); await Promise.all(files.map((file) => job.emitFile(file, 'sharedlib', path))); }