@canopycanopycanopy/b-ber-tasks 1.2.12-alpha.5 → 1.2.13-react-reader.5
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.
- package/dist/reader/index.js +4 -2
- package/dist/sass/index.js +27 -11
- package/package.json +15 -13
package/dist/reader/index.js
CHANGED
|
@@ -46,7 +46,8 @@ class Reader {
|
|
|
46
46
|
this.readerModuleName = '@canopycanopycanopy/b-ber-reader';
|
|
47
47
|
this.readerModuleDistDir = 'dist';
|
|
48
48
|
this.readerAppPath = null;
|
|
49
|
-
return this.createOutputDirs().then(() => this.ensureReaderModuleExists()).then(() => this.copyEpubToOutputDir()).then(() => this.writeBookManifest()).then(() => this.writeWebpubManifest()).then(() => this.copyReaderAppToOutputDir()).then(() => this.injectServerDataIntoTemplate())
|
|
49
|
+
return this.createOutputDirs().then(() => this.ensureReaderModuleExists()).then(() => this.copyEpubToOutputDir()).then(() => this.writeBookManifest()).then(() => this.writeWebpubManifest()).then(() => this.copyReaderAppToOutputDir()).then(() => this.injectServerDataIntoTemplate()) // .then(() => this.updateLinkedResourcesWithAbsolutePaths())
|
|
50
|
+
.then(() => this.updateAssetURLsWithAbsolutePaths()).then(() => this.injectWebpubManifestLink()).catch(_bBerLogger.default.error);
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
get remoteURL() {
|
|
@@ -210,7 +211,8 @@ class Reader {
|
|
|
210
211
|
contents = _fsExtra.default.readFileSync(indexHTML, 'utf8');
|
|
211
212
|
contents = contents.replace(/__SERVER_DATA__ = {}/, `__SERVER_DATA__ = ${(0, _stringify.default)(serverData)}`);
|
|
212
213
|
return _fsExtra.default.writeFile(indexHTML, contents);
|
|
213
|
-
}
|
|
214
|
+
} // Update URLs in CSS
|
|
215
|
+
|
|
214
216
|
|
|
215
217
|
updateLinkedResourcesWithAbsolutePaths() {
|
|
216
218
|
const indexContents = _fsExtra.default.readFileSync(_State.default.dist.root('index.html'), 'utf8');
|
package/dist/sass/index.js
CHANGED
|
@@ -145,19 +145,34 @@ const copyThemeAssets = () => {
|
|
|
145
145
|
};
|
|
146
146
|
|
|
147
147
|
function resolveImportedModule(importPath) {
|
|
148
|
-
|
|
148
|
+
// Remove preceeding tilde
|
|
149
|
+
const trimmedImportPath = (0, _slice.default)(importPath).call(importPath, 1); // Get the import path as an array
|
|
150
|
+
|
|
149
151
|
let importTree = trimmedImportPath.split(_path.default.sep); // Remove empty entries caused by leading/trailing slashes
|
|
150
152
|
|
|
151
|
-
importTree = (0, _filter.default)(importTree).call(importTree, Boolean);
|
|
152
|
-
|
|
153
|
-
|
|
153
|
+
importTree = (0, _filter.default)(importTree).call(importTree, Boolean); // Define both the scope and the name - the scope will be
|
|
154
|
+
// used to resolve the import and get the necessary path, the
|
|
155
|
+
// name will be used to construct the final file path
|
|
156
|
+
|
|
157
|
+
let moduleScope = '';
|
|
158
|
+
let moduleName = importTree.shift(); // Allow scoped packages
|
|
159
|
+
|
|
160
|
+
if (moduleName[0] === '@') {
|
|
161
|
+
moduleScope = moduleName;
|
|
162
|
+
moduleName = importTree.shift();
|
|
163
|
+
} // @foo/bar | foo
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
const moduleNameWithScope = _path.default.join(moduleScope, moduleName); // Get the module
|
|
167
|
+
|
|
154
168
|
|
|
155
|
-
const modulePath = require.resolve(
|
|
169
|
+
const modulePath = require.resolve(moduleNameWithScope, {
|
|
156
170
|
paths: [_path.default.join(_path.default.dirname(_State.default.theme.entry))]
|
|
157
171
|
}); // No path was provided, return the imported node module
|
|
158
172
|
|
|
159
173
|
|
|
160
|
-
if (!importTree.length) return modulePath; // User is importing a specific file, find it and return its location
|
|
174
|
+
if (!importTree.length) return modulePath; // User is importing a specific file, find it and return its location. Remove
|
|
175
|
+
// the modules scope from the name when finding the path
|
|
161
176
|
|
|
162
177
|
const moduleIndex = (0, _indexOf.default)(modulePath).call(modulePath, moduleName) + moduleName.length;
|
|
163
178
|
const packagePath = (0, _slice.default)(modulePath).call(modulePath, 0, moduleIndex);
|
|
@@ -169,11 +184,12 @@ function resolveImportedModule(importPath) {
|
|
|
169
184
|
|
|
170
185
|
const renderCSS = scssString => new _promise.default(resolve => _sass.default.render({
|
|
171
186
|
// Importer allows use of '~' to denote node_modules directory in SCSS files
|
|
172
|
-
importer: (url, _file, done) =>
|
|
173
|
-
file
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
187
|
+
importer: (url, _file, done) => {
|
|
188
|
+
const file = url[0] === '~' ? resolveImportedModule(url) : url;
|
|
189
|
+
return done({
|
|
190
|
+
file
|
|
191
|
+
});
|
|
192
|
+
},
|
|
177
193
|
// Add build vars at runtime with the SCSS buffer (which is transformed
|
|
178
194
|
// to string in the backticks)
|
|
179
195
|
data: `$build: "${_State.default.build}";${scssString}`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canopycanopycanopy/b-ber-tasks",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.13-react-reader.5+f56709c6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -19,16 +19,16 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@babel/runtime-corejs3": "^7.10.5",
|
|
22
|
-
"@canopycanopycanopy/b-ber-lib": "1.2.
|
|
23
|
-
"@canopycanopycanopy/b-ber-logger": "1.2.
|
|
24
|
-
"@canopycanopycanopy/b-ber-markdown-renderer": "1.2.
|
|
25
|
-
"@canopycanopycanopy/b-ber-reader": "1.2.
|
|
26
|
-
"@canopycanopycanopy/b-ber-resources": "1.2.
|
|
27
|
-
"@canopycanopycanopy/b-ber-shapes-sequences": "1.2.
|
|
28
|
-
"@canopycanopycanopy/b-ber-templates": "1.2.
|
|
29
|
-
"@canopycanopycanopy/b-ber-validator": "1.2.
|
|
22
|
+
"@canopycanopycanopy/b-ber-lib": "1.2.13-react-reader.5+f56709c6",
|
|
23
|
+
"@canopycanopycanopy/b-ber-logger": "1.2.13-react-reader.5+f56709c6",
|
|
24
|
+
"@canopycanopycanopy/b-ber-markdown-renderer": "1.2.13-react-reader.5+f56709c6",
|
|
25
|
+
"@canopycanopycanopy/b-ber-reader": "1.2.13-react-reader.5+f56709c6",
|
|
26
|
+
"@canopycanopycanopy/b-ber-resources": "1.2.13-react-reader.5+f56709c6",
|
|
27
|
+
"@canopycanopycanopy/b-ber-shapes-sequences": "1.2.13-react-reader.5+f56709c6",
|
|
28
|
+
"@canopycanopycanopy/b-ber-templates": "1.2.13-react-reader.5+f56709c6",
|
|
29
|
+
"@canopycanopycanopy/b-ber-validator": "1.2.13-react-reader.5+f56709c6",
|
|
30
30
|
"autoprefixer": "^9.6.1",
|
|
31
|
-
"browser-sync": "^2.
|
|
31
|
+
"browser-sync": "^2.27.7",
|
|
32
32
|
"bs-html-injector": "^3.0.3",
|
|
33
33
|
"cheerio": "^1.0.0-rc.2",
|
|
34
34
|
"css": "^2.2.1",
|
|
@@ -37,16 +37,18 @@
|
|
|
37
37
|
"glob": "^7.1.4",
|
|
38
38
|
"image-size": "^0.8.3",
|
|
39
39
|
"layouts": "^3.0.2",
|
|
40
|
-
"lodash": "^4.17.
|
|
40
|
+
"lodash": "^4.17.21",
|
|
41
41
|
"lunr": "^2.1.6",
|
|
42
42
|
"postcss": "^7.0.14",
|
|
43
43
|
"pureimage": "^0.1.6",
|
|
44
44
|
"recursive-readdir": "^2.2.2",
|
|
45
45
|
"sass": "^1.49.8",
|
|
46
46
|
"system": "^2.0.1",
|
|
47
|
+
"tar": "^6.1.11",
|
|
47
48
|
"uglify-js": "^3.10.0",
|
|
48
49
|
"vinyl": "^2.2.0",
|
|
49
|
-
"webpage": "^0.3.0"
|
|
50
|
+
"webpage": "^0.3.0",
|
|
51
|
+
"xmlhttprequest-ssl": "^2.0.0"
|
|
50
52
|
},
|
|
51
53
|
"devDependencies": {
|
|
52
54
|
"@babel/cli": "^7.10.5",
|
|
@@ -73,5 +75,5 @@
|
|
|
73
75
|
"url": "https://maxwellsimmer.com"
|
|
74
76
|
}
|
|
75
77
|
],
|
|
76
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "f56709c6bbaa455c0a1f704cf7de19b924ba5b99"
|
|
77
79
|
}
|