-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3354 from nulib/deploy/staging
Deploy v8.0.0 to production
- Loading branch information
Showing
112 changed files
with
2,746 additions
and
3,343 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const fs = require("node:fs"); | ||
const { globSync } = require("glob"); | ||
const path = require("node:path"); | ||
|
||
const DEFAULT_EXTENSIONS = [".tsx", ".ts", ".jsx", ".js", ".css", ".json"]; | ||
|
||
function indexFile(source) { | ||
const candidate = path.resolve(source, "./index.js"); | ||
if (fs.existsSync(candidate)) return candidate; | ||
return null; | ||
} | ||
|
||
function matchingFile(source, glob) { | ||
const candidates = globSync(`${source}.{${glob}}`); | ||
return candidates[0] || source; | ||
} | ||
|
||
function resolveFile(source, glob) { | ||
return indexFile(source) || matchingFile(source, glob); | ||
} | ||
|
||
module.exports = (specs) => { | ||
return { | ||
name: "aliasGlob", | ||
setup(build) { | ||
for (const alias in specs) { | ||
const { to } = specs[alias]; | ||
const exts = build.initialOptions?.resolveExtensions || DEFAULT_EXTENSIONS; | ||
const fileGlob = exts.join(",").replaceAll(/\./g, "") || ""; | ||
const filter = new RegExp(`^${alias}/`); | ||
build.onResolve({ filter }, async (opts) => { | ||
const source = opts.path.replace(filter, ""); | ||
const result = resolveFile(path.resolve(to, source), fileGlob); | ||
return { path: result }; | ||
}); | ||
} | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const fs = require("node:fs"); | ||
const path = require("node:path"); | ||
|
||
module.exports = (loc) => { | ||
const relativePathResolver = new RegExp( | ||
"^(?<prefix>.+?/)(node_modules/.+/)(?<path>node_modules/.+$)" | ||
); | ||
let result = loc.replace(relativePathResolver, "$<prefix>$<path>"); | ||
|
||
if (result.startsWith("@")) { | ||
result = path.join(process.cwd(), "node_modules", result); | ||
} | ||
|
||
if (fs.existsSync(path.join(result, "package.json"))) { | ||
const spec = JSON.parse(fs.readFileSync(path.join(result, "package.json"))); | ||
result = path.join(result, spec.sass || spec.main); | ||
} | ||
|
||
return result; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.