mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 20:29:11 +00:00

For instance `deno bundle --outdir dist index.html` It will find scripts referenced in the html, bundle them, and then update the paths in index.html for the bundled assets. Right now it doesn't handle other assets (from `link` elements), but it could
26 lines
556 B
TypeScript
26 lines
556 B
TypeScript
const path = Deno.args[0];
|
|
const pattern = Deno.args[1];
|
|
|
|
declare global {
|
|
interface RegExpConstructor {
|
|
escape(string: string): string;
|
|
}
|
|
}
|
|
|
|
const contents = Deno.readTextFileSync(path);
|
|
|
|
let matcher: RegExp | string = pattern;
|
|
if (pattern.startsWith("regex:")) {
|
|
matcher = pattern.slice(6);
|
|
matcher = new RegExp(matcher);
|
|
} else {
|
|
matcher = new RegExp(RegExp.escape(pattern));
|
|
}
|
|
|
|
if (matcher.test(contents)) {
|
|
console.log("true");
|
|
} else {
|
|
console.log("false");
|
|
console.log("wanted: ", matcher);
|
|
console.log("found: ", contents);
|
|
}
|