mirror of
https://github.com/cloudflare/wrangler-action.git
synced 2024-11-29 13:14:46 +01:00
1 line
4.9 KiB
Text
1 line
4.9 KiB
Text
|
{"version":3,"file":"core.js","sourceRoot":"","sources":["core.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,sDAA6B;AAC7B,2BAA8C;AAC9C,4DAAoC;AAEpC;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,OAAgB;IAEjD,IAAI,CAAC,OAAO,EACZ;QACC,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;KACxB;IAED,IAAI,IAAI,GAAG,iBAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAEhC,IAAI,CAAC,IAAI,EACT;QACC,OAAO,IAAI,CAAC;KACZ;IAED,OAAO,GAAG,cAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAE/B,IAAI,QAAQ,GAAW,IAAI,CAAC;IAC5B,IAAI,OAAO,GAAW,OAAO,CAAC;IAE9B,GACA;QACC,MAAM,QAAQ,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;QAC1C,MAAM,UAAU,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAE/C,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAEvD,IAAI,IAAI,EACR;YACC,OAAO,KAAK,CAAC;SACb;QAED,QAAQ,GAAG,OAAO,CAAC;QACnB,OAAO,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;KAChC,QACM,OAAO,KAAK,QAAQ,EAAE;IAE7B,OAAO,IAAI,CAAC;AACb,CAAC;AArCD,8CAqCC;AAED,SAAgB,eAAe,CAAC,OAAe,EAAE,OAAe;IAE/D,MAAM,QAAQ,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAC1C,MAAM,UAAU,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAE/C,IAAI,IAAI,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ED,iBAAiB,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;AACxD,iBAAiB,CAAC,eAAe,GAAG,eAAe,CAAC;AACpD,iBAAiB,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;AACxD,iBAAiB,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;AACxD,iBAAiB,CAAC,OAAO,GAAG,iBAAiB,CAAC;AAE9C,kBAAe,iBAAiB,CAAA","sourcesContent":["import path from 'path';\nimport pkgDir from 'pkg-dir';\nimport { existsSync, readFileSync } from 'fs';\nimport micromatch from 'micromatch';\n\n/**\n * Adapted from:\n * https://github.com/yarnpkg/yarn/blob/ddf2f9ade211195372236c2f39a75b00fa18d4de/src/config.js#L612\n * @param {string} [initial]\n * @return {string|null}\n */\nexport function findWorkspaceRoot(initial?: string): string\n{\n\tif (!initial)\n\t{\n\t\tinitial = process.cwd();\n\t}\n\n\tlet _pkg = pkgDir.sync(initial);\n\n\tif (!_pkg)\n\t{\n\t\treturn null;\n\t}\n\n\tinitial = path.normalize(_pkg);\n\n\tlet previous: string = null;\n\tlet current: string = initial;\n\n\tdo\n\t{\n\t\tconst manifest = readPackageJSON(current);\n\t\tconst workspaces = extractWorkspaces(manifest);\n\n\t\tlet { done, found } = checkWorkspaces(current, initial)\n\n\t\tif (done)\n\t\t{\n\t\t\treturn found;\n\t\t}\n\n\t\tprevious = current;\n\t\tcurrent = path.dirname(current);\n\t}\n\twhile (current !== previous);\n\n\treturn null;\n}\n\nexport function checkWorkspaces(current: string, initial: string)\n{\n\tconst manifest = readPackageJSON(current);\n\tconst workspaces = extractWorkspaces(manifest);\n\n\tlet done: boolean = false;\n\tlet found: string;\n\tlet relativePath: string;\n\n\tif (workspaces)\n\t{\n\t\tdone = true;\n\n\t\trelativePath = path.relative(current, initial);\n\t\tif (relativePath === '' || isMatchWorkspaces(relativePath, workspaces))\n\t\t{\n\t\t\tfound = current;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfound = null;\n\t\t}\n\t}\n\n\treturn {\n\t\tdone,\n\t\tfound,\n\t\trelativePath,\n\t}\n}\n\nexport function isMatchWorkspaces(relativePath: string, workspaces: string[])\n{\n\tlet ls = micromatch([relativePath], workspaces);\n\n\treturn ls.length > 0;\n}\n\nexport function extractWorkspaces<T extends string[]>(manifest
|