-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use fast-glob instead of vinyl-fs
- Loading branch information
Showing
11 changed files
with
269 additions
and
539 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 25,7 @@ jobs: | |
- name: test | ||
run: | | ||
yarn | ||
yarn build | ||
yarn jest --coverage | ||
- name: report | ||
uses: coverallsapp/[email protected] | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 1,25 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
# This file is generated by running "yarn install" inside your project. | ||
# Manual changes might be lost - proceed with caution! | ||
|
||
__metadata: | ||
version: 4 | ||
cacheKey: 8 | ||
|
||
gogen@^0.0.1: | ||
version "0.0.1" | ||
resolved "https://registry.yarnpkg.com/gogen/-/gogen-0.0.1.tgz#296301c90ae933108400dc6939f8a38098b6a38b" | ||
integrity sha512-395vZjcpMB6T3 vOphiKZiEhiYs9Y8/Y350P0D1OPR4DM6kbsRwypv2j0b4KemrceFxxPdFKUSoWkAr XJRjvg== | ||
"create-gogen@workspace:.": | ||
version: 0.0.0-use.local | ||
resolution: "create-gogen@workspace:." | ||
dependencies: | ||
gogen: ^1.1.1 | ||
bin: | ||
create-gogen: cli.js | ||
languageName: unknown | ||
linkType: soft | ||
|
||
"gogen@npm:^1.1.1": | ||
version: 1.1.1 | ||
resolution: "gogen@npm:1.1.1" | ||
bin: | ||
gogen: cli.js | ||
checksum: 2dc26f3bc7fc5649d5406b0101e8dd8209d178fd17efca5758ee8279592bd3455ae64d9ca1bba2b73a8fcbfc8511a7bd41100bfc098dad607836a04fe435c744 | ||
languageName: node | ||
linkType: hard |
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 |
---|---|---|
@@ -1,3 1,7 @@ | ||
#!/usr/bin/env node | ||
|
||
require('./dist').run(process.argv.slice(2)) | ||
|
||
// TODO: ESM | ||
// import {run} from './dist/index.js' | ||
// run(process.argv.slice(2)) |
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,83 @@ | ||
/// <reference types="node" /> | ||
import path from 'path' | ||
import assert from 'assert' | ||
|
||
type Content = Buffer | NodeJS.ReadableStream | null | ||
|
||
const assertString = (v: string) => { | ||
assert.ok(typeof v === 'string') | ||
} | ||
|
||
const assertNoneEmptyString = (v: string) => { | ||
assertString(v) | ||
assert.ok(v) | ||
} | ||
|
||
/** | ||
* Virtual File | ||
* | ||
* Like simplified vinyl, no dependencies. | ||
*/ | ||
export class VFile { | ||
#base: string = '' | ||
#contents: Content = null | ||
#history: string[] = [] | ||
|
||
get contents() { | ||
return this.#contents | ||
} | ||
set contents(v: Content) { | ||
this.#contents = v | ||
} | ||
|
||
get path() { | ||
return this.#history[this.#history.length - 1] | ||
} | ||
set path(v: string) { | ||
assertString(v) | ||
this.#history.push(v) | ||
} | ||
|
||
get dirname() { | ||
return path.dirname(this.path) | ||
} | ||
set dirname(v: string) { | ||
assert.ok(this.path) | ||
this.path = path.join(v, this.basename) | ||
} | ||
|
||
get basename() { | ||
assert.ok(this.path) | ||
return path.basename(this.path) | ||
} | ||
set basename(v: string) { | ||
assert.ok(this.path) | ||
this.path = path.join(this.dirname, v) | ||
} | ||
|
||
get extname() { | ||
assert.ok(this.path) | ||
return path.extname(this.path) | ||
} | ||
set extname(v: string) { | ||
const {name} = path.parse(this.basename) | ||
this.basename = path.format({name, ext: v}) | ||
} | ||
|
||
get base() { | ||
return this.#base | ||
} | ||
set base(v: string) { | ||
assertNoneEmptyString(v) | ||
this.#base = v | ||
} | ||
|
||
get relative() { | ||
assert.ok(this.path) | ||
return path.relative(this.base, this.path) | ||
} | ||
|
||
isBuffer() { | ||
return Buffer.isBuffer(this.#contents) | ||
} | ||
} |
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.