thedesk/app/node_modules/app-builder-lib/out/util/NodeModuleCopyHelper.js.map
2019-09-12 23:38:13 +09:00

2 lines
8.8 KiB
Plaintext

{"version":3,"sources":["../../src/util/NodeModuleCopyHelper.ts"],"names":[],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;AAEA,MAAM,aAAa,GAAG,IAAI,GAAJ,CAAQ,CAAC,WAAD,EAAc;AAAe;AAA7B,EAAyD,cAAzD,EAAyE,WAAzE,EAAsF,cAAtF,EAAsG,aAAtG,EAAqH,YAArH,EAAmI,MAAnI,CAA0I,6BAAc,KAAd,CAAoB,GAApB,CAA1I,CAAR,CAAtB;AACA,MAAM,qBAAqB,GAAG,IAAI,GAAJ,CAAQ,CAAC,SAAD,EAAY,eAAZ,EAA6B,gBAA7B,EAA+C,WAA/C,EAA4D,iBAA5D,EAA+E,QAA/E,EAAyF,WAAzF,EAAsG,QAAtG,EAAgH,MAAhH,EAAwH,WAAxH,EAAqI,OAArI,EAA8I,cAA9I,EAA8J,SAA9J,EAAyK,UAAzK,EAAqL,MAArL,CAAR,CAA9B;AAEA;;AACM,MAAO,oBAAP,SAAoC,+BAApC,CAAkD;AACtD,EAAA,WAAA,CAAY,OAAZ,EAAkC,QAAlC,EAAoD;AAClD,UAAM,OAAN,EAAe,OAAO,CAAC,OAAR,KAAoB,IAApB,GAA2B,OAAO,CAAC,YAAR,EAA1C,EAAkE,QAAlE;AACD;;AAED,QAAM,kBAAN,CAAyB,OAAzB,EAA0C,WAA1C,EAAyE,sBAAzE,EAA8G;AAC5G,UAAM,MAAM,GAAG,KAAK,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A,QAAQ,CAAC,GAAT,CAAa,QAAb,EAAuB,IAAvB;AACD;;AACD,kBAAM,cAAc,GAAG,KAAK,UAAL,CAAgB,QAAhB,EAA0B,OAA1B,EAAmC,IAAnC,CAAvB;;AACA,gBAAI,cAAc,IAAI,IAAtB,EAA4B;AAC1B,kBAAI,IAAI,CAAC,WAAL,EAAJ,EAAwB;AACtB,gBAAA,IAAI,CAAC,IAAL,CAAU,IAAV;AACA,uBAAO,IAAP;AACD,eAHD,MAIK;AACH,uBAAO,QAAP;AACD;AACF,aARD,MASK;AACH,qBAAO,cAAc,CAClB,IADI,CACC,EAAE,IAAG;AACT;AACA,oBAAI,CAAC,EAAE,IAAI,IAAN,GAAa,IAAb,GAAoB,EAArB,EAAyB,WAAzB,EAAJ,EAA4C;AAC1C,kBAAA,IAAI,CAAC,IAAL,CAAU,IAAV;AACA,yBAAO,IAAP;AACD,iBAHD,MAIK;AACH,yBAAO,QAAP;AACD;AACF,eAVI,CAAP;AAWD;AACF,WAhCI,CAAP;AAiCD,SArE6B,EAqE3B,iBArE2B,CAA9B;;AAuEA,aAAK,MAAM,KAAX,IAAoB,eAApB,EAAqC;AACnC,cAAI,KAAK,IAAI,IAAb,EAAmB;AACjB,YAAA,MAAM,CAAC,IAAP,CAAY,KAAZ;AACD;AACF;;AAED,QAAA,IAAI,CAAC,IAAL;;AACA,aAAK,MAAM,KAAX,IAAoB,IAApB,EAA0B;AACxB,UAAA,KAAK,CAAC,IAAN,CAAW,OAAO,GAAG,IAAI,CAAC,GAAf,GAAqB,KAAhC;AACD;AACF;AACF;;AACD,WAAO,MAAP;AACD;;AAjHqD,C","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { CONCURRENCY } from \"builder-util/out/fs\"\nimport { lstat, readdir } from \"fs-extra\"\nimport * as path from \"path\"\nimport { excludedNames, FileMatcher } from \"../fileMatcher\"\nimport { Packager } from \"../packager\"\nimport { resolveFunction } from \"../platformPackager\"\nimport { FileCopyHelper } from \"./AppFileWalker\"\n\nconst excludedFiles = new Set([\".DS_Store\", \"node_modules\" /* already in the queue */, \"CHANGELOG.md\", \"ChangeLog\", \"changelog.md\", \"binding.gyp\", \".npmignore\"].concat(excludedNames.split(\",\")))\nconst topLevelExcludedFiles = new Set([\"test.js\", \"karma.conf.js\", \".coveralls.yml\", \"README.md\", \"readme.markdown\", \"README\", \"readme.md\", \"readme\", \"test\", \"__tests__\", \"tests\", \"powered-test\", \"example\", \"examples\", \".bin\"])\n\n/** @internal */\nexport class NodeModuleCopyHelper extends FileCopyHelper {\n constructor(matcher: FileMatcher, packager: Packager) {\n super(matcher, matcher.isEmpty() ? null : matcher.createFilter(), packager)\n }\n\n async collectNodeModules(baseDir: string, moduleNames: Iterable<string>, nodeModuleExcludedExts: Array<string>): Promise<Array<string>> {\n const filter = this.filter\n const metadata = this.metadata\n\n const onNodeModuleFile = resolveFunction(this.packager.config.onNodeModuleFile, \"onNodeModuleFile\")\n\n const result: Array<string> = []\n const queue: Array<string> = []\n for (const moduleName of moduleNames) {\n const tmpPath = baseDir + path.sep + moduleName\n queue.length = 1\n // The path should be corrected in Windows that when the moduleName is Scoped packages named.\n const depPath = path.normalize(tmpPath)\n queue[0] = depPath\n\n while (queue.length > 0) {\n const dirPath = queue.pop()!\n\n const childNames = await readdir(dirPath)\n childNames.sort()\n\n const isTopLevel = dirPath === depPath\n const dirs: Array<string> = []\n // our handler is async, but we should add sorted files, so, we add file to result not in the mapper, but after map\n const sortedFilePaths = await BluebirdPromise.map(childNames, name => {\n if (onNodeModuleFile != null) {\n onNodeModuleFile(dirPath + path.sep + name)\n }\n\n if (excludedFiles.has(name) || name.startsWith(\"._\")) {\n return null\n }\n\n for (const ext of nodeModuleExcludedExts) {\n if (name.endsWith(ext)) {\n return null\n }\n }\n\n // noinspection SpellCheckingInspection\n if (isTopLevel && (topLevelExcludedFiles.has(name) || (moduleName === \"libui-node\" && (name === \"build\" || name === \"docs\" || name === \"src\")))) {\n return null\n }\n\n if (dirPath.endsWith(\"build\")) {\n if (name === \"gyp-mac-tool\" || name === \"Makefile\" || name.endsWith(\".mk\") || name.endsWith(\".gypi\") || name.endsWith(\".Makefile\")) {\n return null\n }\n }\n else if (dirPath.endsWith(\"Release\") && (name === \".deps\" || name === \"obj.target\")) {\n return null\n }\n else if (name === \"src\" && (dirPath.endsWith(\"keytar\") || dirPath.endsWith(\"keytar-prebuild\"))) {\n return null\n }\n else if (dirPath.endsWith(\"lzma-native\") && (name === \"build\" || name === \"deps\")) {\n return null\n }\n\n const filePath = dirPath + path.sep + name\n return lstat(filePath)\n .then(stat => {\n if (filter != null && !filter(filePath, stat)) {\n return null\n }\n\n if (!stat.isDirectory()) {\n metadata.set(filePath, stat)\n }\n const consumerResult = this.handleFile(filePath, dirPath, stat)\n if (consumerResult == null) {\n if (stat.isDirectory()) {\n dirs.push(name)\n return null\n }\n else {\n return filePath\n }\n }\n else {\n return consumerResult\n .then(it => {\n // asarUtil can return modified stat (symlink handling)\n if ((it == null ? stat : it).isDirectory()) {\n dirs.push(name)\n return null\n }\n else {\n return filePath\n }\n })\n }\n })\n }, CONCURRENCY)\n\n for (const child of sortedFilePaths) {\n if (child != null) {\n result.push(child)\n }\n }\n\n dirs.sort()\n for (const child of dirs) {\n queue.push(dirPath + path.sep + child)\n }\n }\n }\n return result\n }\n}"],"sourceRoot":""}