Make the complete file complete
This commit is contained in:
parent
66c4e1ce4b
commit
cb4431c1a0
|
@ -146,9 +146,17 @@ You can then use `+mergeMap+` to inject this function into our pipeline. Here is
|
||||||
[source,ts]
|
[source,ts]
|
||||||
----
|
----
|
||||||
import { VFile } from "https://esm.sh/vfile@^6.0.1";
|
import { VFile } from "https://esm.sh/vfile@^6.0.1";
|
||||||
|
import { Glob } from "https://esm.sh/glob@^10.4.2";
|
||||||
import { read } from "https://esm.sh/to-vfile@^8.0.0";
|
import { read } from "https://esm.sh/to-vfile@^8.0.0";
|
||||||
|
import { from, mergeMap, tap } from "https://esm.sh/rxjs@^7.8.1";
|
||||||
import { dirname, relative, resolve } from "jsr:@std/path@^0.225.2";
|
import { dirname, relative, resolve } from "jsr:@std/path@^0.225.2";
|
||||||
|
|
||||||
|
const src = (globs: string | string[]) =>
|
||||||
|
from(new Glob(globs, {})).pipe(
|
||||||
|
mergeMap((file) => read(resolve(file))),
|
||||||
|
tap((file) => file.cwd = Deno.cwd()),
|
||||||
|
);
|
||||||
|
|
||||||
const dest = (prefix: string) => async (file: VFile) => {
|
const dest = (prefix: string) => async (file: VFile) => {
|
||||||
const relativePath = relative(file.cwd, file.path);
|
const relativePath = relative(file.cwd, file.path);
|
||||||
const finalPath = resolve(prefix, relativePath);
|
const finalPath = resolve(prefix, relativePath);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user