-
Notifications
You must be signed in to change notification settings - Fork 8
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 #44 from embroider-build/non-monorepo
Standalone content-tag implemented via conditional exports in package.json
- Loading branch information
Showing
18 changed files
with
2,600 additions
and
87 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,3 @@ | ||
node_modules/ | ||
pkg/node/ | ||
index.d.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
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 @@ | ||
/target | ||
/node_modules | ||
/node_modules | ||
|
||
pkg/node/ | ||
pkg/standalone/ |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,17 @@ | ||
#!/bin/bash | ||
|
||
# we need npm packages for the post-wasm phase | ||
npm install | ||
|
||
rm -rf pkg/node | ||
rm -rf pkg/standalone | ||
|
||
# wasm-pack knows to use wasm-opt, when present | ||
# NOTE: wasm-pack does not support multi-target building | ||
# so we'll build twice, and then tweak package.json | ||
# "exports" to point at the correct build depending on node or browser | ||
wasm-pack build --target web --out-dir pkg/standalone --weak-refs --no-pack --release | ||
wasm-pack build --target nodejs --out-dir pkg/node --weak-refs --no-pack --release | ||
|
||
# Rename the node js file to cjs, because we emit type=module | ||
mv pkg/node/content_tag.js pkg/node/content_tag.cjs |
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,48 @@ | ||
/* | ||
* wasm-pack doesn't give us correct enough types. | ||
*/ | ||
|
||
|
||
|
||
interface Parsed { | ||
type: 'expression' | 'class-member'; | ||
tagName: 'template'; | ||
contents: string; | ||
range: { | ||
start: number; | ||
end: number; | ||
}; | ||
contentRange: { | ||
start: number; | ||
end: number; | ||
}; | ||
startRange: { | ||
end: number; | ||
start: number; | ||
}; | ||
endRange: { | ||
start: number; | ||
end: number; | ||
}; | ||
} | ||
|
||
class Preprocessor { | ||
free(): void; | ||
/** | ||
*/ | ||
constructor(); | ||
/** | ||
* @param {string} src | ||
* @param {string | undefined} filename | ||
* @returns {string} | ||
*/ | ||
process(src: string, filename?: string): string; | ||
/** | ||
* @param {string} src | ||
* @param {string | undefined} filename | ||
* @returns {any} | ||
*/ | ||
parse(src: string, filename?: string): Parsed; | ||
} | ||
|
||
module.exports = { Preprocessor }; |
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,49 @@ | ||
/* | ||
* wasm-pack doesn't give us correct enough types. | ||
*/ | ||
|
||
|
||
|
||
interface Parsed { | ||
type: 'expression' | 'class-member'; | ||
tagName: 'template'; | ||
contents: string; | ||
range: { | ||
start: number; | ||
end: number; | ||
}; | ||
contentRange: { | ||
start: number; | ||
end: number; | ||
}; | ||
startRange: { | ||
end: number; | ||
start: number; | ||
}; | ||
endRange: { | ||
start: number; | ||
end: number; | ||
}; | ||
} | ||
|
||
|
||
/** | ||
*/ | ||
export class Preprocessor { | ||
free(): void; | ||
/** | ||
*/ | ||
constructor(); | ||
/** | ||
* @param {string} src | ||
* @param {string | undefined} filename | ||
* @returns {string} | ||
*/ | ||
process(src: string, filename?: string): string; | ||
/** | ||
* @param {string} src | ||
* @param {string | undefined} filename | ||
* @returns {any} | ||
*/ | ||
parse(src: string, filename?: string): Parsed; | ||
} |
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,21 @@ | ||
<html> | ||
|
||
<!-- View this file with `npm run web` --> | ||
|
||
<head> | ||
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" /> | ||
<script type="module"> | ||
import {Preprocessor} from 'content-tag'; | ||
|
||
const p = new Preprocessor(); | ||
const output = p.process('<template>Hi from createPreprocessor</template>'); | ||
|
||
document.querySelector('#output').innerHTML = output; | ||
</script> | ||
</head> | ||
|
||
<body> | ||
<pre id="output"></pre> | ||
</body> | ||
|
||
</html> |
Oops, something went wrong.