-
Notifications
You must be signed in to change notification settings - Fork 2
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 #111 from soxhub/better-cross-compiling
Setup d.ts emitting, and clearer cross-compliing of the node assets
- Loading branch information
Showing
31 changed files
with
999 additions
and
689 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,5 @@ | ||
--- | ||
'ember-scoped-css': minor | ||
--- | ||
|
||
Utilize `external` dependencies for a more optimized runtime and install time / size |
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ blueprints/*/files/ | |
|
||
# compiled output | ||
dist/ | ||
declarations/ | ||
|
||
# misc | ||
coverage/ |
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,2 +1,5 @@ | ||
dist/ | ||
declarations/ | ||
|
||
README.md | ||
LICENSE.md |
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,65 @@ | ||
import * as esbuild from 'esbuild'; | ||
import { vitestCleaner } from 'esbuild-plugin-vitest-cleaner'; | ||
import { createRequire as topLevelCreateRequire } from 'module'; | ||
|
||
const require = topLevelCreateRequire(import.meta.url); | ||
|
||
const buildFiles = [ | ||
'src/build/index.js', | ||
'src/build/app-css-loader.js', | ||
'src/build/app-dependency-loader.js', | ||
'src/lib/scoped-css-preprocessor.js', | ||
'src/scoped-babel-plugin.js', | ||
]; | ||
|
||
const external = [...Object.keys(require('./package.json').dependencies)]; | ||
|
||
// Node, CJS | ||
await esbuild.build({ | ||
entryPoints: buildFiles, | ||
bundle: true, | ||
outdir: 'dist/cjs', | ||
format: 'cjs', | ||
platform: 'node', | ||
sourcemap: true, | ||
outExtension: { '.js': '.cjs' }, | ||
external, | ||
plugins: [vitestCleaner()], | ||
}); | ||
|
||
// Node, ESM | ||
await esbuild.build({ | ||
entryPoints: buildFiles, | ||
bundle: true, | ||
outdir: 'dist/esm', | ||
format: 'esm', | ||
target: 'esnext', | ||
platform: 'node', | ||
sourcemap: true, | ||
external, | ||
plugins: [vitestCleaner()], | ||
outExtension: { '.js': '.mjs' }, | ||
/** | ||
* Ooof, this makes it feel like ESBuild doesn't have sufficient funding... | ||
*/ | ||
banner: { | ||
js: ` | ||
import * as __url__ from 'url'; | ||
import { createRequire as topLevelCreateRequire } from 'module'; | ||
const require = topLevelCreateRequire(import.meta.url); | ||
const __filename = __url__.fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
`, | ||
}, | ||
}); | ||
|
||
// Runtime | ||
await esbuild.build({ | ||
entryPoints: ['src/runtime/test-support.ts'], | ||
sourcemap: true, | ||
format: 'esm', | ||
bundle: true, | ||
external, | ||
plugins: [vitestCleaner()], | ||
outdir: 'dist/runtime', | ||
}); |
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,13 +1,11 @@ | ||
#!/bin/bash | ||
|
||
rm -rf dist/ declarations/ | ||
|
||
cp ../README.md ./README.md | ||
cp ../LICENSE.md ./LICENSE.md | ||
|
||
pnpm esbuild \ | ||
src/scoped-babel-plugin.js \ | ||
src/build/app-css-loader.js \ | ||
src/build/app-dependency-loader.js \ | ||
src/lib/scoped-css-preprocessor.js \ | ||
src/runtime/test-support.js \ | ||
--bundle --outdir=dist --platform=node --sourcemap \ | ||
--out-extension:.js=.cjs | ||
node ./build.mjs | ||
|
||
# Types | ||
pnpm tsc |
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
2 changes: 1 addition & 1 deletion
2
...d-css/src/lib/generateRelativePathHash.js → ...d-css/src/lib/generateRelativePathHash.ts
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,5 @@ | ||
import md5 from 'blueimp-md5'; | ||
|
||
export default function generateRelativePathHash(relativePath) { | ||
export default function generateRelativePathHash(relativePath: string) { | ||
return 'e' + md5(relativePath).substring(0, 8); | ||
} |
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
6 changes: 5 additions & 1 deletion
6
ember-scoped-css/src/lib/renameClass.js → ember-scoped-css/src/lib/renameClass.ts
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.