-
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.
Issue #386 [Enhancement][WIP] Add configurators for hook-callback.js …
…and disable-devtools.js
- Loading branch information
Showing
26 changed files
with
12,474 additions
and
3 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
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,19 @@ | ||
/* | ||
@license https://github.com/t2ym/thin-hook/blob/master/LICENSE.md | ||
Copyright (c) 2020 Tetsuya Mori <t2y3141592@gmail.com>. All rights reserved. | ||
*/ | ||
|
||
const targetConfig = { | ||
path: { | ||
root: 'demo', | ||
config: 'demo-config', | ||
backend: 'demo-backend', | ||
frontend: 'demo-frontend', | ||
}, | ||
mode: { | ||
enableDebugging: false, | ||
devtoolsDisabled: true, | ||
}, | ||
}; | ||
|
||
module.exports = targetConfig; |
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* @exclude */ | ||
/* | ||
@license https://github.com/t2ym/thin-hook/blob/master/LICENSE.md | ||
Copyright (c) 2017, 2018, 2019, 2020 Tetsuya Mori <t2y3141592@gmail.com>. All rights reserved. | ||
*/ | ||
/* @endexclude */ | ||
const basePolicyModule /* @echo EQUAL *//* @echo SPACE *//* @extend basePolicyModule.js *//* @endextend */; | ||
Policy.mergePolicyModules( | ||
{ contextNormalizer, acl }, | ||
basePolicyModule, | ||
); |
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,12 @@ | ||
/* @exclude */ | ||
/* | ||
@license https://github.com/t2ym/thin-hook/blob/master/LICENSE.md | ||
Copyright (c) 2017, 2018, 2019, 2020 Tetsuya Mori <t2y3141592@gmail.com>. All rights reserved. | ||
*/ | ||
/* @endexclude */ | ||
const wildcardWhitelist = [ | ||
new RegExp('^at (.* [(])?' + origin + '/components/'), // trust the site contents including other components | ||
new RegExp('^at ([^(]* [(])?' + 'https://cdnjs.cloudflare.com/ajax/libs/vis/4[.]18[.]1/vis[.]min[.]js'), | ||
new RegExp('^at ([^(]* [(])?' + 'https://www.gstatic.com/charts/loader[.]js'), | ||
new RegExp('^at ([^(]* [(])?' + 'https://apis.google.com/js/api[.]js'), | ||
]; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
@license https://github.com/t2ym/thin-hook/blob/master/LICENSE.md | ||
Copyright (c) 2020, Tetsuya Mori <t2y3141592@gmail.com>. All rights reserved. | ||
*/ | ||
const path = require('path'); | ||
const { preprocess } = require('preprocess'); | ||
const through = require('through2'); | ||
const gulp = require('gulp'); | ||
|
||
const configurator = (configPath, destPath, { | ||
sourceFile = 'disable-devtools.js', | ||
devtoolsDisabled = 'true', | ||
} = {}) => | ||
() => gulp.src([ path.resolve(__dirname, sourceFile) ]) | ||
// 1st pass | ||
.pipe(through.obj((file, enc, callback) => { | ||
let script = String(file.contents); | ||
script = preprocess(script, | ||
{ | ||
SPACE: ' ', | ||
EQUAL: '=', | ||
SEMICOLON: ';', | ||
devtoolsDisabled: typeof devtoolsDisabled === 'undefined' ? 'true' : devtoolsDisabled, | ||
}, | ||
{ | ||
type: 'js', | ||
srcDir: __dirname, // in plugin/disable-devtools/ | ||
} | ||
); | ||
script = script.replace(/\/\* #include /g, '/* @include '); | ||
file.contents = Buffer.from(script); | ||
callback(null, file); | ||
})) | ||
/* | ||
// 2nd pass | ||
.pipe(through.obj((file, enc, callback) => { | ||
let script = String(file.contents); | ||
script = preprocess(script, | ||
{ | ||
SPACE: ' ', | ||
EQUAL: '=', | ||
SEMICOLON: ';', | ||
}, | ||
{ | ||
type: 'js', | ||
srcDir: configPath, // in demo-config/disable-devtools/ ; Note: unused | ||
} | ||
); | ||
file.contents = Buffer.from(script); | ||
callback(null, file); | ||
})) | ||
*/ | ||
.pipe(gulp.dest(destPath)); | ||
|
||
module.exports = { | ||
configurator, | ||
}; |
Oops, something went wrong.