@canopycanopycanopy/b-ber-tasks 1.2.13-react-reader.66 → 1.2.13-react-reader.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/serve/index.js +43 -37
  2. package/package.json +7 -7
@@ -25,8 +25,7 @@ var _browserSync = require("browser-sync");
25
25
  var _ = require("..");
26
26
 
27
27
  const browserSync = (0, _browserSync.create)();
28
- const port = 4000; // getRandomInt(4000, 5000)
29
-
28
+ const port = 4000;
30
29
  const debounceSpeed = 500;
31
30
 
32
31
  const config = build => url => () => {
@@ -50,47 +49,54 @@ let update = async () => {};
50
49
 
51
50
  const reload = () => update().then(browserSync.reload);
52
51
 
53
- const init = build => new _promise.default(resolve => browserSync.init({
54
- port,
55
- open: false,
56
- // Opens browser programatically below
57
- // reloadDelay: 2000
58
- // reloadDebounce: 2000
59
- // reloadThrottle: 2000
60
- server: {
61
- baseDir: _path.default.resolve(`project-${build}`),
62
- middleware: (req, res, next) => {
63
- // Set headers for XHTML files to allow document.write
64
- if (/\.xhtml$/.test(req.url)) {
65
- res.setHeader('Content-Type', 'text/html; charset=UTF-8');
66
- }
67
-
68
- next();
69
- }
70
- },
71
- plugins: [{
72
- module: 'bs-html-injector',
73
- options: {
74
- files: [{
75
- match: [_path.default.resolve('_project', '**', '*.scss'), _path.default.resolve('_project', '**', '*.js'), _path.default.resolve('_project', '**', '*.md')],
76
- fn: (0, _debounce.default)(() => reload(), debounceSpeed, {
77
- leading: false,
78
- trailing: true
79
- })
80
- }]
81
- }
82
- }]
83
- }, resolve));
52
+ const browserSyncPlugins = [{
53
+ module: 'bs-html-injector',
54
+ options: {
55
+ files: [{
56
+ match: [_path.default.resolve('_project', '**', '*.scss'), _path.default.resolve('_project', '**', '*.js'), _path.default.resolve('_project', '**', '*.md')],
57
+ fn: (0, _debounce.default)(() => reload(), debounceSpeed, {
58
+ leading: false,
59
+ trailing: true
60
+ })
61
+ }]
62
+ }
63
+ }];
64
+
65
+ const browserSyncMiddleware = (req, res, next) => {
66
+ // Set headers for XHTML files to allow document.write
67
+ if (/\.xhtml$/.test(req.url)) {
68
+ res.setHeader('Content-Type', 'text/html; charset=UTF-8');
69
+ }
70
+
71
+ next();
72
+ };
73
+
74
+ const init = build => new _promise.default(resolve => {
75
+ const options = {
76
+ port,
77
+ open: false,
78
+ // Opens browser programatically below
79
+ // reloadDelay: 2000
80
+ // reloadDebounce: 2000
81
+ // reloadThrottle: 2000
82
+ server: {
83
+ baseDir: _path.default.resolve(`project-${build}`),
84
+ middleware: browserSyncMiddleware
85
+ },
86
+ plugins: browserSyncPlugins
87
+ };
88
+ browserSync.init(options, resolve);
89
+ });
84
90
 
85
91
  const serve = async ({
86
- build,
92
+ build: buildOption,
87
93
  external
88
94
  }) => {
89
95
  const location = external ? 'external' : 'local';
90
- const build_ = build ?? 'reader';
91
- await init(build_);
96
+ const build = buildOption ?? 'reader';
97
+ await init(build);
92
98
  const url = browserSync.getOption('urls').get(location);
93
- update = config(build_)(url);
99
+ update = config(build)(url);
94
100
  await update(); // Update the location in the config object so that a call can be made
95
101
  // to openBrowser once the project has been built
96
102
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canopycanopycanopy/b-ber-tasks",
3
- "version": "1.2.13-react-reader.66+57a4ee6f",
3
+ "version": "1.2.13-react-reader.67+b2fdc973",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -19,13 +19,13 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@babel/runtime-corejs3": "^7.10.5",
22
- "@canopycanopycanopy/b-ber-lib": "1.2.15",
22
+ "@canopycanopycanopy/b-ber-lib": "1.2.13-react-reader.67+b2fdc973",
23
23
  "@canopycanopycanopy/b-ber-logger": "1.2.12",
24
- "@canopycanopycanopy/b-ber-markdown-renderer": "1.2.15",
25
- "@canopycanopycanopy/b-ber-reader": "1.2.13-react-reader.66+57a4ee6f",
24
+ "@canopycanopycanopy/b-ber-markdown-renderer": "1.2.13-react-reader.67+b2fdc973",
25
+ "@canopycanopycanopy/b-ber-reader": "1.2.15",
26
26
  "@canopycanopycanopy/b-ber-resources": "1.2.12",
27
- "@canopycanopycanopy/b-ber-shapes-sequences": "1.2.12",
28
- "@canopycanopycanopy/b-ber-templates": "1.2.15",
27
+ "@canopycanopycanopy/b-ber-shapes-sequences": "1.2.13-react-reader.67+b2fdc973",
28
+ "@canopycanopycanopy/b-ber-templates": "1.2.13-react-reader.67+b2fdc973",
29
29
  "@canopycanopycanopy/b-ber-validator": "1.2.12",
30
30
  "autoprefixer": "^9.6.1",
31
31
  "browser-sync": "^2.27.7",
@@ -76,5 +76,5 @@
76
76
  "url": "https://maxwellsimmer.com"
77
77
  }
78
78
  ],
79
- "gitHead": "57a4ee6f38dc94abe44b785e0bca505859f04b66"
79
+ "gitHead": "b2fdc9731696088030fca0cb8e6ceaa69338ed14"
80
80
  }