Skip to content

Commit 8f5ce5a

Browse files
committed
feat: use shadowOptions in bundler plugins.
1 parent 60b5fe0 commit 8f5ce5a

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed

app-min/src/html.d.ts__if_typescript

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ declare module '*.html' {
33
export const template: string;
44
export default template;
55
export const dependencies: string[];
6+
export const shadowOptions: { mode: 'open' | 'closed'};
67
export function getHTMLOnlyElement();
78
}

dumber/gulpfile.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,15 @@ function buildJs(src) {
107107

108108
function buildHtml(src) {
109109
return gulp.src(src, {since: gulp.lastRun(build)})
110+
// @if shadow-dom-open
111+
.pipe(au2({defaultShadowOptions: {mode: 'open'}}));
112+
// @endif
113+
// @if shadow-dom-closed
114+
.pipe(au2({defaultShadowOptions: {mode: 'closed'}}));
115+
// @endif
116+
// @if !shadow-dom-open && !shadow-dom-closed
110117
.pipe(au2()); // inject aurelia conventions
118+
// @endif
111119
}
112120

113121
function buildCss(src) {

questions.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ module.exports = [
2020
// {value: 'fuse-box', title: 'FuseBox', hint: 'A bundler that does it all, and does it right.'},
2121
]
2222
},
23+
{
24+
message: 'Do you want to use ShadowDOM?',
25+
choices: [
26+
{title: 'No'},
27+
{value: 'shadow-dom-open', title: 'ShadowDOM in open mode', hint: 'Open mode means that you can access the shadow DOM using JavaScript written in the main page context.'},
28+
{value: 'shadow-dom-closed', title: 'ShadowDOM in closed mode', hint: "Closed mode means that you won't be able to access the shadow DOM from the outside."},
29+
]
30+
},
2331
{
2432
message: 'What transpiler would you like to use?',
2533
choices: [

webpack/webpack.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,15 @@ module.exports = function(env, { mode }) {
3535
// @if typescript
3636
{ test: /\.ts$/i, use: ['ts-loader', '@aurelia/webpack-loader'], exclude: /node_modules/ },
3737
// @endif
38+
// @if shadow-dom-open
39+
{ test: /\.html$/i, use: { loader: '@aurelia/webpack-loader', options: { defaultShadowOptions: { mode: 'open' } } }, exclude: /node_modules/ }
40+
// @endif
41+
// @if shadow-dom-closed
42+
{ test: /\.html$/i, use: { loader: '@aurelia/webpack-loader', options: { defaultShadowOptions: { mode: 'closed' } } }, exclude: /node_modules/ }
43+
// @endif
44+
// @if !shadow-dom-open && !shadow-dom-closed
3845
{ test: /\.html$/i, use: '@aurelia/webpack-loader', exclude: /node_modules/ }
46+
// @endif
3947
]
4048
},
4149
plugins: [new HtmlWebpackPlugin({ template: 'index.ejs' })]

0 commit comments

Comments
 (0)