hexo-offline 0.2.2 → 2.0.1

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/.npmignore DELETED
@@ -1,47 +0,0 @@
1
- # Logs
2
- logs
3
- *.log
4
- npm-debug.log*
5
-
6
- # Runtime data
7
- pids
8
- *.pid
9
- *.seed
10
-
11
- # Directory for instrumented libs generated by jscoverage/JSCover
12
- lib-cov
13
-
14
- # Coverage directory used by tools like istanbul
15
- coverage
16
-
17
- # nyc test coverage
18
- .nyc_output
19
-
20
- # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
21
- .grunt
22
-
23
- # node-waf configuration
24
- .lock-wscript
25
-
26
- # Compiled binary addons (http://nodejs.org/api/addons.html)
27
- build/Release
28
-
29
- # Dependency directories
30
- node_modules
31
- jspm_packages
32
-
33
- # Optional npm cache directory
34
- .npm
35
-
36
- # Optional REPL history
37
- .node_repl_history
38
-
39
- # IntelliJ IDEA
40
- .idea
41
-
42
- # src and test
43
- /src/
44
- /test/
45
-
46
- # appveyor config
47
- /appveyor.yml
package/.nycrc DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "require": [
3
- "babel-register"
4
- ],
5
- "sourceMap": false,
6
- "instrument": false
7
- }
package/.travis.yml DELETED
@@ -1,13 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - "4"
4
- - "6"
5
- - "7"
6
-
7
- cache: yarn
8
- matrix:
9
- fast_finish: true
10
-
11
- after_success:
12
- - yarn add coveralls
13
- - yarn run coverage -- --reporter=text-lcov | ./node_modules/.bin/coveralls
package/.yaspellerrc DELETED
@@ -1,30 +0,0 @@
1
- {
2
- "lang": "en",
3
- "dictionary": [
4
- "appveyor",
5
- "babili",
6
- "CDN",
7
- "env",
8
- "hexo",
9
- "istanbul",
10
- "lockfile",
11
- "precache",
12
- "prepublish",
13
- "prepublishOnly",
14
- "ServiceWorker",
15
- "sw",
16
- "travis",
17
- "yaspeller"
18
- ],
19
- "excludeFiles": [
20
- ".git",
21
- "lib",
22
- "node_modules"
23
- ],
24
- "fileExtensions": [
25
- ".md"
26
- ],
27
- "ignoreText": [
28
- "\\([a-f0-9]+\\)"
29
- ]
30
- }
@@ -1,57 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- var _fs = require('fs');
8
-
9
- var _fs2 = _interopRequireDefault(_fs);
10
-
11
- var _path = require('path');
12
-
13
- var _path2 = _interopRequireDefault(_path);
14
-
15
- var _swPrecache = require('sw-precache');
16
-
17
- var _swPrecache2 = _interopRequireDefault(_swPrecache);
18
-
19
- var _constants = require('./constants');
20
-
21
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
-
23
- var generateSWPrecacheConfig = function generateSWPrecacheConfig(_ref, extraSWPrecacheConfig) {
24
- var root = _ref.root,
25
- public_dir = _ref.public_dir,
26
- logger = _ref.logger;
27
-
28
- var hexoPublicDir = 'public';
29
- var rootPrefix = root.replace(/\/$/, '');
30
- return Object.assign({
31
- logger,
32
- replacePrefix: rootPrefix,
33
- staticFileGlobs: [hexoPublicDir + '/**/*.{js,html,css,png,jpg,gif,svg,eot,ttf,woff}'],
34
- stripPrefix: hexoPublicDir
35
- }, extraSWPrecacheConfig);
36
- };
37
-
38
- var runSWPrecache = function runSWPrecache() {
39
- var public_dir = this.public_dir,
40
- config = this.config,
41
- log = this.log;
42
- var root = config.root,
43
- offline = config.offline;
44
-
45
- // early return when no index.html presets in public directory
46
-
47
- var indexHTMLPath = _path2.default.join(public_dir, 'index.html');
48
- if (!_fs2.default.existsSync(indexHTMLPath)) {
49
- return Promise.resolve();
50
- }
51
-
52
- var SWPrecacheConfig = generateSWPrecacheConfig({ root, public_dir, logger: log.info.bind(log) }, offline);
53
-
54
- return _swPrecache2.default.write(_path2.default.join(public_dir, _constants.workerName), SWPrecacheConfig);
55
- };
56
-
57
- exports.default = runSWPrecache;