forked from heybourn/headwind
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Major Redesign to use Project-local tailwind to auto-generate orderin…
…g and move to js with jsdoc for types
- Loading branch information
1 parent
ae5d26f
commit 63f01d2
Showing
24 changed files
with
5,309 additions
and
10,444 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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module.exports = { | ||
plugins: [], | ||
env: { | ||
module: true, | ||
es2022: true, | ||
node: true | ||
}, | ||
extends: ['google'], | ||
parserOptions: { | ||
ecmaVersion: 14 | ||
}, | ||
ignorePatterns: ["**/dist/*.js"], | ||
rules: { | ||
'max-len': ['error', {code: 150}], | ||
'comma-dangle': ['error', 'never'], | ||
'no-undef': ['error', {typeof: true}], | ||
'no-shadow': ['error', {builtinGlobals: false, hoist: 'functions', allow: []}], | ||
'valid-jsdoc': 'off', | ||
'new-cap': 'off', | ||
'indent': ['error', 2] | ||
}, | ||
settings: { | ||
jsdoc: { | ||
mode: 'typescript' | ||
} | ||
} | ||
}; |
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,3 +1 @@ | ||
# These are supported funding model platforms | ||
|
||
open_collective: headwind | ||
# the project is not currently looking for funding |
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,5 +1,6 @@ | ||
/out | ||
/node_modules | ||
/dist | ||
.DS_Store | ||
*.vsix | ||
.history |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import fs from 'fs' | ||
import path from 'path' | ||
import { fileURLToPath } from 'url' | ||
import esbuild from 'esbuild' | ||
|
||
/** | ||
* @returns {import('esbuild').Plugin} | ||
*/ | ||
function patchRecast() { | ||
return { | ||
// https://github.com/benjamn/recast/issues/611 | ||
name: 'patch-recast', | ||
setup(build) { | ||
build.onLoad({ filter: /recast\/lib\/patcher\.js$/ }, async (args) => { | ||
let original = await fs.promises.readFile(args.path, 'utf8') | ||
|
||
return { | ||
contents: original | ||
.replace( | ||
'var nls = needsLeadingSpace(lines, oldNode.loc, newLines);', | ||
'var nls = oldNode.type !== "TemplateElement" && needsLeadingSpace(lines, oldNode.loc, newLines);', | ||
) | ||
.replace( | ||
'var nts = needsTrailingSpace(lines, oldNode.loc, newLines)', | ||
'var nts = oldNode.type !== "TemplateElement" && needsTrailingSpace(lines, oldNode.loc, newLines)', | ||
), | ||
} | ||
}) | ||
}, | ||
} | ||
} | ||
|
||
/** | ||
* @returns {import('esbuild').Plugin} | ||
*/ | ||
function patchCjsInterop() { | ||
return { | ||
name: 'patch-cjs-interop', | ||
setup(build) { | ||
build.onEnd(async () => { | ||
let outfile = './dist/index.js' | ||
|
||
let content = await fs.promises.readFile(outfile) | ||
|
||
// Prepend `createRequire` | ||
let code = [ | ||
`import {createRequire} from 'module'`, | ||
`import {dirname as __global__dirname__} from 'path'`, | ||
`import {fileURLToPath} from 'url'`, | ||
|
||
// CJS interop fixes | ||
`const require=createRequire(import.meta.url)`, | ||
`const __filename=fileURLToPath(import.meta.url)`, | ||
`const __dirname=__global__dirname__(__filename)`, | ||
] | ||
|
||
content = `${code.join('\n')}\n${content}` | ||
|
||
fs.promises.writeFile(outfile, content) | ||
}) | ||
}, | ||
} | ||
} | ||
|
||
const __dirname = path.dirname(fileURLToPath(import.meta.url)) | ||
|
||
let context = await esbuild.context({ | ||
bundle: true, | ||
platform: 'node', | ||
target: 'node14.21.3', | ||
external: ["vscode"], | ||
minify: true, | ||
entryPoints: [path.resolve(__dirname, './src/index.js')], | ||
outfile: path.resolve(__dirname, './dist/index.js'), | ||
format: 'cjs', | ||
plugins: [patchRecast()], | ||
}) | ||
|
||
await context.rebuild() | ||
|
||
if (process.argv.includes('--watch')) { | ||
await context.watch() | ||
} | ||
|
||
await context.dispose() |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.