first commit
This commit is contained in:
7
node_modules/hexo/LICENSE
generated
vendored
Normal file
7
node_modules/hexo/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
Copyright (c) 2012-present Tommy Chen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
102
node_modules/hexo/README.md
generated
vendored
Normal file
102
node_modules/hexo/README.md
generated
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
<img src="https://raw.githubusercontent.com/hexojs/logo/master/hexo-logo-avatar.png" alt="Hexo logo" width="100" height="100" align="right" />
|
||||
|
||||
# Hexo
|
||||
|
||||
> A fast, simple & powerful blog framework, powered by [Node.js](https://nodejs.org).
|
||||
|
||||
[Website](https://hexo.io) |
|
||||
[Documentation](https://hexo.io/docs/) |
|
||||
[Installation Guide](https://hexo.io/docs/#Installation) |
|
||||
[Contribution Guide](https://hexo.io/docs/contributing) |
|
||||
[Code of Conduct](CODE_OF_CONDUCT.md) |
|
||||
[API](https://hexo.io/api/) |
|
||||
[Twitter](https://twitter.com/hexojs)
|
||||
|
||||
[](https://www.npmjs.com/package/hexo)
|
||||

|
||||
[](https://github.com/hexojs/hexo/actions?query=workflow%3ATester)
|
||||
[](https://libraries.io/npm/hexo)
|
||||
[](https://coveralls.io/r/hexojs/hexo?branch=master)
|
||||
[](https://gitter.im/hexojs/hexo)
|
||||
[](https://discord.gg/teM2Anj)
|
||||
[](https://t.me/hexojs)
|
||||
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fhexojs%2Fhexo?ref=badge_shield)
|
||||
[](CODE_OF_CONDUCT.md)
|
||||
|
||||
## Features
|
||||
|
||||
- Blazing fast generating
|
||||
- Support for GitHub Flavored Markdown and most Octopress plugins
|
||||
- One-command deploy to GitHub Pages, Heroku, etc.
|
||||
- Powerful API for limitless extensibility
|
||||
- Hundreds of [themes](https://hexo.io/themes/) & [plugins](https://hexo.io/plugins/)
|
||||
|
||||
## Quick Start
|
||||
|
||||
**Install Hexo**
|
||||
|
||||
``` bash
|
||||
$ npm install hexo-cli -g
|
||||
```
|
||||
|
||||
Install with [brew](https://brew.sh/) on macOS and Linux:
|
||||
|
||||
```bash
|
||||
$ brew install hexo
|
||||
```
|
||||
|
||||
**Setup your blog**
|
||||
|
||||
``` bash
|
||||
$ hexo init blog
|
||||
$ cd blog
|
||||
```
|
||||
|
||||
**Start the server**
|
||||
|
||||
``` bash
|
||||
$ hexo server
|
||||
```
|
||||
|
||||
**Create a new post**
|
||||
|
||||
``` bash
|
||||
$ hexo new "Hello Hexo"
|
||||
```
|
||||
|
||||
**Generate static files**
|
||||
|
||||
``` bash
|
||||
$ hexo generate
|
||||
```
|
||||
|
||||
## More Information
|
||||
|
||||
- Read the [documentation](https://hexo.io/)
|
||||
- Visit the [Awesome Hexo](https://github.com/hexojs/awesome-hexo) list
|
||||
- Find solutions in [troubleshooting](https://hexo.io/docs/troubleshooting.html)
|
||||
- Join discussion on [Google Group](https://groups.google.com/group/hexo), [Discord](https://discord.gg/teM2Anj), [Gitter](https://gitter.im/hexojs/hexo) or [Telegram](https://t.me/hexojs)
|
||||
- See the [plugin list](https://hexo.io/plugins/) and the [theme list](https://hexo.io/themes/) on wiki
|
||||
- Follow [@hexojs](https://twitter.com/hexojs) for latest news
|
||||
|
||||
## Contributing
|
||||
|
||||
We welcome you to join the development of Hexo. Please see [contributing document](https://hexo.io/docs/contributing). 🤗
|
||||
|
||||
Also, we welcome PR or issue to [official-plugins](https://github.com/hexojs).
|
||||
|
||||
## Contributors
|
||||
|
||||
[](https://github.com/hexojs/hexo/graphs/contributors)
|
||||
|
||||
## Backers
|
||||
|
||||
[](https://opencollective.com/hexo)
|
||||
|
||||
## Sponsors
|
||||
|
||||
[](https://opencollective.com/hexo)
|
||||
|
||||
## License
|
||||
|
||||
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fhexojs%2Fhexo?ref=badge_large)
|
||||
5
node_modules/hexo/bin/hexo
generated
vendored
Executable file
5
node_modules/hexo/bin/hexo
generated
vendored
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
require('hexo-cli')();
|
||||
25
node_modules/hexo/dist/box/file.d.ts
generated
vendored
Normal file
25
node_modules/hexo/dist/box/file.d.ts
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/// <reference types="node" />
|
||||
import type Promise from 'bluebird';
|
||||
import { type ReadFileOptions } from 'hexo-fs';
|
||||
import type fs from 'fs';
|
||||
declare class File {
|
||||
source: string;
|
||||
path: string;
|
||||
params: any;
|
||||
type: string;
|
||||
static TYPE_CREATE: 'create';
|
||||
static TYPE_UPDATE: 'update';
|
||||
static TYPE_SKIP: 'skip';
|
||||
static TYPE_DELETE: 'delete';
|
||||
constructor({ source, path, params, type }: {
|
||||
source: any;
|
||||
path: any;
|
||||
params: any;
|
||||
type: any;
|
||||
});
|
||||
read(options?: ReadFileOptions): Promise<string>;
|
||||
readSync(options?: ReadFileOptions): string;
|
||||
stat(): Promise<fs.Stats>;
|
||||
statSync(): fs.Stats;
|
||||
}
|
||||
export = File;
|
||||
28
node_modules/hexo/dist/box/file.js
generated
vendored
Normal file
28
node_modules/hexo/dist/box/file.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
const hexo_fs_1 = require("hexo-fs");
|
||||
class File {
|
||||
constructor({ source, path, params, type }) {
|
||||
this.source = source;
|
||||
this.path = path;
|
||||
this.params = params;
|
||||
this.type = type;
|
||||
}
|
||||
read(options) {
|
||||
return (0, hexo_fs_1.readFile)(this.source, options);
|
||||
}
|
||||
readSync(options) {
|
||||
return (0, hexo_fs_1.readFileSync)(this.source, options);
|
||||
}
|
||||
stat() {
|
||||
return (0, hexo_fs_1.stat)(this.source);
|
||||
}
|
||||
statSync() {
|
||||
return (0, hexo_fs_1.statSync)(this.source);
|
||||
}
|
||||
}
|
||||
File.TYPE_CREATE = 'create';
|
||||
File.TYPE_UPDATE = 'update';
|
||||
File.TYPE_SKIP = 'skip';
|
||||
File.TYPE_DELETE = 'delete';
|
||||
module.exports = File;
|
||||
//# sourceMappingURL=file.js.map
|
||||
1
node_modules/hexo/dist/box/file.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/box/file.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../lib/box/file.ts"],"names":[],"mappings":";AACA,qCAAuF;AAGvF,MAAM,IAAI;IAUR,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;QACxC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,IAAI,CAAC,OAAyB;QAC5B,OAAO,IAAA,kBAAQ,EAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAoB,CAAC;IAC3D,CAAC;IAED,QAAQ,CAAC,OAAyB;QAChC,OAAO,IAAA,sBAAY,EAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAW,CAAC;IACtD,CAAC;IAED,IAAI;QACF,OAAO,IAAA,cAAI,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAED,QAAQ;QACN,OAAO,IAAA,kBAAQ,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;CACF;AAED,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC;AAC5B,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC;AAC5B,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC;AACxB,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC;AAE5B,iBAAS,IAAI,CAAC"}
|
||||
64
node_modules/hexo/dist/box/index.d.ts
generated
vendored
Normal file
64
node_modules/hexo/dist/box/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import BlueBirdPromise from 'bluebird';
|
||||
import File from './file';
|
||||
import { Pattern } from 'hexo-util';
|
||||
import { EventEmitter } from 'events';
|
||||
import type Hexo from '../hexo';
|
||||
import type { NodeJSLikeCallback } from '../types';
|
||||
interface Processor {
|
||||
pattern: Pattern;
|
||||
process: (file?: File) => any;
|
||||
}
|
||||
declare class Box extends EventEmitter {
|
||||
options: any;
|
||||
context: Hexo;
|
||||
base: string;
|
||||
processors: Processor[];
|
||||
_processingFiles: any;
|
||||
watcher: any;
|
||||
Cache: any;
|
||||
File: any;
|
||||
ignore: any[];
|
||||
source: any;
|
||||
constructor(ctx: Hexo, base: string, options?: object);
|
||||
_createFileClass(): {
|
||||
new ({ source, path, params, type }: {
|
||||
source: any;
|
||||
path: any;
|
||||
params: any;
|
||||
type: any;
|
||||
}): {
|
||||
box: Box;
|
||||
render(options?: object): BlueBirdPromise<any>;
|
||||
renderSync(options?: object): any;
|
||||
source: string;
|
||||
path: string;
|
||||
params: any;
|
||||
type: string;
|
||||
read(options?: import("hexo-fs").ReadFileOptions): BlueBirdPromise<string>;
|
||||
readSync(options?: import("hexo-fs").ReadFileOptions): string;
|
||||
stat(): BlueBirdPromise<import("fs").Stats>;
|
||||
statSync(): import("fs").Stats;
|
||||
};
|
||||
TYPE_CREATE: "create";
|
||||
TYPE_UPDATE: "update";
|
||||
TYPE_SKIP: "skip";
|
||||
TYPE_DELETE: "delete";
|
||||
};
|
||||
addProcessor(pattern: (...args: any[]) => any): void;
|
||||
addProcessor(pattern: string | RegExp | Pattern | ((...args: any[]) => any), fn: (...args: any[]) => any): void;
|
||||
_readDir(base: string, prefix?: string): BlueBirdPromise<any>;
|
||||
_checkFileStatus(path: string): any;
|
||||
process(callback?: NodeJSLikeCallback<any>): BlueBirdPromise<any>;
|
||||
_processFile(type: string, path: string): BlueBirdPromise<void> | BlueBirdPromise<string>;
|
||||
watch(callback?: NodeJSLikeCallback<never>): BlueBirdPromise<void>;
|
||||
unwatch(): void;
|
||||
isWatching(): boolean;
|
||||
}
|
||||
export interface _File extends File {
|
||||
box: Box;
|
||||
render(options?: any): any;
|
||||
renderSync(options?: any): any;
|
||||
}
|
||||
export default Box;
|
||||
239
node_modules/hexo/dist/box/index.js
generated
vendored
Normal file
239
node_modules/hexo/dist/box/index.js
generated
vendored
Normal file
@@ -0,0 +1,239 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path_1 = require("path");
|
||||
const bluebird_1 = __importDefault(require("bluebird"));
|
||||
const file_1 = __importDefault(require("./file"));
|
||||
const hexo_util_1 = require("hexo-util");
|
||||
const hexo_fs_1 = require("hexo-fs");
|
||||
const picocolors_1 = require("picocolors");
|
||||
const events_1 = require("events");
|
||||
const micromatch_1 = require("micromatch");
|
||||
const defaultPattern = new hexo_util_1.Pattern(() => ({}));
|
||||
class Box extends events_1.EventEmitter {
|
||||
constructor(ctx, base, options) {
|
||||
super();
|
||||
this.options = Object.assign({
|
||||
persistent: true,
|
||||
awaitWriteFinish: {
|
||||
stabilityThreshold: 200
|
||||
}
|
||||
}, options);
|
||||
if (!base.endsWith(path_1.sep)) {
|
||||
base += path_1.sep;
|
||||
}
|
||||
this.context = ctx;
|
||||
this.base = base;
|
||||
this.processors = [];
|
||||
this._processingFiles = {};
|
||||
this.watcher = null;
|
||||
this.Cache = ctx.model('Cache');
|
||||
this.File = this._createFileClass();
|
||||
let targets = this.options.ignored || [];
|
||||
if (ctx.config.ignore && ctx.config.ignore.length) {
|
||||
targets = targets.concat(ctx.config.ignore);
|
||||
}
|
||||
this.ignore = targets;
|
||||
this.options.ignored = targets.map(s => toRegExp(ctx, s)).filter(x => x);
|
||||
}
|
||||
_createFileClass() {
|
||||
const ctx = this.context;
|
||||
class _File extends file_1.default {
|
||||
render(options) {
|
||||
return ctx.render.render({
|
||||
path: this.source
|
||||
}, options);
|
||||
}
|
||||
renderSync(options) {
|
||||
return ctx.render.renderSync({
|
||||
path: this.source
|
||||
}, options);
|
||||
}
|
||||
}
|
||||
_File.prototype.box = this;
|
||||
return _File;
|
||||
}
|
||||
addProcessor(pattern, fn) {
|
||||
if (!fn && typeof pattern === 'function') {
|
||||
fn = pattern;
|
||||
pattern = defaultPattern;
|
||||
}
|
||||
if (typeof fn !== 'function')
|
||||
throw new TypeError('fn must be a function');
|
||||
if (!(pattern instanceof hexo_util_1.Pattern))
|
||||
pattern = new hexo_util_1.Pattern(pattern);
|
||||
this.processors.push({
|
||||
pattern,
|
||||
process: fn
|
||||
});
|
||||
}
|
||||
_readDir(base, prefix = '') {
|
||||
const { context: ctx } = this;
|
||||
const results = [];
|
||||
return readDirWalker(ctx, base, results, this.ignore, prefix)
|
||||
.return(results)
|
||||
.map(path => this._checkFileStatus(path))
|
||||
.map(file => this._processFile(file.type, file.path).return(file.path));
|
||||
}
|
||||
_checkFileStatus(path) {
|
||||
const { Cache, context: ctx } = this;
|
||||
const src = (0, path_1.join)(this.base, path);
|
||||
return Cache.compareFile(escapeBackslash(src.substring(ctx.base_dir.length)), () => getHash(src), () => (0, hexo_fs_1.stat)(src)).then(result => ({
|
||||
type: result.type,
|
||||
path
|
||||
}));
|
||||
}
|
||||
process(callback) {
|
||||
const { base, Cache, context: ctx } = this;
|
||||
return (0, hexo_fs_1.stat)(base).then(stats => {
|
||||
if (!stats.isDirectory())
|
||||
return;
|
||||
// Check existing files in cache
|
||||
const relativeBase = escapeBackslash(base.substring(ctx.base_dir.length));
|
||||
const cacheFiles = Cache.filter(item => item._id.startsWith(relativeBase)).map(item => item._id.substring(relativeBase.length));
|
||||
// Handle deleted files
|
||||
return this._readDir(base)
|
||||
.then((files) => cacheFiles.filter((path) => !files.includes(path)))
|
||||
.map((path) => this._processFile(file_1.default.TYPE_DELETE, path));
|
||||
}).catch(err => {
|
||||
if (err && err.code !== 'ENOENT')
|
||||
throw err;
|
||||
}).asCallback(callback);
|
||||
}
|
||||
_processFile(type, path) {
|
||||
if (this._processingFiles[path]) {
|
||||
return bluebird_1.default.resolve();
|
||||
}
|
||||
this._processingFiles[path] = true;
|
||||
const { base, File, context: ctx } = this;
|
||||
this.emit('processBefore', {
|
||||
type,
|
||||
path
|
||||
});
|
||||
return bluebird_1.default.reduce(this.processors, (count, processor) => {
|
||||
const params = processor.pattern.match(path);
|
||||
if (!params)
|
||||
return count;
|
||||
const file = new File({
|
||||
// source is used for filesystem path, keep backslashes on Windows
|
||||
source: (0, path_1.join)(base, path),
|
||||
// path is used for URL path, replace backslashes on Windows
|
||||
path: escapeBackslash(path),
|
||||
params,
|
||||
type
|
||||
});
|
||||
return Reflect.apply(bluebird_1.default.method(processor.process), ctx, [file])
|
||||
.thenReturn(count + 1);
|
||||
}, 0).then(count => {
|
||||
if (count) {
|
||||
ctx.log.debug('Processed: %s', (0, picocolors_1.magenta)(path));
|
||||
}
|
||||
this.emit('processAfter', {
|
||||
type,
|
||||
path
|
||||
});
|
||||
}).catch(err => {
|
||||
ctx.log.error({ err }, 'Process failed: %s', (0, picocolors_1.magenta)(path));
|
||||
}).finally(() => {
|
||||
this._processingFiles[path] = false;
|
||||
}).thenReturn(path);
|
||||
}
|
||||
watch(callback) {
|
||||
if (this.isWatching()) {
|
||||
return bluebird_1.default.reject(new Error('Watcher has already started.')).asCallback(callback);
|
||||
}
|
||||
const { base } = this;
|
||||
function getPath(path) {
|
||||
return escapeBackslash(path.substring(base.length));
|
||||
}
|
||||
return this.process().then(() => (0, hexo_fs_1.watch)(base, this.options)).then(watcher => {
|
||||
this.watcher = watcher;
|
||||
watcher.on('add', path => {
|
||||
this._processFile(file_1.default.TYPE_CREATE, getPath(path));
|
||||
});
|
||||
watcher.on('change', path => {
|
||||
this._processFile(file_1.default.TYPE_UPDATE, getPath(path));
|
||||
});
|
||||
watcher.on('unlink', path => {
|
||||
this._processFile(file_1.default.TYPE_DELETE, getPath(path));
|
||||
});
|
||||
watcher.on('addDir', path => {
|
||||
let prefix = getPath(path);
|
||||
if (prefix)
|
||||
prefix += '/';
|
||||
this._readDir(path, prefix);
|
||||
});
|
||||
}).asCallback(callback);
|
||||
}
|
||||
unwatch() {
|
||||
if (!this.isWatching())
|
||||
return;
|
||||
this.watcher.close();
|
||||
this.watcher = null;
|
||||
}
|
||||
isWatching() {
|
||||
return Boolean(this.watcher);
|
||||
}
|
||||
}
|
||||
function escapeBackslash(path) {
|
||||
// Replace backslashes on Windows
|
||||
return path.replace(/\\/g, '/');
|
||||
}
|
||||
function getHash(path) {
|
||||
const src = (0, hexo_fs_1.createReadStream)(path);
|
||||
const hasher = (0, hexo_util_1.createSha1Hash)();
|
||||
const finishedPromise = new bluebird_1.default((resolve, reject) => {
|
||||
src.once('error', reject);
|
||||
src.once('end', resolve);
|
||||
});
|
||||
src.on('data', chunk => { hasher.update(chunk); });
|
||||
return finishedPromise.then(() => hasher.digest('hex'));
|
||||
}
|
||||
function toRegExp(ctx, arg) {
|
||||
if (!arg)
|
||||
return null;
|
||||
if (typeof arg !== 'string') {
|
||||
ctx.log.warn('A value of "ignore:" section in "_config.yml" is not invalid (not a string)');
|
||||
return null;
|
||||
}
|
||||
const result = (0, micromatch_1.makeRe)(arg);
|
||||
if (!result) {
|
||||
ctx.log.warn('A value of "ignore:" section in "_config.yml" can not be converted to RegExp:' + arg);
|
||||
return null;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function isIgnoreMatch(path, ignore) {
|
||||
return path && ignore && ignore.length && (0, micromatch_1.isMatch)(path, ignore);
|
||||
}
|
||||
function readDirWalker(ctx, base, results, ignore, prefix) {
|
||||
if (isIgnoreMatch(base, ignore))
|
||||
return bluebird_1.default.resolve();
|
||||
return bluebird_1.default.map((0, hexo_fs_1.readdir)(base).catch(err => {
|
||||
ctx.log.error({ err }, 'Failed to read directory: %s', base);
|
||||
if (err && err.code === 'ENOENT')
|
||||
return [];
|
||||
throw err;
|
||||
}), async (path) => {
|
||||
const fullpath = (0, path_1.join)(base, path);
|
||||
const stats = await (0, hexo_fs_1.stat)(fullpath).catch(err => {
|
||||
ctx.log.error({ err }, 'Failed to stat file: %s', fullpath);
|
||||
if (err && err.code === 'ENOENT')
|
||||
return null;
|
||||
throw err;
|
||||
});
|
||||
const prefixPath = `${prefix}${path}`;
|
||||
if (stats) {
|
||||
if (stats.isDirectory()) {
|
||||
return readDirWalker(ctx, fullpath, results, ignore, `${prefixPath}/`);
|
||||
}
|
||||
if (!isIgnoreMatch(fullpath, ignore)) {
|
||||
results.push(prefixPath);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.default = Box;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/hexo/dist/box/index.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/box/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
53
node_modules/hexo/dist/extend/console.d.ts
generated
vendored
Normal file
53
node_modules/hexo/dist/extend/console.d.ts
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
import type { NodeJSLikeCallback } from '../types';
|
||||
type Option = Partial<{
|
||||
usage: string;
|
||||
desc: string;
|
||||
init: boolean;
|
||||
arguments: {
|
||||
name: string;
|
||||
desc: string;
|
||||
}[];
|
||||
options: {
|
||||
name: string;
|
||||
desc: string;
|
||||
}[];
|
||||
}>;
|
||||
interface Args {
|
||||
_: string[];
|
||||
[key: string]: string | boolean | string[];
|
||||
}
|
||||
type AnyFn = (args: Args, callback?: NodeJSLikeCallback<any>) => any;
|
||||
interface StoreFunction extends AnyFn {
|
||||
desc?: string;
|
||||
options?: Option;
|
||||
}
|
||||
interface Store {
|
||||
[key: string]: StoreFunction;
|
||||
}
|
||||
interface Alias {
|
||||
[abbreviation: string]: string;
|
||||
}
|
||||
declare class Console {
|
||||
store: Store;
|
||||
alias: Alias;
|
||||
constructor();
|
||||
/**
|
||||
* Get a console plugin function by name
|
||||
* @param {String} name - The name of the console plugin
|
||||
* @returns {StoreFunction} - The console plugin function
|
||||
*/
|
||||
get(name: string): StoreFunction;
|
||||
list(): Store;
|
||||
/**
|
||||
* Register a console plugin
|
||||
* @param {String} name - The name of console plugin to be registered
|
||||
* @param {String} desc - More detailed information about a console command
|
||||
* @param {Option} options - The description of each option of a console command
|
||||
* @param {AnyFn} fn - The console plugin to be registered
|
||||
*/
|
||||
register(name: string, fn: AnyFn): void;
|
||||
register(name: string, desc: string, fn: AnyFn): void;
|
||||
register(name: string, options: Option, fn: AnyFn): void;
|
||||
register(name: string, desc: string, options: Option, fn: AnyFn): void;
|
||||
}
|
||||
export = Console;
|
||||
69
node_modules/hexo/dist/extend/console.js
generated
vendored
Normal file
69
node_modules/hexo/dist/extend/console.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
const bluebird_1 = __importDefault(require("bluebird"));
|
||||
const abbrev_1 = __importDefault(require("abbrev"));
|
||||
class Console {
|
||||
constructor() {
|
||||
this.store = {};
|
||||
this.alias = {};
|
||||
}
|
||||
/**
|
||||
* Get a console plugin function by name
|
||||
* @param {String} name - The name of the console plugin
|
||||
* @returns {StoreFunction} - The console plugin function
|
||||
*/
|
||||
get(name) {
|
||||
name = name.toLowerCase();
|
||||
return this.store[this.alias[name]];
|
||||
}
|
||||
list() {
|
||||
return this.store;
|
||||
}
|
||||
register(name, desc, options, fn) {
|
||||
if (!name)
|
||||
throw new TypeError('name is required');
|
||||
if (!fn) {
|
||||
if (options) {
|
||||
if (typeof options === 'function') {
|
||||
fn = options;
|
||||
if (typeof desc === 'object') { // name, options, fn
|
||||
options = desc;
|
||||
desc = '';
|
||||
}
|
||||
else { // name, desc, fn
|
||||
options = {};
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new TypeError('fn must be a function');
|
||||
}
|
||||
}
|
||||
else {
|
||||
// name, fn
|
||||
if (typeof desc === 'function') {
|
||||
fn = desc;
|
||||
options = {};
|
||||
desc = '';
|
||||
}
|
||||
else {
|
||||
throw new TypeError('fn must be a function');
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fn.length > 1) {
|
||||
fn = bluebird_1.default.promisify(fn);
|
||||
}
|
||||
else {
|
||||
fn = bluebird_1.default.method(fn);
|
||||
}
|
||||
const c = fn;
|
||||
this.store[name.toLowerCase()] = c;
|
||||
c.options = options;
|
||||
c.desc = desc;
|
||||
this.alias = (0, abbrev_1.default)(Object.keys(this.store));
|
||||
}
|
||||
}
|
||||
module.exports = Console;
|
||||
//# sourceMappingURL=console.js.map
|
||||
1
node_modules/hexo/dist/extend/console.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/extend/console.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"console.js","sourceRoot":"","sources":["../../lib/extend/console.ts"],"names":[],"mappings":";;;;AAAA,wDAA+B;AAC/B,oDAA4B;AAkC5B,MAAM,OAAO;IAIX;QACE,IAAI,CAAC,KAAK,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E,CAAC;YAClB,EAAE,GAAG,kBAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QAC7B,CAAC;aAAM,CAAC;YACN,EAAE,GAAG,kBAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC1B,CAAC;QAED,MAAM,CAAC,GAAG,EAAmB,CAAC;QAC9B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC;QACnC,CAAC,CAAC,OAAO,GAAG,OAAiB,CAAC;QAC9B,CAAC,CAAC,IAAI,GAAG,IAAc,CAAC;QAExB,IAAI,CAAC,KAAK,GAAG,IAAA,gBAAM,EAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/C,CAAC;CACF;AAED,iBAAS,OAAO,CAAC"}
|
||||
18
node_modules/hexo/dist/extend/deployer.d.ts
generated
vendored
Normal file
18
node_modules/hexo/dist/extend/deployer.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import type { NodeJSLikeCallback } from '../types';
|
||||
interface StoreFunction {
|
||||
(deployArg: {
|
||||
type: string;
|
||||
[key: string]: any;
|
||||
}, callback?: NodeJSLikeCallback<any>): any;
|
||||
}
|
||||
interface Store {
|
||||
[key: string]: StoreFunction;
|
||||
}
|
||||
declare class Deployer {
|
||||
store: Store;
|
||||
constructor();
|
||||
list(): Store;
|
||||
get(name: string): StoreFunction;
|
||||
register(name: string, fn: StoreFunction): void;
|
||||
}
|
||||
export = Deployer;
|
||||
31
node_modules/hexo/dist/extend/deployer.js
generated
vendored
Normal file
31
node_modules/hexo/dist/extend/deployer.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
const bluebird_1 = __importDefault(require("bluebird"));
|
||||
class Deployer {
|
||||
constructor() {
|
||||
this.store = {};
|
||||
}
|
||||
list() {
|
||||
return this.store;
|
||||
}
|
||||
get(name) {
|
||||
return this.store[name];
|
||||
}
|
||||
register(name, fn) {
|
||||
if (!name)
|
||||
throw new TypeError('name is required');
|
||||
if (typeof fn !== 'function')
|
||||
throw new TypeError('fn must be a function');
|
||||
if (fn.length > 1) {
|
||||
fn = bluebird_1.default.promisify(fn);
|
||||
}
|
||||
else {
|
||||
fn = bluebird_1.default.method(fn);
|
||||
}
|
||||
this.store[name] = fn;
|
||||
}
|
||||
}
|
||||
module.exports = Deployer;
|
||||
//# sourceMappingURL=deployer.js.map
|
||||
1
node_modules/hexo/dist/extend/deployer.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/extend/deployer.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"deployer.js","sourceRoot":"","sources":["../../lib/extend/deployer.ts"],"names":[],"mappings":";;;;AAAA,wDAA+B;AAa/B,MAAM,QAAQ;IAGZ;QACE,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAClB,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,QAAQ,CAAC,IAAY,EAAE,EAAiB;QACtC,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,SAAS,CAAC,kBAAkB,CAAC,CAAC;QACnD,IAAI,OAAO,EAAE,KAAK,UAAU;YAAE,MAAM,IAAI,SAAS,CAAC,uBAAuB,CAAC,CAAC;QAE3E,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClB,EAAE,GAAG,kBAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QAC7B,CAAC;aAAM,CAAC;YACN,EAAE,GAAG,kBAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC1B,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;IACxB,CAAC;CACF;AAED,iBAAS,QAAQ,CAAC"}
|
||||
26
node_modules/hexo/dist/extend/filter.d.ts
generated
vendored
Normal file
26
node_modules/hexo/dist/extend/filter.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import Promise from 'bluebird';
|
||||
interface FilterOptions {
|
||||
context?: any;
|
||||
args?: any[];
|
||||
}
|
||||
interface StoreFunction {
|
||||
(data?: any, ...args: any[]): any;
|
||||
priority?: number;
|
||||
}
|
||||
interface Store {
|
||||
[key: string]: StoreFunction[];
|
||||
}
|
||||
declare class Filter {
|
||||
store: Store;
|
||||
constructor();
|
||||
list(): Store;
|
||||
list(type: string): StoreFunction[];
|
||||
register(fn: StoreFunction): void;
|
||||
register(fn: StoreFunction, priority: number): void;
|
||||
register(type: string, fn: StoreFunction): void;
|
||||
register(type: string, fn: StoreFunction, priority: number): void;
|
||||
unregister(type: string, fn: StoreFunction): void;
|
||||
exec(type: string, data: any, options?: FilterOptions): Promise<any>;
|
||||
execSync(type: string, data: any, options?: FilterOptions): any;
|
||||
}
|
||||
export = Filter;
|
||||
79
node_modules/hexo/dist/extend/filter.js
generated
vendored
Normal file
79
node_modules/hexo/dist/extend/filter.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
const bluebird_1 = __importDefault(require("bluebird"));
|
||||
const typeAlias = {
|
||||
pre: 'before_post_render',
|
||||
post: 'after_post_render',
|
||||
'after_render:html': '_after_html_render'
|
||||
};
|
||||
class Filter {
|
||||
constructor() {
|
||||
this.store = {};
|
||||
}
|
||||
list(type) {
|
||||
if (!type)
|
||||
return this.store;
|
||||
return this.store[type] || [];
|
||||
}
|
||||
register(type, fn, priority) {
|
||||
if (!priority) {
|
||||
if (typeof type === 'function') {
|
||||
priority = fn;
|
||||
fn = type;
|
||||
type = 'after_post_render';
|
||||
}
|
||||
}
|
||||
if (typeof fn !== 'function')
|
||||
throw new TypeError('fn must be a function');
|
||||
type = typeAlias[type] || type;
|
||||
priority = priority == null ? 10 : priority;
|
||||
const store = this.store[type] || [];
|
||||
this.store[type] = store;
|
||||
fn.priority = priority;
|
||||
store.push(fn);
|
||||
store.sort((a, b) => a.priority - b.priority);
|
||||
}
|
||||
unregister(type, fn) {
|
||||
if (!type)
|
||||
throw new TypeError('type is required');
|
||||
if (typeof fn !== 'function')
|
||||
throw new TypeError('fn must be a function');
|
||||
type = typeAlias[type] || type;
|
||||
const list = this.list(type);
|
||||
if (!list || !list.length)
|
||||
return;
|
||||
const index = list.indexOf(fn);
|
||||
if (index !== -1)
|
||||
list.splice(index, 1);
|
||||
}
|
||||
exec(type, data, options = {}) {
|
||||
const filters = this.list(type);
|
||||
if (filters.length === 0)
|
||||
return bluebird_1.default.resolve(data);
|
||||
const ctx = options.context;
|
||||
const args = options.args || [];
|
||||
args.unshift(data);
|
||||
return bluebird_1.default.each(filters, filter => Reflect.apply(bluebird_1.default.method(filter), ctx, args).then(result => {
|
||||
args[0] = result == null ? args[0] : result;
|
||||
return args[0];
|
||||
})).then(() => args[0]);
|
||||
}
|
||||
execSync(type, data, options = {}) {
|
||||
const filters = this.list(type);
|
||||
const filtersLen = filters.length;
|
||||
if (filtersLen === 0)
|
||||
return data;
|
||||
const ctx = options.context;
|
||||
const args = options.args || [];
|
||||
args.unshift(data);
|
||||
for (let i = 0, len = filtersLen; i < len; i++) {
|
||||
const result = Reflect.apply(filters[i], ctx, args);
|
||||
args[0] = result == null ? args[0] : result;
|
||||
}
|
||||
return args[0];
|
||||
}
|
||||
}
|
||||
module.exports = Filter;
|
||||
//# sourceMappingURL=filter.js.map
|
||||
1
node_modules/hexo/dist/extend/filter.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/extend/filter.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{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||||
import Promise from 'bluebird';
|
||||
import type { NodeJSLikeCallback } from '../types';
|
||||
interface BaseObj {
|
||||
path: string;
|
||||
data?: any;
|
||||
layout?: string | string[];
|
||||
}
|
||||
type ReturnType = BaseObj | BaseObj[];
|
||||
type GeneratorReturnType = ReturnType | Promise<ReturnType>;
|
||||
interface GeneratorFunction {
|
||||
(locals: any, callback?: NodeJSLikeCallback<any>): GeneratorReturnType;
|
||||
}
|
||||
type StoreFunctionReturn = Promise<ReturnType>;
|
||||
interface StoreFunction {
|
||||
(locals: any): StoreFunctionReturn;
|
||||
}
|
||||
interface Store {
|
||||
[key: string]: StoreFunction;
|
||||
}
|
||||
declare class Generator {
|
||||
id: number;
|
||||
store: Store;
|
||||
constructor();
|
||||
list(): Store;
|
||||
get(name: string): StoreFunction;
|
||||
register(fn: GeneratorFunction): void;
|
||||
register(name: string, fn: GeneratorFunction): void;
|
||||
}
|
||||
export = Generator;
|
||||
33
node_modules/hexo/dist/extend/generator.js
generated
vendored
Normal file
33
node_modules/hexo/dist/extend/generator.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
const bluebird_1 = __importDefault(require("bluebird"));
|
||||
class Generator {
|
||||
constructor() {
|
||||
this.id = 0;
|
||||
this.store = {};
|
||||
}
|
||||
list() {
|
||||
return this.store;
|
||||
}
|
||||
get(name) {
|
||||
return this.store[name];
|
||||
}
|
||||
register(name, fn) {
|
||||
if (!fn) {
|
||||
if (typeof name === 'function') { // fn
|
||||
fn = name;
|
||||
name = `generator-${this.id++}`;
|
||||
}
|
||||
else {
|
||||
throw new TypeError('fn must be a function');
|
||||
}
|
||||
}
|
||||
if (fn.length > 1)
|
||||
fn = bluebird_1.default.promisify(fn);
|
||||
this.store[name] = bluebird_1.default.method(fn);
|
||||
}
|
||||
}
|
||||
module.exports = Generator;
|
||||
//# sourceMappingURL=generator.js.map
|
||||
1
node_modules/hexo/dist/extend/generator.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/extend/generator.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../lib/extend/generator.ts"],"names":[],"mappings":";;;;AAAA,wDAA+B;AAyB/B,MAAM,SAAS;IAIb;QACE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QACZ,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAClB,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAID,QAAQ,CAAC,IAAgC,EAAE,EAAsB;QAC/D,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC,CAAC,KAAK;gBACrC,EAAE,GAAG,IAAI,CAAC;gBACV,IAAI,GAAG,aAAa,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC;YAClC,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,SAAS,CAAC,uBAAuB,CAAC,CAAC;YAC/C,CAAC;QACH,CAAC;QAED,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;YAAE,EAAE,GAAG,kBAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QAC9C,IAAI,CAAC,KAAK,CAAC,IAAc,CAAC,GAAG,kBAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAClD,CAAC;CACF;AAED,iBAAS,SAAS,CAAC"}
|
||||
27
node_modules/hexo/dist/extend/helper.d.ts
generated
vendored
Normal file
27
node_modules/hexo/dist/extend/helper.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
interface StoreFunction {
|
||||
(...args: any[]): string;
|
||||
}
|
||||
interface Store {
|
||||
[key: string]: StoreFunction;
|
||||
}
|
||||
declare class Helper {
|
||||
store: Store;
|
||||
constructor();
|
||||
/**
|
||||
* @returns {Store} - The plugin store
|
||||
*/
|
||||
list(): Store;
|
||||
/**
|
||||
* Get helper plugin function by name
|
||||
* @param {String} name - The name of the helper plugin
|
||||
* @returns {StoreFunction}
|
||||
*/
|
||||
get(name: string): StoreFunction;
|
||||
/**
|
||||
* Register a helper plugin
|
||||
* @param {String} name - The name of the helper plugin
|
||||
* @param {StoreFunction} fn - The helper plugin function
|
||||
*/
|
||||
register(name: string, fn: StoreFunction): void;
|
||||
}
|
||||
export = Helper;
|
||||
34
node_modules/hexo/dist/extend/helper.js
generated
vendored
Normal file
34
node_modules/hexo/dist/extend/helper.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
class Helper {
|
||||
constructor() {
|
||||
this.store = {};
|
||||
}
|
||||
/**
|
||||
* @returns {Store} - The plugin store
|
||||
*/
|
||||
list() {
|
||||
return this.store;
|
||||
}
|
||||
/**
|
||||
* Get helper plugin function by name
|
||||
* @param {String} name - The name of the helper plugin
|
||||
* @returns {StoreFunction}
|
||||
*/
|
||||
get(name) {
|
||||
return this.store[name];
|
||||
}
|
||||
/**
|
||||
* Register a helper plugin
|
||||
* @param {String} name - The name of the helper plugin
|
||||
* @param {StoreFunction} fn - The helper plugin function
|
||||
*/
|
||||
register(name, fn) {
|
||||
if (!name)
|
||||
throw new TypeError('name is required');
|
||||
if (typeof fn !== 'function')
|
||||
throw new TypeError('fn must be a function');
|
||||
this.store[name] = fn;
|
||||
}
|
||||
}
|
||||
module.exports = Helper;
|
||||
//# sourceMappingURL=helper.js.map
|
||||
1
node_modules/hexo/dist/extend/helper.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/extend/helper.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../lib/extend/helper.ts"],"names":[],"mappings":";AASA,MAAM,MAAM;IAGV;QACE,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAClB,CAAC;IAED;;OAEG;IACH,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,IAAY,EAAE,EAAiB;QACtC,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,SAAS,CAAC,kBAAkB,CAAC,CAAC;QACnD,IAAI,OAAO,EAAE,KAAK,UAAU;YAAE,MAAM,IAAI,SAAS,CAAC,uBAAuB,CAAC,CAAC;QAE3E,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;IACxB,CAAC;CACF;AAED,iBAAS,MAAM,CAAC"}
|
||||
11
node_modules/hexo/dist/extend/index.d.ts
generated
vendored
Normal file
11
node_modules/hexo/dist/extend/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
export { default as Console } from './console';
|
||||
export { default as Deployer } from './deployer';
|
||||
export { default as Filter } from './filter';
|
||||
export { default as Generator } from './generator';
|
||||
export { default as Helper } from './helper';
|
||||
export { default as Highlight } from './syntax_highlight';
|
||||
export { default as Injector } from './injector';
|
||||
export { default as Migrator } from './migrator';
|
||||
export { default as Processor } from './processor';
|
||||
export { default as Renderer } from './renderer';
|
||||
export { default as Tag } from './tag';
|
||||
29
node_modules/hexo/dist/extend/index.js
generated
vendored
Normal file
29
node_modules/hexo/dist/extend/index.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Tag = exports.Renderer = exports.Processor = exports.Migrator = exports.Injector = exports.Highlight = exports.Helper = exports.Generator = exports.Filter = exports.Deployer = exports.Console = void 0;
|
||||
var console_1 = require("./console");
|
||||
Object.defineProperty(exports, "Console", { enumerable: true, get: function () { return __importDefault(console_1).default; } });
|
||||
var deployer_1 = require("./deployer");
|
||||
Object.defineProperty(exports, "Deployer", { enumerable: true, get: function () { return __importDefault(deployer_1).default; } });
|
||||
var filter_1 = require("./filter");
|
||||
Object.defineProperty(exports, "Filter", { enumerable: true, get: function () { return __importDefault(filter_1).default; } });
|
||||
var generator_1 = require("./generator");
|
||||
Object.defineProperty(exports, "Generator", { enumerable: true, get: function () { return __importDefault(generator_1).default; } });
|
||||
var helper_1 = require("./helper");
|
||||
Object.defineProperty(exports, "Helper", { enumerable: true, get: function () { return __importDefault(helper_1).default; } });
|
||||
var syntax_highlight_1 = require("./syntax_highlight");
|
||||
Object.defineProperty(exports, "Highlight", { enumerable: true, get: function () { return __importDefault(syntax_highlight_1).default; } });
|
||||
var injector_1 = require("./injector");
|
||||
Object.defineProperty(exports, "Injector", { enumerable: true, get: function () { return __importDefault(injector_1).default; } });
|
||||
var migrator_1 = require("./migrator");
|
||||
Object.defineProperty(exports, "Migrator", { enumerable: true, get: function () { return __importDefault(migrator_1).default; } });
|
||||
var processor_1 = require("./processor");
|
||||
Object.defineProperty(exports, "Processor", { enumerable: true, get: function () { return __importDefault(processor_1).default; } });
|
||||
var renderer_1 = require("./renderer");
|
||||
Object.defineProperty(exports, "Renderer", { enumerable: true, get: function () { return __importDefault(renderer_1).default; } });
|
||||
var tag_1 = require("./tag");
|
||||
Object.defineProperty(exports, "Tag", { enumerable: true, get: function () { return __importDefault(tag_1).default; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/hexo/dist/extend/index.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/extend/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/extend/index.ts"],"names":[],"mappings":";;;;;;AAAA,qCAA+C;AAAtC,mHAAA,OAAO,OAAW;AAC3B,uCAAiD;AAAxC,qHAAA,OAAO,OAAY;AAC5B,mCAA6C;AAApC,iHAAA,OAAO,OAAU;AAC1B,yCAAmD;AAA1C,uHAAA,OAAO,OAAa;AAC7B,mCAA6C;AAApC,iHAAA,OAAO,OAAU;AAC1B,uDAA0D;AAAjD,8HAAA,OAAO,OAAa;AAC7B,uCAAiD;AAAxC,qHAAA,OAAO,OAAY;AAC5B,uCAAiD;AAAxC,qHAAA,OAAO,OAAY;AAC5B,yCAAmD;AAA1C,uHAAA,OAAO,OAAa;AAC7B,uCAAiD;AAAxC,qHAAA,OAAO,OAAY;AAC5B,6BAAuC;AAA9B,2GAAA,OAAO,OAAO"}
|
||||
23
node_modules/hexo/dist/extend/injector.d.ts
generated
vendored
Normal file
23
node_modules/hexo/dist/extend/injector.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
type Entry = 'head_begin' | 'head_end' | 'body_begin' | 'body_end';
|
||||
type Store = {
|
||||
[key in Entry]: {
|
||||
[key: string]: Set<unknown>;
|
||||
};
|
||||
};
|
||||
declare class Injector {
|
||||
store: Store;
|
||||
cache: any;
|
||||
page: any;
|
||||
constructor();
|
||||
list(): Store;
|
||||
get(entry: Entry, to?: string): any[];
|
||||
getText(entry: Entry, to?: string): string;
|
||||
getSize(entry: Entry): any;
|
||||
register(entry: Entry, value: string | (() => string), to?: string): void;
|
||||
_getPageType(pageLocals: any): string;
|
||||
_injector(input: string, pattern: string | RegExp, flag: Entry, isBegin: boolean, currentType: string): string;
|
||||
exec(data: string, locals?: {
|
||||
page: {};
|
||||
}): string;
|
||||
}
|
||||
export = Injector;
|
||||
93
node_modules/hexo/dist/extend/injector.js
generated
vendored
Normal file
93
node_modules/hexo/dist/extend/injector.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
"use strict";
|
||||
const hexo_util_1 = require("hexo-util");
|
||||
class Injector {
|
||||
constructor() {
|
||||
this.store = {
|
||||
head_begin: {},
|
||||
head_end: {},
|
||||
body_begin: {},
|
||||
body_end: {}
|
||||
};
|
||||
this.cache = new hexo_util_1.Cache();
|
||||
}
|
||||
list() {
|
||||
return this.store;
|
||||
}
|
||||
get(entry, to = 'default') {
|
||||
return Array.from(this.store[entry][to] || []);
|
||||
}
|
||||
getText(entry, to = 'default') {
|
||||
const arr = this.get(entry, to);
|
||||
if (!arr || !arr.length)
|
||||
return '';
|
||||
return arr.join('');
|
||||
}
|
||||
getSize(entry) {
|
||||
return this.cache.apply(`${entry}-size`, Object.keys(this.store[entry]).length);
|
||||
}
|
||||
register(entry, value, to = 'default') {
|
||||
if (!entry)
|
||||
throw new TypeError('entry is required');
|
||||
if (typeof value === 'function')
|
||||
value = value();
|
||||
const entryMap = this.store[entry] || this.store.head_end;
|
||||
const valueSet = entryMap[to] || new Set();
|
||||
valueSet.add(value);
|
||||
entryMap[to] = valueSet;
|
||||
}
|
||||
_getPageType(pageLocals) {
|
||||
let currentType = 'default';
|
||||
if (pageLocals.__index)
|
||||
currentType = 'home';
|
||||
if (pageLocals.__post)
|
||||
currentType = 'post';
|
||||
if (pageLocals.__page)
|
||||
currentType = 'page';
|
||||
if (pageLocals.archive)
|
||||
currentType = 'archive';
|
||||
if (pageLocals.category)
|
||||
currentType = 'category';
|
||||
if (pageLocals.tag)
|
||||
currentType = 'tag';
|
||||
if (pageLocals.layout)
|
||||
currentType = pageLocals.layout;
|
||||
return currentType;
|
||||
}
|
||||
_injector(input, pattern, flag, isBegin = true, currentType) {
|
||||
if (input.includes(`hexo injector ${flag}`))
|
||||
return input;
|
||||
const code = this.cache.apply(`${flag}-${currentType}-code`, () => {
|
||||
const content = currentType === 'default' ? this.getText(flag, 'default') : this.getText(flag, currentType) + this.getText(flag, 'default');
|
||||
if (!content.length)
|
||||
return '';
|
||||
return '<!-- hexo injector ' + flag + ' start -->' + content + '<!-- hexo injector ' + flag + ' end -->';
|
||||
});
|
||||
// avoid unnecessary replace() for better performance
|
||||
if (!code.length)
|
||||
return input;
|
||||
return input.replace(pattern, str => { return isBegin ? str + code : code + str; });
|
||||
}
|
||||
exec(data, locals = { page: {} }) {
|
||||
const { page } = locals;
|
||||
const currentType = this._getPageType(page);
|
||||
if (this.getSize('head_begin') !== 0) {
|
||||
// Inject head_begin
|
||||
data = this._injector(data, /<head.*?>/, 'head_begin', true, currentType);
|
||||
}
|
||||
if (this.getSize('head_end') !== 0) {
|
||||
// Inject head_end
|
||||
data = this._injector(data, '</head>', 'head_end', false, currentType);
|
||||
}
|
||||
if (this.getSize('body_begin') !== 0) {
|
||||
// Inject body_begin
|
||||
data = this._injector(data, /<body.*?>/, 'body_begin', true, currentType);
|
||||
}
|
||||
if (this.getSize('body_end') !== 0) {
|
||||
// Inject body_end
|
||||
data = this._injector(data, '</body>', 'body_end', false, currentType);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
module.exports = Injector;
|
||||
//# sourceMappingURL=injector.js.map
|
||||
1
node_modules/hexo/dist/extend/injector.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/extend/injector.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"injector.js","sourceRoot":"","sources":["../../lib/extend/injector.ts"],"names":[],"mappings":";AAAA,yCAAkC;AAUlC,MAAM,QAAQ;IAKZ;QACE,IAAI,CAAC,KAAK,GAAG;YACX,UAAU,EAAE,EAAE;YACd,QAAQ,EAAE,EAAE;YACZ,UAAU,EAAE,EAAE;YACd,QAAQ,EAAE,EAAE;SACb,CAAC;QAEF,IAAI,CAAC,KAAK,GAAG,IAAI,iBAAK,EAAE,CAAC;IAC3B,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,GAAG,CAAC,KAAY,EAAE,EAAE,GAAG,SAAS;QAC9B,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC;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CAAC,CAAC,CAAC;IACtF,CAAC;IAED,IAAI,CAAC,IAAY,EAAE,MAAM,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE;QACtC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;QACxB,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QAE5C,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;YACrC,oBAAoB;YACpB,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;QAC5E,CAAC;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YACnC,kBAAkB;YAClB,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;QACzE,CAAC;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;YACrC,oBAAoB;YACpB,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;QAC5E,CAAC;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YACnC,kBAAkB;YAClB,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;QACzE,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,iBAAS,QAAQ,CAAC"}
|
||||
15
node_modules/hexo/dist/extend/migrator.d.ts
generated
vendored
Normal file
15
node_modules/hexo/dist/extend/migrator.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import type { NodeJSLikeCallback } from '../types';
|
||||
interface StoreFunction {
|
||||
(args: any, callback?: NodeJSLikeCallback<any>): any;
|
||||
}
|
||||
interface Store {
|
||||
[key: string]: StoreFunction;
|
||||
}
|
||||
declare class Migrator {
|
||||
store: Store;
|
||||
constructor();
|
||||
list(): Store;
|
||||
get(name: string): StoreFunction;
|
||||
register(name: string, fn: StoreFunction): void;
|
||||
}
|
||||
export = Migrator;
|
||||
31
node_modules/hexo/dist/extend/migrator.js
generated
vendored
Normal file
31
node_modules/hexo/dist/extend/migrator.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
const bluebird_1 = __importDefault(require("bluebird"));
|
||||
class Migrator {
|
||||
constructor() {
|
||||
this.store = {};
|
||||
}
|
||||
list() {
|
||||
return this.store;
|
||||
}
|
||||
get(name) {
|
||||
return this.store[name];
|
||||
}
|
||||
register(name, fn) {
|
||||
if (!name)
|
||||
throw new TypeError('name is required');
|
||||
if (typeof fn !== 'function')
|
||||
throw new TypeError('fn must be a function');
|
||||
if (fn.length > 1) {
|
||||
fn = bluebird_1.default.promisify(fn);
|
||||
}
|
||||
else {
|
||||
fn = bluebird_1.default.method(fn);
|
||||
}
|
||||
this.store[name] = fn;
|
||||
}
|
||||
}
|
||||
module.exports = Migrator;
|
||||
//# sourceMappingURL=migrator.js.map
|
||||
1
node_modules/hexo/dist/extend/migrator.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/extend/migrator.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"migrator.js","sourceRoot":"","sources":["../../lib/extend/migrator.ts"],"names":[],"mappings":";;;;AAAA,wDAA+B;AAW/B,MAAM,QAAQ;IAGZ;QACE,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAClB,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,QAAQ,CAAC,IAAY,EAAE,EAAiB;QACtC,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,SAAS,CAAC,kBAAkB,CAAC,CAAC;QACnD,IAAI,OAAO,EAAE,KAAK,UAAU;YAAE,MAAM,IAAI,SAAS,CAAC,uBAAuB,CAAC,CAAC;QAE3E,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClB,EAAE,GAAG,kBAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QAC7B,CAAC;aAAM,CAAC;YACN,EAAE,GAAG,kBAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC1B,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;IACxB,CAAC;CACF;AAED,iBAAS,QAAQ,CAAC"}
|
||||
18
node_modules/hexo/dist/extend/processor.d.ts
generated
vendored
Normal file
18
node_modules/hexo/dist/extend/processor.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Pattern } from 'hexo-util';
|
||||
import type File from '../box/file';
|
||||
interface StoreFunction {
|
||||
(file: File): any;
|
||||
}
|
||||
type Store = {
|
||||
pattern: Pattern;
|
||||
process: StoreFunction;
|
||||
}[];
|
||||
type patternType = Exclude<ConstructorParameters<typeof Pattern>[0], ((str: string) => string)>;
|
||||
declare class Processor {
|
||||
store: Store;
|
||||
constructor();
|
||||
list(): Store;
|
||||
register(fn: StoreFunction): void;
|
||||
register(pattern: patternType, fn: StoreFunction): void;
|
||||
}
|
||||
export = Processor;
|
||||
37
node_modules/hexo/dist/extend/processor.js
generated
vendored
Normal file
37
node_modules/hexo/dist/extend/processor.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
const bluebird_1 = __importDefault(require("bluebird"));
|
||||
const hexo_util_1 = require("hexo-util");
|
||||
class Processor {
|
||||
constructor() {
|
||||
this.store = [];
|
||||
}
|
||||
list() {
|
||||
return this.store;
|
||||
}
|
||||
register(pattern, fn) {
|
||||
if (!fn) {
|
||||
if (typeof pattern === 'function') {
|
||||
fn = pattern;
|
||||
pattern = /(.*)/;
|
||||
}
|
||||
else {
|
||||
throw new TypeError('fn must be a function');
|
||||
}
|
||||
}
|
||||
if (fn.length > 1) {
|
||||
fn = bluebird_1.default.promisify(fn);
|
||||
}
|
||||
else {
|
||||
fn = bluebird_1.default.method(fn);
|
||||
}
|
||||
this.store.push({
|
||||
pattern: new hexo_util_1.Pattern(pattern),
|
||||
process: fn
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = Processor;
|
||||
//# sourceMappingURL=processor.js.map
|
||||
1
node_modules/hexo/dist/extend/processor.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/extend/processor.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"processor.js","sourceRoot":"","sources":["../../lib/extend/processor.ts"],"names":[],"mappings":";;;;AAAA,wDAA+B;AAC/B,yCAAoC;AAapC,MAAM,SAAS;IAGb;QACE,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAClB,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAID,QAAQ,CAAC,OAAoC,EAAE,EAAkB;QAC/D,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;gBAClC,EAAE,GAAG,OAAO,CAAC;gBACb,OAAO,GAAG,MAAM,CAAC;YACnB,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,SAAS,CAAC,uBAAuB,CAAC,CAAC;YAC/C,CAAC;QACH,CAAC;QAED,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClB,EAAE,GAAG,kBAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QAC7B,CAAC;aAAM,CAAC;YACN,EAAE,GAAG,kBAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC1B,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;YACd,OAAO,EAAE,IAAI,mBAAO,CAAC,OAAsB,CAAC;YAC5C,OAAO,EAAE,EAAE;SACZ,CAAC,CAAC;IACL,CAAC;CACF;AAED,iBAAS,SAAS,CAAC"}
|
||||
43
node_modules/hexo/dist/extend/renderer.d.ts
generated
vendored
Normal file
43
node_modules/hexo/dist/extend/renderer.d.ts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import Promise from 'bluebird';
|
||||
import type { NodeJSLikeCallback } from '../types';
|
||||
export interface StoreFunctionData {
|
||||
path?: any;
|
||||
text?: string;
|
||||
engine?: string;
|
||||
toString?: any;
|
||||
onRenderEnd?: (...args: any[]) => any;
|
||||
}
|
||||
export interface StoreSyncFunction {
|
||||
[x: string]: any;
|
||||
(data: StoreFunctionData, options: object): any;
|
||||
output?: string;
|
||||
compile?: (local: object) => any;
|
||||
}
|
||||
export interface StoreFunction {
|
||||
(data: StoreFunctionData, options: object, callback?: NodeJSLikeCallback<any>): Promise<any>;
|
||||
(data: StoreFunctionData, options: object, callback: NodeJSLikeCallback<string>): void;
|
||||
output?: string;
|
||||
compile?: (local: object) => any;
|
||||
disableNunjucks?: boolean;
|
||||
}
|
||||
interface SyncStore {
|
||||
[key: string]: StoreSyncFunction;
|
||||
}
|
||||
interface Store {
|
||||
[key: string]: StoreFunction;
|
||||
}
|
||||
declare class Renderer {
|
||||
store: Store;
|
||||
storeSync: SyncStore;
|
||||
constructor();
|
||||
list(sync?: boolean): Store | SyncStore;
|
||||
get(name: string, sync?: boolean): StoreSyncFunction | StoreFunction;
|
||||
isRenderable(path: string): boolean;
|
||||
isRenderableSync(path: string): boolean;
|
||||
getOutput(path: string): string;
|
||||
register(name: string, output: string, fn: StoreFunction): void;
|
||||
register(name: string, output: string, fn: StoreFunction, sync: false): void;
|
||||
register(name: string, output: string, fn: StoreSyncFunction, sync: true): void;
|
||||
register(name: string, output: string, fn: StoreFunction | StoreSyncFunction, sync: boolean): void;
|
||||
}
|
||||
export default Renderer;
|
||||
61
node_modules/hexo/dist/extend/renderer.js
generated
vendored
Normal file
61
node_modules/hexo/dist/extend/renderer.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path_1 = require("path");
|
||||
const bluebird_1 = __importDefault(require("bluebird"));
|
||||
const getExtname = (str) => {
|
||||
if (typeof str !== 'string')
|
||||
return '';
|
||||
const ext = (0, path_1.extname)(str) || str;
|
||||
return ext.startsWith('.') ? ext.slice(1) : ext;
|
||||
};
|
||||
class Renderer {
|
||||
constructor() {
|
||||
this.store = {};
|
||||
this.storeSync = {};
|
||||
}
|
||||
list(sync = false) {
|
||||
return sync ? this.storeSync : this.store;
|
||||
}
|
||||
get(name, sync) {
|
||||
const store = this[sync ? 'storeSync' : 'store'];
|
||||
return store[getExtname(name)] || store[name];
|
||||
}
|
||||
isRenderable(path) {
|
||||
return Boolean(this.get(path));
|
||||
}
|
||||
isRenderableSync(path) {
|
||||
return Boolean(this.get(path, true));
|
||||
}
|
||||
getOutput(path) {
|
||||
const renderer = this.get(path);
|
||||
return renderer ? renderer.output : '';
|
||||
}
|
||||
register(name, output, fn, sync) {
|
||||
if (!name)
|
||||
throw new TypeError('name is required');
|
||||
if (!output)
|
||||
throw new TypeError('output is required');
|
||||
if (typeof fn !== 'function')
|
||||
throw new TypeError('fn must be a function');
|
||||
name = getExtname(name);
|
||||
output = getExtname(output);
|
||||
if (sync) {
|
||||
this.storeSync[name] = fn;
|
||||
this.storeSync[name].output = output;
|
||||
this.store[name] = bluebird_1.default.method(fn);
|
||||
this.store[name].disableNunjucks = fn.disableNunjucks;
|
||||
}
|
||||
else {
|
||||
if (fn.length > 2)
|
||||
fn = bluebird_1.default.promisify(fn);
|
||||
this.store[name] = fn;
|
||||
}
|
||||
this.store[name].output = output;
|
||||
this.store[name].compile = fn.compile;
|
||||
}
|
||||
}
|
||||
exports.default = Renderer;
|
||||
//# sourceMappingURL=renderer.js.map
|
||||
1
node_modules/hexo/dist/extend/renderer.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/extend/renderer.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"renderer.js","sourceRoot":"","sources":["../../lib/extend/renderer.ts"],"names":[],"mappings":";;;;;AAAA,+BAA+B;AAC/B,wDAA+B;AAG/B,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,EAAE;IACjC,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAC;IAEvC,MAAM,GAAG,GAAG,IAAA,cAAO,EAAC,GAAG,CAAC,IAAI,GAAG,CAAC;IAChC,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAClD,CAAC,CAAC;AA2CF,MAAM,QAAQ;IAIZ;QACE,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;IACtB,CAAC;IAED,IAAI,CAAC,IAAI,GAAG,KAAK;QACf,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;IAC5C,CAAC;IAED,GAAG,CAAC,IAAY,EAAE,IAAc;QAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,CA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IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,eAAe,GAAI,EAAoB,CAAC,eAAe,CAAC;QAC3E,CAAC;aAAM,CAAC;YACN,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;gBAAE,EAAE,GAAG,kBAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;YAC9C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QACxB,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,MAAM,CAAC;QACjC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC;IACxC,CAAC;CACF;AAED,kBAAe,QAAQ,CAAC"}
|
||||
32
node_modules/hexo/dist/extend/syntax_highlight.d.ts
generated
vendored
Normal file
32
node_modules/hexo/dist/extend/syntax_highlight.d.ts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import type Hexo from '../hexo';
|
||||
export interface HighlightOptions {
|
||||
lang: string | undefined;
|
||||
caption: string | undefined;
|
||||
lines_length?: number | undefined;
|
||||
firstLineNumber?: string | number;
|
||||
language_attr?: boolean | undefined;
|
||||
firstLine?: number;
|
||||
line_number?: boolean | undefined;
|
||||
line_threshold?: number | undefined;
|
||||
mark?: number[];
|
||||
wrap?: boolean | undefined;
|
||||
}
|
||||
interface HighlightExecArgs {
|
||||
context?: Hexo;
|
||||
args?: [string, HighlightOptions];
|
||||
}
|
||||
interface StoreFunction {
|
||||
(content: string, options: HighlightOptions): string;
|
||||
priority?: number;
|
||||
}
|
||||
interface Store {
|
||||
[key: string]: StoreFunction;
|
||||
}
|
||||
declare class SyntaxHighlight {
|
||||
store: Store;
|
||||
constructor();
|
||||
register(name: string, fn: StoreFunction): void;
|
||||
query(name: string): StoreFunction;
|
||||
exec(name: string, options: HighlightExecArgs): string;
|
||||
}
|
||||
export default SyntaxHighlight;
|
||||
25
node_modules/hexo/dist/extend/syntax_highlight.js
generated
vendored
Normal file
25
node_modules/hexo/dist/extend/syntax_highlight.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
class SyntaxHighlight {
|
||||
constructor() {
|
||||
this.store = {};
|
||||
}
|
||||
register(name, fn) {
|
||||
if (typeof fn !== 'function')
|
||||
throw new TypeError('fn must be a function');
|
||||
this.store[name] = fn;
|
||||
}
|
||||
query(name) {
|
||||
return name && this.store[name];
|
||||
}
|
||||
exec(name, options) {
|
||||
const fn = this.store[name];
|
||||
if (!fn)
|
||||
throw new TypeError(`syntax highlighter ${name} is not registered`);
|
||||
const ctx = options.context;
|
||||
const args = options.args || [];
|
||||
return Reflect.apply(fn, ctx, args);
|
||||
}
|
||||
}
|
||||
exports.default = SyntaxHighlight;
|
||||
//# sourceMappingURL=syntax_highlight.js.map
|
||||
1
node_modules/hexo/dist/extend/syntax_highlight.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/extend/syntax_highlight.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"syntax_highlight.js","sourceRoot":"","sources":["../../lib/extend/syntax_highlight.ts"],"names":[],"mappings":";;AAkCA,MAAM,eAAe;IAGnB;QACE,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAClB,CAAC;IAED,QAAQ,CAAC,IAAY,EAAE,EAAiB;QACtC,IAAI,OAAO,EAAE,KAAK,UAAU;YAAE,MAAM,IAAI,SAAS,CAAC,uBAAuB,CAAC,CAAC;QAE3E,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,IAAY;QAChB,OAAO,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,CAAC,IAAY,EAAE,OAA0B;QAC3C,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAE5B,IAAI,CAAC,EAAE;YAAE,MAAM,IAAI,SAAS,CAAC,sBAAsB,IAAI,oBAAoB,CAAC,CAAC;QAC7E,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC;QAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC;QAEhC,OAAO,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;CACF;AAED,kBAAe,eAAe,CAAC"}
|
||||
26
node_modules/hexo/dist/extend/tag.d.ts
generated
vendored
Normal file
26
node_modules/hexo/dist/extend/tag.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import { Environment } from 'nunjucks';
|
||||
import Promise from 'bluebird';
|
||||
import type { NodeJSLikeCallback } from '../types';
|
||||
interface TagFunction {
|
||||
(args: any[], content: string, callback?: NodeJSLikeCallback<any>): string | PromiseLike<string>;
|
||||
}
|
||||
type RegisterOptions = {
|
||||
async?: boolean;
|
||||
ends?: boolean;
|
||||
};
|
||||
declare class Tag {
|
||||
env: Environment;
|
||||
source: string;
|
||||
constructor();
|
||||
register(name: string, fn: TagFunction): void;
|
||||
register(name: string, fn: TagFunction, ends: boolean): void;
|
||||
register(name: string, fn: TagFunction, options: RegisterOptions): void;
|
||||
unregister(name: string): void;
|
||||
render(str: string): Promise<any>;
|
||||
render(str: string, callback: NodeJSLikeCallback<any>): Promise<any>;
|
||||
render(str: string, options: {
|
||||
source?: string;
|
||||
[key: string]: any;
|
||||
}, callback?: NodeJSLikeCallback<any>): Promise<any>;
|
||||
}
|
||||
export = Tag;
|
||||
219
node_modules/hexo/dist/extend/tag.js
generated
vendored
Normal file
219
node_modules/hexo/dist/extend/tag.js
generated
vendored
Normal file
@@ -0,0 +1,219 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
const hexo_util_1 = require("hexo-util");
|
||||
const picocolors_1 = require("picocolors");
|
||||
const nunjucks_1 = require("nunjucks");
|
||||
const bluebird_1 = __importDefault(require("bluebird"));
|
||||
const rSwigRawFullBlock = /{% *raw *%}/;
|
||||
const rCodeTag = /<code[^<>]*>[\s\S]+?<\/code>/g;
|
||||
const escapeSwigTag = (str) => str.replace(/{/g, '{').replace(/}/g, '}');
|
||||
class NunjucksTag {
|
||||
constructor(name, fn) {
|
||||
this.tags = [name];
|
||||
this.fn = fn;
|
||||
}
|
||||
parse(parser, nodes, lexer) {
|
||||
const node = this._parseArgs(parser, nodes, lexer);
|
||||
return new nodes.CallExtension(this, 'run', node, []);
|
||||
}
|
||||
_parseArgs(parser, nodes, lexer) {
|
||||
const tag = parser.nextToken();
|
||||
const node = new nodes.NodeList(tag.lineno, tag.colno);
|
||||
const argarray = new nodes.Array(tag.lineno, tag.colno);
|
||||
let token;
|
||||
let argitem = '';
|
||||
while ((token = parser.nextToken(true))) {
|
||||
if (token.type === lexer.TOKEN_WHITESPACE || token.type === lexer.TOKEN_BLOCK_END) {
|
||||
if (argitem !== '') {
|
||||
const argnode = new nodes.Literal(tag.lineno, tag.colno, argitem.trim());
|
||||
argarray.addChild(argnode);
|
||||
argitem = '';
|
||||
}
|
||||
if (token.type === lexer.TOKEN_BLOCK_END) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
argitem += token.value;
|
||||
}
|
||||
}
|
||||
node.addChild(argarray);
|
||||
return node;
|
||||
}
|
||||
run(context, args, body, callback) {
|
||||
return this._run(context, args, '');
|
||||
}
|
||||
_run(context, args, body) {
|
||||
return Reflect.apply(this.fn, context.ctx, [args, body]);
|
||||
}
|
||||
}
|
||||
const trimBody = (body) => {
|
||||
return (0, hexo_util_1.stripIndent)(body()).replace(/^\n?|\n?$/g, '');
|
||||
};
|
||||
class NunjucksBlock extends NunjucksTag {
|
||||
parse(parser, nodes, lexer) {
|
||||
const node = this._parseArgs(parser, nodes, lexer);
|
||||
const body = this._parseBody(parser, nodes, lexer);
|
||||
return new nodes.CallExtension(this, 'run', node, [body]);
|
||||
}
|
||||
_parseBody(parser, nodes, lexer) {
|
||||
const body = parser.parseUntilBlocks(`end${this.tags[0]}`);
|
||||
parser.advanceAfterBlockEnd();
|
||||
return body;
|
||||
}
|
||||
run(context, args, body, callback) {
|
||||
return this._run(context, args, trimBody(body));
|
||||
}
|
||||
}
|
||||
class NunjucksAsyncTag extends NunjucksTag {
|
||||
parse(parser, nodes, lexer) {
|
||||
const node = this._parseArgs(parser, nodes, lexer);
|
||||
return new nodes.CallExtensionAsync(this, 'run', node, []);
|
||||
}
|
||||
run(context, args, callback) {
|
||||
return this._run(context, args, '').then(result => {
|
||||
callback(null, result);
|
||||
}, callback);
|
||||
}
|
||||
}
|
||||
class NunjucksAsyncBlock extends NunjucksBlock {
|
||||
parse(parser, nodes, lexer) {
|
||||
const node = this._parseArgs(parser, nodes, lexer);
|
||||
const body = this._parseBody(parser, nodes, lexer);
|
||||
return new nodes.CallExtensionAsync(this, 'run', node, [body]);
|
||||
}
|
||||
run(context, args, body, callback) {
|
||||
// enable async tag nesting
|
||||
body((err, result) => {
|
||||
// wrapper for trimBody expecting
|
||||
// body to be a function
|
||||
body = () => result || '';
|
||||
this._run(context, args, trimBody(body)).then(result => {
|
||||
callback(err, result);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
const getContextLineNums = (min, max, center, amplitude) => {
|
||||
const result = [];
|
||||
let lbound = Math.max(min, center - amplitude);
|
||||
const hbound = Math.min(max, center + amplitude);
|
||||
while (lbound <= hbound)
|
||||
result.push(lbound++);
|
||||
return result;
|
||||
};
|
||||
const LINES_OF_CONTEXT = 5;
|
||||
const getContext = (lines, errLine, location, type) => {
|
||||
const message = [
|
||||
location + ' ' + (0, picocolors_1.red)(type),
|
||||
(0, picocolors_1.cyan)(' ===== Context Dump ====='),
|
||||
(0, picocolors_1.cyan)(' === (line number probably different from source) ===')
|
||||
];
|
||||
message.push(
|
||||
// get LINES_OF_CONTEXT lines surrounding `errLine`
|
||||
...getContextLineNums(1, lines.length, errLine, LINES_OF_CONTEXT)
|
||||
.map(lnNum => {
|
||||
const line = ' ' + lnNum + ' | ' + lines[lnNum - 1];
|
||||
if (lnNum === errLine) {
|
||||
return (0, picocolors_1.cyan)((0, picocolors_1.bold)(line));
|
||||
}
|
||||
return (0, picocolors_1.cyan)(line);
|
||||
}));
|
||||
message.push((0, picocolors_1.cyan)(' ===== Context Dump Ends ====='));
|
||||
return message;
|
||||
};
|
||||
class NunjucksError extends Error {
|
||||
}
|
||||
/**
|
||||
* Provide context for Nunjucks error
|
||||
* @param {Error} err Nunjucks error
|
||||
* @param {string} str string input for Nunjucks
|
||||
* @return {Error} New error object with embedded context
|
||||
*/
|
||||
const formatNunjucksError = (err, input, source = '') => {
|
||||
err.message = err.message.replace('(unknown path)', source ? (0, picocolors_1.magenta)(source) : '');
|
||||
const match = err.message.match(/Line (\d+), Column \d+/);
|
||||
if (!match)
|
||||
return err;
|
||||
const errLine = parseInt(match[1], 10);
|
||||
if (isNaN(errLine))
|
||||
return err;
|
||||
// trim useless info from Nunjucks Error
|
||||
const splitted = err.message.split('\n');
|
||||
const e = new NunjucksError();
|
||||
e.name = 'Nunjucks Error';
|
||||
e.line = errLine;
|
||||
e.location = splitted[0];
|
||||
e.type = splitted[1].trim();
|
||||
e.message = getContext(input.split(/\r?\n/), errLine, e.location, e.type).join('\n');
|
||||
return e;
|
||||
};
|
||||
class Tag {
|
||||
constructor() {
|
||||
this.env = new nunjucks_1.Environment(null, {
|
||||
autoescape: false
|
||||
});
|
||||
}
|
||||
register(name, fn, options) {
|
||||
if (!name)
|
||||
throw new TypeError('name is required');
|
||||
if (typeof fn !== 'function')
|
||||
throw new TypeError('fn must be a function');
|
||||
if (options == null || typeof options === 'boolean') {
|
||||
options = { ends: options };
|
||||
}
|
||||
let tag;
|
||||
if (options.async) {
|
||||
let asyncFn;
|
||||
if (fn.length > 2) {
|
||||
asyncFn = bluebird_1.default.promisify(fn);
|
||||
}
|
||||
else {
|
||||
asyncFn = bluebird_1.default.method(fn);
|
||||
}
|
||||
if (options.ends) {
|
||||
tag = new NunjucksAsyncBlock(name, asyncFn);
|
||||
}
|
||||
else {
|
||||
tag = new NunjucksAsyncTag(name, asyncFn);
|
||||
}
|
||||
}
|
||||
else if (options.ends) {
|
||||
tag = new NunjucksBlock(name, fn);
|
||||
}
|
||||
else {
|
||||
tag = new NunjucksTag(name, fn);
|
||||
}
|
||||
this.env.addExtension(name, tag);
|
||||
}
|
||||
unregister(name) {
|
||||
if (!name)
|
||||
throw new TypeError('name is required');
|
||||
const { env } = this;
|
||||
if (env.hasExtension(name))
|
||||
env.removeExtension(name);
|
||||
}
|
||||
render(str, options = {}, callback) {
|
||||
if (!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
// Get path of post from source
|
||||
const { source = '' } = options;
|
||||
return bluebird_1.default.fromCallback(cb => {
|
||||
this.env.renderString(str.replace(rCodeTag, s => {
|
||||
// https://hexo.io/docs/tag-plugins#Raw
|
||||
// https://mozilla.github.io/nunjucks/templating.html#raw
|
||||
// Only escape code block when there is no raw tag included
|
||||
return s.match(rSwigRawFullBlock) ? s : escapeSwigTag(s);
|
||||
}), options, cb);
|
||||
}).catch(err => {
|
||||
return bluebird_1.default.reject(formatNunjucksError(err, str, source));
|
||||
})
|
||||
.asCallback(callback);
|
||||
}
|
||||
}
|
||||
module.exports = Tag;
|
||||
//# sourceMappingURL=tag.js.map
|
||||
1
node_modules/hexo/dist/extend/tag.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/extend/tag.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
74
node_modules/hexo/dist/hexo/default_config.d.ts
generated
vendored
Normal file
74
node_modules/hexo/dist/hexo/default_config.d.ts
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
declare const _default: {
|
||||
title: string;
|
||||
subtitle: string;
|
||||
description: string;
|
||||
author: string;
|
||||
language: string;
|
||||
timezone: string;
|
||||
url: string;
|
||||
root: string;
|
||||
permalink: string;
|
||||
permalink_defaults: {};
|
||||
pretty_urls: {
|
||||
trailing_index: boolean;
|
||||
trailing_html: boolean;
|
||||
};
|
||||
source_dir: string;
|
||||
public_dir: string;
|
||||
tag_dir: string;
|
||||
archive_dir: string;
|
||||
category_dir: string;
|
||||
code_dir: string;
|
||||
i18n_dir: string;
|
||||
skip_render: any[];
|
||||
new_post_name: string;
|
||||
default_layout: string;
|
||||
titlecase: boolean;
|
||||
external_link: {
|
||||
enable: boolean;
|
||||
field: string;
|
||||
exclude: string;
|
||||
};
|
||||
filename_case: number;
|
||||
render_drafts: boolean;
|
||||
post_asset_folder: boolean;
|
||||
relative_link: boolean;
|
||||
future: boolean;
|
||||
syntax_highlighter: string;
|
||||
highlight: {
|
||||
auto_detect: boolean;
|
||||
line_number: boolean;
|
||||
tab_replace: string;
|
||||
wrap: boolean;
|
||||
exclude_languages: any[];
|
||||
language_attr: boolean;
|
||||
hljs: boolean;
|
||||
line_threshold: number;
|
||||
first_line_number: string;
|
||||
strip_indent: boolean;
|
||||
};
|
||||
prismjs: {
|
||||
preprocess: boolean;
|
||||
line_number: boolean;
|
||||
tab_replace: string;
|
||||
exclude_languages: any[];
|
||||
strip_indent: boolean;
|
||||
};
|
||||
use_filename_as_post_title: boolean;
|
||||
default_category: string;
|
||||
category_map: {};
|
||||
tag_map: {};
|
||||
date_format: string;
|
||||
time_format: string;
|
||||
updated_option: string;
|
||||
per_page: number;
|
||||
pagination_dir: string;
|
||||
theme: string;
|
||||
server: {
|
||||
cache: boolean;
|
||||
};
|
||||
deploy: {};
|
||||
ignore: any[];
|
||||
meta_generator: boolean;
|
||||
};
|
||||
export = _default;
|
||||
88
node_modules/hexo/dist/hexo/default_config.js
generated
vendored
Normal file
88
node_modules/hexo/dist/hexo/default_config.js
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
"use strict";
|
||||
module.exports = {
|
||||
// Site
|
||||
title: 'Hexo',
|
||||
subtitle: '',
|
||||
description: '',
|
||||
author: 'John Doe',
|
||||
language: 'en',
|
||||
timezone: '',
|
||||
// URL
|
||||
url: 'http://example.com',
|
||||
root: '/',
|
||||
permalink: ':year/:month/:day/:title/',
|
||||
permalink_defaults: {},
|
||||
pretty_urls: {
|
||||
trailing_index: true,
|
||||
trailing_html: true
|
||||
},
|
||||
// Directory
|
||||
source_dir: 'source',
|
||||
public_dir: 'public',
|
||||
tag_dir: 'tags',
|
||||
archive_dir: 'archives',
|
||||
category_dir: 'categories',
|
||||
code_dir: 'downloads/code',
|
||||
i18n_dir: ':lang',
|
||||
skip_render: [],
|
||||
// Writing
|
||||
new_post_name: ':title.md',
|
||||
default_layout: 'post',
|
||||
titlecase: false,
|
||||
external_link: {
|
||||
enable: true,
|
||||
field: 'site',
|
||||
exclude: ''
|
||||
},
|
||||
filename_case: 0,
|
||||
render_drafts: false,
|
||||
post_asset_folder: false,
|
||||
relative_link: false,
|
||||
future: true,
|
||||
syntax_highlighter: 'highlight.js',
|
||||
highlight: {
|
||||
auto_detect: false,
|
||||
line_number: true,
|
||||
tab_replace: '',
|
||||
wrap: true,
|
||||
exclude_languages: [],
|
||||
language_attr: false,
|
||||
hljs: false,
|
||||
line_threshold: 0,
|
||||
first_line_number: 'always1',
|
||||
strip_indent: true
|
||||
},
|
||||
prismjs: {
|
||||
preprocess: true,
|
||||
line_number: true,
|
||||
tab_replace: '',
|
||||
exclude_languages: [],
|
||||
strip_indent: true
|
||||
},
|
||||
use_filename_as_post_title: false,
|
||||
// Category & Tag
|
||||
default_category: 'uncategorized',
|
||||
category_map: {},
|
||||
tag_map: {},
|
||||
// Date / Time format
|
||||
date_format: 'YYYY-MM-DD',
|
||||
time_format: 'HH:mm:ss',
|
||||
updated_option: 'mtime',
|
||||
// * mtime: file modification date (default)
|
||||
// * empty: no more update
|
||||
// Pagination
|
||||
per_page: 10,
|
||||
pagination_dir: 'page',
|
||||
// Extensions
|
||||
theme: 'landscape',
|
||||
server: {
|
||||
cache: false
|
||||
},
|
||||
// Deployment
|
||||
deploy: {},
|
||||
// ignore files from processing
|
||||
ignore: [],
|
||||
// Category & Tag
|
||||
meta_generator: true
|
||||
};
|
||||
//# sourceMappingURL=default_config.js.map
|
||||
1
node_modules/hexo/dist/hexo/default_config.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/hexo/default_config.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"default_config.js","sourceRoot":"","sources":["../../lib/hexo/default_config.ts"],"names":[],"mappings":";AAAA,iBAAS;IACP,OAAO;IACP,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,EAAE;IACZ,WAAW,EAAE,EAAE;IACf,MAAM,EAAE,UAAU;IAClB,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,EAAE;IACZ,MAAM;IACN,GAAG,EAAE,oBAAoB;IACzB,IAAI,EAAE,GAAG;IACT,SAAS,EAAE,2BAA2B;IACtC,kBAAkB,EAAE,EAAE;IACtB,WAAW,EAAE;QACX,cAAc,EAAE,IAAI;QACpB,aAAa,EAAE,IAAI;KACpB;IACD,YAAY;IACZ,UAAU,EAAE,QAAQ;IACpB,UAAU,EAAE,QAAQ;IACpB,OAAO,EAAE,MAAM;IACf,WAAW,EAAE,UAAU;IACvB,YAAY,EAAE,YAAY;IAC1B,QAAQ,EAAE,gBAAgB;IAC1B,QAAQ,EAAE,OAAO;IACjB,WAAW,EAAE,EAAE;IACf,UAAU;IACV,aAAa,EAAE,WAAW;IAC1B,cAAc,EAAE,MAAM;IACtB,SAAS,EAAE,KAAK;IAChB,aAAa,EAAE;QACb,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,MAAM;QACb,OAAO,EAAE,EAAE;KACZ;IACD,aAAa,EAAE,CAAC;IAChB,aAAa,EAAE,KAAK;IACpB,iBAAiB,EAAE,KAAK;IACxB,aAAa,EAAE,KAAK;IACpB,MAAM,EAAE,IAAI;IACZ,kBAAkB,EAAE,cAAc;IAClC,SAAS,EAAE;QACT,WAAW,EAAE,KAAK;QAClB,WAAW,EAAE,IAAI;QACjB,WAAW,EAAE,EAAE;QACf,IAAI,EAAE,IAAI;QACV,iBAAiB,EAAE,EAAE;QACrB,aAAa,EAAE,KAAK;QACpB,IAAI,EAAE,KAAK;QACX,cAAc,EAAE,CAAC;QACjB,iBAAiB,EAAE,SAAS;QAC5B,YAAY,EAAE,IAAI;KACnB;IACD,OAAO,EAAE;QACP,UAAU,EAAE,IAAI;QAChB,WAAW,EAAE,IAAI;QACjB,WAAW,EAAE,EAAE;QACf,iBAAiB,EAAE,EAAE;QACrB,YAAY,EAAE,IAAI;KACnB;IACD,0BAA0B,EAAE,KAAK;IAEjC,iBAAiB;IACjB,gBAAgB,EAAE,eAAe;IACjC,YAAY,EAAE,EAAE;IAChB,OAAO,EAAE,EAAE;IACX,qBAAqB;IACrB,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,UAAU;IACvB,cAAc,EAAE,OAAO;IACvB,4CAA4C;IAC5C,0BAA0B;IAC1B,aAAa;IACb,QAAQ,EAAE,EAAE;IACZ,cAAc,EAAE,MAAM;IACtB,aAAa;IACb,KAAK,EAAE,WAAW;IAClB,MAAM,EAAE;QACN,KAAK,EAAE,KAAK;KACb;IACD,aAAa;IACb,MAAM,EAAE,EAAE;IAEV,+BAA+B;IAC/B,MAAM,EAAE,EAAE;IAEV,iBAAiB;IACjB,cAAc,EAAE,IAAI;CACrB,CAAC"}
|
||||
207
node_modules/hexo/dist/hexo/index.d.ts
generated
vendored
Normal file
207
node_modules/hexo/dist/hexo/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,207 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import Promise from 'bluebird';
|
||||
import Database from 'warehouse';
|
||||
import { EventEmitter } from 'events';
|
||||
import Module from 'module';
|
||||
import logger from 'hexo-log';
|
||||
import { Console, Deployer, Filter, Generator, Helper, Highlight, Injector, Migrator, Processor, Renderer, Tag } from '../extend';
|
||||
import Render from './render';
|
||||
import Post from './post';
|
||||
import Scaffold from './scaffold';
|
||||
import Source from './source';
|
||||
import Router from './router';
|
||||
import Theme from '../theme';
|
||||
import Locals from './locals';
|
||||
import defaultConfig from './default_config';
|
||||
import type { AssetGenerator, NodeJSLikeCallback, NormalPageGenerator, NormalPostGenerator, PageGenerator, PostGenerator, SiteLocals } from '../types';
|
||||
import type { AddSchemaTypeOptions } from 'warehouse/dist/types';
|
||||
import type Schema from 'warehouse/dist/schema';
|
||||
interface Args {
|
||||
debug?: boolean;
|
||||
safe?: boolean;
|
||||
silent?: boolean;
|
||||
draft?: boolean;
|
||||
drafts?: boolean;
|
||||
_?: string[];
|
||||
output?: string;
|
||||
config?: string;
|
||||
[key: string]: any;
|
||||
}
|
||||
interface Extend {
|
||||
console: Console;
|
||||
deployer: Deployer;
|
||||
filter: Filter;
|
||||
generator: Generator;
|
||||
helper: Helper;
|
||||
highlight: Highlight;
|
||||
injector: Injector;
|
||||
migrator: Migrator;
|
||||
processor: Processor;
|
||||
renderer: Renderer;
|
||||
tag: Tag;
|
||||
}
|
||||
interface Env {
|
||||
args: Args;
|
||||
debug: boolean;
|
||||
safe: boolean;
|
||||
silent: boolean;
|
||||
env: string;
|
||||
version: string;
|
||||
cmd: string;
|
||||
init: boolean;
|
||||
}
|
||||
type DefaultConfigType = typeof defaultConfig;
|
||||
interface Config extends DefaultConfigType {
|
||||
[key: string]: any;
|
||||
}
|
||||
declare module 'module' {
|
||||
function _nodeModulePaths(path: string): string[];
|
||||
function _resolveFilename(request: string, parent: Module, isMain?: any, options?: any): string;
|
||||
const _extensions: NodeJS.RequireExtensions, _cache: any;
|
||||
}
|
||||
interface Hexo {
|
||||
/**
|
||||
* Emitted before deployment begins.
|
||||
* @param event
|
||||
* @param listener
|
||||
* @link https://hexo.io/api/events.html#deployBefore
|
||||
*/
|
||||
on(event: 'deployBefore', listener: (...args: any[]) => any): this;
|
||||
/**
|
||||
* Emitted after deployment begins.
|
||||
* @param event
|
||||
* @param listener
|
||||
* @link https://hexo.io/api/events.html#deployAfter
|
||||
*/
|
||||
on(event: 'deployAfter', listener: (...args: any[]) => any): this;
|
||||
/**
|
||||
* Emitted before Hexo exits.
|
||||
* @param event
|
||||
* @param listener
|
||||
* @link https://hexo.io/api/events.html#exit
|
||||
*/
|
||||
on(event: 'exit', listener: (...args: any[]) => any): this;
|
||||
/**
|
||||
* Emitted before generation begins.
|
||||
* @param event
|
||||
* @param listener
|
||||
* @link https://hexo.io/api/events.html#generateBefore
|
||||
*/
|
||||
on(event: 'generateBefore', listener: (...args: any[]) => any): this;
|
||||
/**
|
||||
* Emitted after generation finishes.
|
||||
* @param event
|
||||
* @param listener
|
||||
* @link https://hexo.io/api/events.html#generateAfter
|
||||
*/
|
||||
on(event: 'generateAfter', listener: (...args: any[]) => any): this;
|
||||
/**
|
||||
* Emitted after a new post has been created. This event returns the post data:
|
||||
* @param event
|
||||
* @param listener
|
||||
* @link https://hexo.io/api/events.html#new
|
||||
*/
|
||||
on(event: 'new', listener: (post: {
|
||||
path: string;
|
||||
content: string;
|
||||
}) => any): this;
|
||||
/**
|
||||
* Emitted before processing begins. This event returns a path representing the root directory of the box.
|
||||
* @param event
|
||||
* @param listener
|
||||
* @link https://hexo.io/api/events.html#processBefore
|
||||
*/
|
||||
on(event: 'processBefore', listener: (...args: any[]) => any): this;
|
||||
/**
|
||||
* Emitted after processing finishes. This event returns a path representing the root directory of the box.
|
||||
* @param event
|
||||
* @param listener
|
||||
* @link https://hexo.io/api/events.html#processAfter
|
||||
*/
|
||||
on(event: 'processAfter', listener: (...args: any[]) => any): this;
|
||||
/**
|
||||
* Emitted after initialization finishes.
|
||||
* @param event
|
||||
* @param listener
|
||||
*/
|
||||
on(event: 'ready', listener: (...args: any[]) => any): this;
|
||||
/**
|
||||
* undescripted on emit
|
||||
* @param event
|
||||
* @param listener
|
||||
*/
|
||||
on(event: string, listener: (...args: any[]) => any): any;
|
||||
emit(event: string, ...args: any[]): any;
|
||||
}
|
||||
declare class Hexo extends EventEmitter {
|
||||
base_dir: string;
|
||||
public_dir: string;
|
||||
source_dir: string;
|
||||
plugin_dir: string;
|
||||
script_dir: string;
|
||||
scaffold_dir: string;
|
||||
theme_dir: string;
|
||||
theme_script_dir: string;
|
||||
env: Env;
|
||||
extend: Extend;
|
||||
config: Config;
|
||||
log: ReturnType<typeof logger>;
|
||||
render: Render;
|
||||
route: Router;
|
||||
post: Post;
|
||||
scaffold: Scaffold;
|
||||
_dbLoaded: boolean;
|
||||
_isGenerating: boolean;
|
||||
database: Database;
|
||||
config_path: string;
|
||||
source: Source;
|
||||
theme: Theme;
|
||||
locals: Locals;
|
||||
version: string;
|
||||
_watchBox: () => void;
|
||||
lib_dir: string;
|
||||
core_dir: string;
|
||||
static lib_dir: string;
|
||||
static core_dir: string;
|
||||
static version: string;
|
||||
constructor(base?: string, args?: Args);
|
||||
_bindLocals(): void;
|
||||
init(): Promise<void>;
|
||||
call(name: string, callback?: NodeJSLikeCallback<any>): Promise<any>;
|
||||
call(name: string, args: object, callback?: NodeJSLikeCallback<any>): Promise<any>;
|
||||
model(name: string, schema?: Schema | Record<string, AddSchemaTypeOptions>): import("warehouse/dist/model").default<any>;
|
||||
resolvePlugin(name: string, basedir: string): string;
|
||||
loadPlugin(path: string, callback?: NodeJSLikeCallback<any>): Promise<any>;
|
||||
_showDrafts(): boolean;
|
||||
load(callback?: NodeJSLikeCallback<any>): Promise<any>;
|
||||
watch(callback?: NodeJSLikeCallback<any>): Promise<any>;
|
||||
unwatch(): void;
|
||||
_generateLocals(): {
|
||||
new (path: string, locals: NormalPageGenerator | NormalPostGenerator): {
|
||||
page: NormalPageGenerator | NormalPostGenerator;
|
||||
path: string;
|
||||
url: string;
|
||||
config: any;
|
||||
theme: any;
|
||||
layout: string;
|
||||
env: any;
|
||||
view_dir: string;
|
||||
site: SiteLocals;
|
||||
cache?: boolean;
|
||||
};
|
||||
};
|
||||
_runGenerators(): Promise<(AssetGenerator | PostGenerator | PageGenerator)[]>;
|
||||
_routerRefresh(runningGenerators: Promise<(AssetGenerator | PostGenerator | PageGenerator)[]>, useCache: boolean): Promise<void>;
|
||||
_generate(options?: {
|
||||
cache?: boolean;
|
||||
}): Promise<any>;
|
||||
exit(err?: any): Promise<void>;
|
||||
execFilter(type: string, data: any, options?: any): Promise<any>;
|
||||
execFilterSync(type: string, data: any, options?: any): any;
|
||||
}
|
||||
declare global {
|
||||
const hexo: Hexo;
|
||||
}
|
||||
export = Hexo;
|
||||
413
node_modules/hexo/dist/hexo/index.js
generated
vendored
Normal file
413
node_modules/hexo/dist/hexo/index.js
generated
vendored
Normal file
@@ -0,0 +1,413 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
const bluebird_1 = __importDefault(require("bluebird"));
|
||||
const path_1 = require("path");
|
||||
const tildify_1 = __importDefault(require("tildify"));
|
||||
const warehouse_1 = __importDefault(require("warehouse"));
|
||||
const picocolors_1 = require("picocolors");
|
||||
const events_1 = require("events");
|
||||
const hexo_fs_1 = require("hexo-fs");
|
||||
const module_1 = __importDefault(require("module"));
|
||||
const vm_1 = require("vm");
|
||||
const { version } = require('../../package.json');
|
||||
const hexo_log_1 = __importDefault(require("hexo-log"));
|
||||
const extend_1 = require("../extend");
|
||||
const render_1 = __importDefault(require("./render"));
|
||||
const register_models_1 = __importDefault(require("./register_models"));
|
||||
const post_1 = __importDefault(require("./post"));
|
||||
const scaffold_1 = __importDefault(require("./scaffold"));
|
||||
const source_1 = __importDefault(require("./source"));
|
||||
const router_1 = __importDefault(require("./router"));
|
||||
const theme_1 = __importDefault(require("../theme"));
|
||||
const locals_1 = __importDefault(require("./locals"));
|
||||
const default_config_1 = __importDefault(require("./default_config"));
|
||||
const load_database_1 = __importDefault(require("./load_database"));
|
||||
const multi_config_path_1 = __importDefault(require("./multi_config_path"));
|
||||
const hexo_util_1 = require("hexo-util");
|
||||
let resolveSync; // = require('resolve');
|
||||
const libDir = (0, path_1.dirname)(__dirname);
|
||||
const dbVersion = 1;
|
||||
const stopWatcher = (box) => { if (box.isWatching())
|
||||
box.unwatch(); };
|
||||
const routeCache = new WeakMap();
|
||||
const castArray = (obj) => { return Array.isArray(obj) ? obj : [obj]; };
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
const mergeCtxThemeConfig = (ctx) => {
|
||||
// Merge hexo.config.theme_config into hexo.theme.config before post rendering & generating
|
||||
// config.theme_config has "_config.[theme].yml" merged in load_theme_config.js
|
||||
if (ctx.config.theme_config) {
|
||||
ctx.theme.config = (0, hexo_util_1.deepMerge)(ctx.theme.config, ctx.config.theme_config);
|
||||
}
|
||||
};
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
const createLoadThemeRoute = function (generatorResult, locals, ctx) {
|
||||
const { log, theme } = ctx;
|
||||
const { path, cache: useCache } = locals;
|
||||
const layout = [...new Set(castArray(generatorResult.layout))];
|
||||
const layoutLength = layout.length;
|
||||
// always use cache in fragment_cache
|
||||
locals.cache = true;
|
||||
return () => {
|
||||
if (useCache && routeCache.has(generatorResult))
|
||||
return routeCache.get(generatorResult);
|
||||
for (let i = 0; i < layoutLength; i++) {
|
||||
const name = layout[i];
|
||||
const view = theme.getView(name);
|
||||
if (view) {
|
||||
log.debug(`Rendering HTML ${name}: ${(0, picocolors_1.magenta)(path)}`);
|
||||
return view.render(locals)
|
||||
.then(result => ctx.extend.injector.exec(result, locals))
|
||||
.then(result => ctx.execFilter('_after_html_render', result, {
|
||||
context: ctx,
|
||||
args: [locals]
|
||||
}))
|
||||
.tap(result => {
|
||||
if (useCache) {
|
||||
routeCache.set(generatorResult, result);
|
||||
}
|
||||
}).tapCatch(err => {
|
||||
log.error({ err }, `Render HTML failed: ${(0, picocolors_1.magenta)(path)}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
log.warn(`No layout: ${(0, picocolors_1.magenta)(path)}`);
|
||||
};
|
||||
};
|
||||
function debounce(func, wait) {
|
||||
let timeout;
|
||||
return function () {
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(() => {
|
||||
func.apply(this);
|
||||
}, wait);
|
||||
};
|
||||
}
|
||||
class Hexo extends events_1.EventEmitter {
|
||||
constructor(base = process.cwd(), args = {}) {
|
||||
super();
|
||||
this.base_dir = base + path_1.sep;
|
||||
this.public_dir = (0, path_1.join)(base, 'public') + path_1.sep;
|
||||
this.source_dir = (0, path_1.join)(base, 'source') + path_1.sep;
|
||||
this.plugin_dir = (0, path_1.join)(base, 'node_modules') + path_1.sep;
|
||||
this.script_dir = (0, path_1.join)(base, 'scripts') + path_1.sep;
|
||||
this.scaffold_dir = (0, path_1.join)(base, 'scaffolds') + path_1.sep;
|
||||
this.theme_dir = (0, path_1.join)(base, 'themes', default_config_1.default.theme) + path_1.sep;
|
||||
this.theme_script_dir = (0, path_1.join)(this.theme_dir, 'scripts') + path_1.sep;
|
||||
this.env = {
|
||||
args,
|
||||
debug: Boolean(args.debug),
|
||||
safe: Boolean(args.safe),
|
||||
silent: Boolean(args.silent),
|
||||
env: process.env.NODE_ENV || 'development',
|
||||
version,
|
||||
cmd: args._ ? args._[0] : '',
|
||||
init: false
|
||||
};
|
||||
this.extend = {
|
||||
console: new extend_1.Console(),
|
||||
deployer: new extend_1.Deployer(),
|
||||
filter: new extend_1.Filter(),
|
||||
generator: new extend_1.Generator(),
|
||||
helper: new extend_1.Helper(),
|
||||
highlight: new extend_1.Highlight(),
|
||||
injector: new extend_1.Injector(),
|
||||
migrator: new extend_1.Migrator(),
|
||||
processor: new extend_1.Processor(),
|
||||
renderer: new extend_1.Renderer(),
|
||||
tag: new extend_1.Tag()
|
||||
};
|
||||
this.config = { ...default_config_1.default };
|
||||
this.log = (0, hexo_log_1.default)(this.env);
|
||||
this.render = new render_1.default(this);
|
||||
this.route = new router_1.default();
|
||||
this.post = new post_1.default(this);
|
||||
this.scaffold = new scaffold_1.default(this);
|
||||
this._dbLoaded = false;
|
||||
this._isGenerating = false;
|
||||
// If `output` is provided, use that as the
|
||||
// root for saving the db. Otherwise default to `base`.
|
||||
const dbPath = args.output || base;
|
||||
if (/^(init|new|g|publish|s|deploy|render|migrate)/.test(this.env.cmd)) {
|
||||
this.log.d(`Writing database to ${(0, path_1.join)(dbPath, 'db.json')}`);
|
||||
}
|
||||
this.database = new warehouse_1.default({
|
||||
version: dbVersion,
|
||||
path: (0, path_1.join)(dbPath, 'db.json')
|
||||
});
|
||||
const mcp = (0, multi_config_path_1.default)(this);
|
||||
this.config_path = args.config ? mcp(base, args.config, args.output)
|
||||
: (0, path_1.join)(base, '_config.yml');
|
||||
(0, register_models_1.default)(this);
|
||||
this.source = new source_1.default(this);
|
||||
this.theme = new theme_1.default(this);
|
||||
this.locals = new locals_1.default();
|
||||
this._bindLocals();
|
||||
}
|
||||
_bindLocals() {
|
||||
const db = this.database;
|
||||
const { locals } = this;
|
||||
locals.set('posts', () => {
|
||||
const query = {};
|
||||
if (!this.config.future) {
|
||||
query.date = { $lte: Date.now() };
|
||||
}
|
||||
if (!this._showDrafts()) {
|
||||
query.published = true;
|
||||
}
|
||||
return db.model('Post').find(query);
|
||||
});
|
||||
locals.set('pages', () => {
|
||||
const query = {};
|
||||
if (!this.config.future) {
|
||||
query.date = { $lte: Date.now() };
|
||||
}
|
||||
return db.model('Page').find(query);
|
||||
});
|
||||
locals.set('categories', () => {
|
||||
// Ignore categories with zero posts
|
||||
return db.model('Category').filter(category => category.length);
|
||||
});
|
||||
locals.set('tags', () => {
|
||||
// Ignore tags with zero posts
|
||||
return db.model('Tag').filter(tag => tag.length);
|
||||
});
|
||||
locals.set('data', () => {
|
||||
const obj = {};
|
||||
db.model('Data').forEach(data => {
|
||||
obj[data._id] = data.data;
|
||||
});
|
||||
return obj;
|
||||
});
|
||||
}
|
||||
init() {
|
||||
this.log.debug('Hexo version: %s', (0, picocolors_1.magenta)(this.version));
|
||||
this.log.debug('Working directory: %s', (0, picocolors_1.magenta)((0, tildify_1.default)(this.base_dir)));
|
||||
// Load internal plugins
|
||||
require('../plugins/console')(this);
|
||||
require('../plugins/filter')(this);
|
||||
require('../plugins/generator')(this);
|
||||
require('../plugins/helper')(this);
|
||||
require('../plugins/highlight')(this);
|
||||
require('../plugins/injector')(this);
|
||||
require('../plugins/processor')(this);
|
||||
require('../plugins/renderer')(this);
|
||||
require('../plugins/tag').default(this);
|
||||
// Load config
|
||||
return bluebird_1.default.each([
|
||||
'update_package', // Update package.json
|
||||
'load_config', // Load config
|
||||
'load_theme_config', // Load alternate theme config
|
||||
'load_plugins' // Load external plugins & scripts
|
||||
], name => require(`./${name}`)(this)).then(() => this.execFilter('after_init', null, { context: this })).then(() => {
|
||||
// Ready to go!
|
||||
this.emit('ready');
|
||||
});
|
||||
}
|
||||
call(name, args, callback) {
|
||||
if (!callback && typeof args === 'function') {
|
||||
callback = args;
|
||||
args = {};
|
||||
}
|
||||
const c = this.extend.console.get(name);
|
||||
if (c)
|
||||
return Reflect.apply(c, this, [args]).asCallback(callback);
|
||||
return bluebird_1.default.reject(new Error(`Console \`${name}\` has not been registered yet!`));
|
||||
}
|
||||
model(name, schema) {
|
||||
return this.database.model(name, schema);
|
||||
}
|
||||
resolvePlugin(name, basedir) {
|
||||
try {
|
||||
// Try to resolve the plugin with the Node.js's built-in require.resolve.
|
||||
return require.resolve(name, { paths: [basedir] });
|
||||
}
|
||||
catch (err) {
|
||||
try {
|
||||
// There was an error (likely the node_modules is corrupt or from early version of npm)
|
||||
// Use Hexo prior 6.0.0's behavior (resolve.sync) to resolve the plugin.
|
||||
resolveSync = resolveSync || require('resolve').sync;
|
||||
return resolveSync(name, { basedir });
|
||||
}
|
||||
catch (err) {
|
||||
// There was an error (likely the plugin wasn't found), so return a possibly
|
||||
// non-existing path that a later part of the resolution process will check.
|
||||
return (0, path_1.join)(basedir, 'node_modules', name);
|
||||
}
|
||||
}
|
||||
}
|
||||
loadPlugin(path, callback) {
|
||||
return (0, hexo_fs_1.readFile)(path).then(script => {
|
||||
// Based on: https://github.com/nodejs/node-v0.x-archive/blob/v0.10.33/src/node.js#L516
|
||||
const module = new module_1.default(path);
|
||||
module.filename = path;
|
||||
module.paths = module_1.default._nodeModulePaths(path);
|
||||
function req(path) {
|
||||
return module.require(path);
|
||||
}
|
||||
req.resolve = (request) => module_1.default._resolveFilename(request, module);
|
||||
req.main = require.main;
|
||||
req.extensions = module_1.default._extensions;
|
||||
req.cache = module_1.default._cache;
|
||||
script = `(async function(exports, require, module, __filename, __dirname, hexo){${script}\n});`;
|
||||
const fn = (0, vm_1.runInThisContext)(script, path);
|
||||
return fn(module.exports, req, module, path, (0, path_1.dirname)(path), this);
|
||||
}).asCallback(callback);
|
||||
}
|
||||
_showDrafts() {
|
||||
const { args } = this.env;
|
||||
return args.draft || args.drafts || this.config.render_drafts;
|
||||
}
|
||||
load(callback) {
|
||||
return (0, load_database_1.default)(this).then(() => {
|
||||
this.log.info('Start processing');
|
||||
return bluebird_1.default.all([
|
||||
this.source.process(),
|
||||
this.theme.process()
|
||||
]);
|
||||
}).then(() => {
|
||||
mergeCtxThemeConfig(this);
|
||||
return this._generate({ cache: false });
|
||||
}).asCallback(callback);
|
||||
}
|
||||
watch(callback) {
|
||||
let useCache = false;
|
||||
const { cache } = Object.assign({
|
||||
cache: false
|
||||
}, this.config.server);
|
||||
const { alias } = this.extend.console;
|
||||
if (alias[this.env.cmd] === 'server' && cache) {
|
||||
// enable cache when run hexo server
|
||||
useCache = true;
|
||||
}
|
||||
this._watchBox = debounce(() => this._generate({ cache: useCache }), 100);
|
||||
return (0, load_database_1.default)(this).then(() => {
|
||||
this.log.info('Start processing');
|
||||
return bluebird_1.default.all([
|
||||
this.source.watch(),
|
||||
this.theme.watch()
|
||||
]);
|
||||
}).then(() => {
|
||||
mergeCtxThemeConfig(this);
|
||||
this.source.on('processAfter', this._watchBox);
|
||||
this.theme.on('processAfter', () => {
|
||||
this._watchBox();
|
||||
mergeCtxThemeConfig(this);
|
||||
});
|
||||
return this._generate({ cache: useCache });
|
||||
}).asCallback(callback);
|
||||
}
|
||||
unwatch() {
|
||||
if (this._watchBox != null) {
|
||||
this.source.removeListener('processAfter', this._watchBox);
|
||||
this.theme.removeListener('processAfter', this._watchBox);
|
||||
this._watchBox = null;
|
||||
}
|
||||
stopWatcher(this.source);
|
||||
stopWatcher(this.theme);
|
||||
}
|
||||
_generateLocals() {
|
||||
const { config, env, theme, theme_dir } = this;
|
||||
const ctx = { config: { url: this.config.url } };
|
||||
const localsObj = this.locals.toObject();
|
||||
class Locals {
|
||||
constructor(path, locals) {
|
||||
this.page = { ...locals };
|
||||
if (this.page.path == null)
|
||||
this.page.path = path;
|
||||
this.path = path;
|
||||
this.url = hexo_util_1.full_url_for.call(ctx, path);
|
||||
this.config = config;
|
||||
this.theme = theme.config;
|
||||
this.layout = 'layout';
|
||||
this.env = env;
|
||||
this.view_dir = (0, path_1.join)(theme_dir, 'layout') + path_1.sep;
|
||||
this.site = localsObj;
|
||||
}
|
||||
}
|
||||
return Locals;
|
||||
}
|
||||
_runGenerators() {
|
||||
this.locals.invalidate();
|
||||
const siteLocals = this.locals.toObject();
|
||||
const generators = this.extend.generator.list();
|
||||
const { log } = this;
|
||||
// Run generators
|
||||
return bluebird_1.default.map(Object.keys(generators), key => {
|
||||
const generator = generators[key];
|
||||
log.debug('Generator: %s', (0, picocolors_1.magenta)(key));
|
||||
return Reflect.apply(generator, this, [siteLocals]);
|
||||
}).reduce((result, data) => {
|
||||
return data ? result.concat(data) : result;
|
||||
}, []);
|
||||
}
|
||||
_routerRefresh(runningGenerators, useCache) {
|
||||
const { route } = this;
|
||||
const routeList = route.list();
|
||||
const Locals = this._generateLocals();
|
||||
Locals.prototype.cache = useCache;
|
||||
return runningGenerators.map((generatorResult) => {
|
||||
if (typeof generatorResult !== 'object' || generatorResult.path == null)
|
||||
return undefined;
|
||||
// add Route
|
||||
const path = route.format(generatorResult.path);
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
const { data, layout } = generatorResult;
|
||||
if (!layout) {
|
||||
route.set(path, data);
|
||||
return path;
|
||||
}
|
||||
return this.execFilter('template_locals', new Locals(path, data), { context: this })
|
||||
.then(locals => { route.set(path, createLoadThemeRoute(generatorResult, locals, this)); })
|
||||
.thenReturn(path);
|
||||
}).then(newRouteList => {
|
||||
// Remove old routes
|
||||
for (let i = 0, len = routeList.length; i < len; i++) {
|
||||
const item = routeList[i];
|
||||
if (!newRouteList.includes(item)) {
|
||||
route.remove(item);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
_generate(options = {}) {
|
||||
if (this._isGenerating)
|
||||
return;
|
||||
const useCache = options.cache;
|
||||
this._isGenerating = true;
|
||||
this.emit('generateBefore');
|
||||
// Run before_generate filters
|
||||
return this.execFilter('before_generate', null, { context: this })
|
||||
.then(() => this._routerRefresh(this._runGenerators(), useCache)).then(() => {
|
||||
this.emit('generateAfter');
|
||||
// Run after_generate filters
|
||||
return this.execFilter('after_generate', null, { context: this });
|
||||
}).finally(() => {
|
||||
this._isGenerating = false;
|
||||
});
|
||||
}
|
||||
exit(err) {
|
||||
if (err) {
|
||||
this.log.fatal({ err }, 'Something\'s wrong. Maybe you can find the solution here: %s', (0, picocolors_1.underline)('https://hexo.io/docs/troubleshooting.html'));
|
||||
}
|
||||
return this.execFilter('before_exit', null, { context: this }).then(() => {
|
||||
this.emit('exit', err);
|
||||
});
|
||||
}
|
||||
execFilter(type, data, options) {
|
||||
return this.extend.filter.exec(type, data, options);
|
||||
}
|
||||
execFilterSync(type, data, options) {
|
||||
return this.extend.filter.execSync(type, data, options);
|
||||
}
|
||||
}
|
||||
Hexo.lib_dir = libDir + path_1.sep;
|
||||
Hexo.prototype.lib_dir = Hexo.lib_dir;
|
||||
Hexo.core_dir = (0, path_1.dirname)(libDir) + path_1.sep;
|
||||
Hexo.prototype.core_dir = Hexo.core_dir;
|
||||
Hexo.version = version;
|
||||
Hexo.prototype.version = Hexo.version;
|
||||
module.exports = Hexo;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/hexo/dist/hexo/index.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/hexo/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/hexo/dist/hexo/load_config.d.ts
generated
vendored
Normal file
3
node_modules/hexo/dist/hexo/load_config.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type Hexo from './index';
|
||||
declare const _default: (ctx: Hexo) => Promise<void>;
|
||||
export = _default;
|
||||
70
node_modules/hexo/dist/hexo/load_config.js
generated
vendored
Normal file
70
node_modules/hexo/dist/hexo/load_config.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
const path_1 = require("path");
|
||||
const tildify_1 = __importDefault(require("tildify"));
|
||||
const theme_1 = __importDefault(require("../theme"));
|
||||
const source_1 = __importDefault(require("./source"));
|
||||
const hexo_fs_1 = require("hexo-fs");
|
||||
const picocolors_1 = require("picocolors");
|
||||
const hexo_util_1 = require("hexo-util");
|
||||
const validate_config_1 = __importDefault(require("./validate_config"));
|
||||
async function findConfigPath(path) {
|
||||
const { dir, name } = (0, path_1.parse)(path);
|
||||
const files = await (0, hexo_fs_1.readdir)(dir);
|
||||
const item = files.find(item => item.startsWith(name));
|
||||
if (item != null)
|
||||
return (0, path_1.join)(dir, item);
|
||||
}
|
||||
module.exports = async (ctx) => {
|
||||
if (!ctx.env.init)
|
||||
return;
|
||||
const baseDir = ctx.base_dir;
|
||||
let configPath = ctx.config_path;
|
||||
const path = await (0, hexo_fs_1.exists)(configPath) ? configPath : await findConfigPath(configPath);
|
||||
if (!path)
|
||||
return;
|
||||
configPath = path;
|
||||
let config = await ctx.render.render({ path });
|
||||
if (!config || typeof config !== 'object')
|
||||
return;
|
||||
ctx.log.debug('Config loaded: %s', (0, picocolors_1.magenta)((0, tildify_1.default)(configPath)));
|
||||
ctx.config = (0, hexo_util_1.deepMerge)(ctx.config, config);
|
||||
// If root is not exist, create it by config.url
|
||||
if (!config.root) {
|
||||
let { pathname } = new URL(ctx.config.url);
|
||||
if (!pathname.endsWith('/'))
|
||||
pathname += '/';
|
||||
ctx.config.root = pathname;
|
||||
}
|
||||
config = ctx.config;
|
||||
(0, validate_config_1.default)(ctx);
|
||||
ctx.config_path = configPath;
|
||||
// Trim multiple trailing '/'
|
||||
config.root = config.root.replace(/\/*$/, '/');
|
||||
// Remove any trailing '/'
|
||||
config.url = config.url.replace(/\/+$/, '');
|
||||
ctx.public_dir = (0, path_1.resolve)(baseDir, config.public_dir) + path_1.sep;
|
||||
ctx.source_dir = (0, path_1.resolve)(baseDir, config.source_dir) + path_1.sep;
|
||||
ctx.source = new source_1.default(ctx);
|
||||
if (!config.theme)
|
||||
return;
|
||||
const theme = config.theme.toString();
|
||||
config.theme = theme;
|
||||
const themeDirFromThemes = (0, path_1.join)(baseDir, 'themes', theme) + path_1.sep; // base_dir/themes/[config.theme]/
|
||||
const themeDirFromNodeModules = (0, path_1.join)(ctx.plugin_dir, 'hexo-theme-' + theme) + path_1.sep; // base_dir/node_modules/hexo-theme-[config.theme]/
|
||||
// themeDirFromThemes has higher priority than themeDirFromNodeModules
|
||||
let ignored = [];
|
||||
if (await (0, hexo_fs_1.exists)(themeDirFromThemes)) {
|
||||
ctx.theme_dir = themeDirFromThemes;
|
||||
ignored = ['**/themes/*/node_modules/**', '**/themes/*/.git/**'];
|
||||
}
|
||||
else if (await (0, hexo_fs_1.exists)(themeDirFromNodeModules)) {
|
||||
ctx.theme_dir = themeDirFromNodeModules;
|
||||
ignored = ['**/node_modules/hexo-theme-*/node_modules/**', '**/node_modules/hexo-theme-*/.git/**'];
|
||||
}
|
||||
ctx.theme_script_dir = (0, path_1.join)(ctx.theme_dir, 'scripts') + path_1.sep;
|
||||
ctx.theme = new theme_1.default(ctx, { ignored });
|
||||
};
|
||||
//# sourceMappingURL=load_config.js.map
|
||||
1
node_modules/hexo/dist/hexo/load_config.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/hexo/load_config.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"load_config.js","sourceRoot":"","sources":["../../lib/hexo/load_config.ts"],"names":[],"mappings":";;;;AAAA,+BAAiD;AACjD,sDAA8B;AAC9B,qDAA6B;AAC7B,sDAA8B;AAC9B,qCAA0C;AAC1C,2CAAqC;AACrC,yCAAsC;AACtC,wEAA+C;AA6D/C,KAAK,UAAU,cAAc,CAAC,IAAY;IACxC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,IAAA,YAAK,EAAC,IAAI,CAAC,CAAC;IAElC,MAAM,KAAK,GAAG,MAAM,IAAA,iBAAO,EAAC,GAAG,CAAC,CAAC;IACjC,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;IACvD,IAAI,IAAI,IAAI,IAAI;QAAE,OAAO,IAAA,WAAI,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAC3C,CAAC;AAhED,iBAAS,KAAK,EAAE,GAAS,EAAiB,EAAE;IAC1C,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI;QAAE,OAAO;IAE1B,MAAM,OAAO,GAAG,GAAG,CAAC,QAAQ,CAAC;IAC7B,IAAI,UAAU,GAAG,GAAG,CAAC,WAAW,CAAC;IAEjC,MAAM,IAAI,GAAG,MAAM,IAAA,gBAAM,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,cAAc,CAAC,UAAU,CAAC,CAAC;IACtF,IAAI,CAAC,IAAI;QAAE,OAAO;IAClB,UAAU,GAAG,IAAI,CAAC;IAElB,IAAI,MAAM,GAAG,MAA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AAC;IAC3D,GAAG,CAAC,MAAM,GAAG,IAAI,gBAAM,CAAC,GAAG,CAAC,CAAC;IAE7B,IAAI,CAAC,MAAM,CAAC,KAAK;QAAE,OAAO;IAE1B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IACtC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;IAErB,MAAM,kBAAkB,GAAG,IAAA,WAAI,EAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,GAAG,UAAG,CAAC,CAAC,kCAAkC;IACnG,MAAM,uBAAuB,GAAG,IAAA,WAAI,EAAC,GAAG,CAAC,UAAU,EAAE,aAAa,GAAG,KAAK,CAAC,GAAG,UAAG,CAAC,CAAC,mDAAmD;IAEtI,sEAAsE;IACtE,IAAI,OAAO,GAAa,EAAE,CAAC;IAC3B,IAAI,MAAM,IAAA,gBAAM,EAAC,kBAAkB,CAAC,EAAE,CAAC;QACrC,GAAG,CAAC,SAAS,GAAG,kBAAkB,CAAC;QACnC,OAAO,GAAG,CAAC,6BAA6B,EAAE,qBAAqB,CAAC,CAAC;IACnE,CAAC;SAAM,IAAI,MAAM,IAAA,gBAAM,EAAC,uBAAuB,CAAC,EAAE,CAAC;QACjD,GAAG,CAAC,SAAS,GAAG,uBAAuB,CAAC;QACxC,OAAO,GAAG,CAAC,8CAA8C,EAAE,sCAAsC,CAAC,CAAC;IACrG,CAAC;IACD,GAAG,CAAC,gBAAgB,GAAG,IAAA,WAAI,EAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,GAAG,UAAG,CAAC;IAC5D,GAAG,CAAC,KAAK,GAAG,IAAI,eAAK,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;AAE1C,CAAC,CAAC"}
|
||||
4
node_modules/hexo/dist/hexo/load_database.d.ts
generated
vendored
Normal file
4
node_modules/hexo/dist/hexo/load_database.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import Promise from 'bluebird';
|
||||
import type Hexo from './index';
|
||||
declare const _default: (ctx: Hexo) => Promise<void>;
|
||||
export = _default;
|
||||
25
node_modules/hexo/dist/hexo/load_database.js
generated
vendored
Normal file
25
node_modules/hexo/dist/hexo/load_database.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
const hexo_fs_1 = require("hexo-fs");
|
||||
const bluebird_1 = __importDefault(require("bluebird"));
|
||||
module.exports = (ctx) => {
|
||||
if (ctx._dbLoaded)
|
||||
return bluebird_1.default.resolve();
|
||||
const db = ctx.database;
|
||||
const { path } = db.options;
|
||||
const { log } = ctx;
|
||||
return (0, hexo_fs_1.exists)(path).then(exist => {
|
||||
if (!exist)
|
||||
return;
|
||||
log.debug('Loading database.');
|
||||
return db.load();
|
||||
}).then(() => {
|
||||
ctx._dbLoaded = true;
|
||||
}).catch(() => {
|
||||
log.error('Database load failed. Deleting database.');
|
||||
return (0, hexo_fs_1.unlink)(path);
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=load_database.js.map
|
||||
1
node_modules/hexo/dist/hexo/load_database.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/hexo/load_database.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"load_database.js","sourceRoot":"","sources":["../../lib/hexo/load_database.ts"],"names":[],"mappings":";;;;AAAA,qCAAyC;AACzC,wDAA+B;AAG/B,iBAAS,CAAC,GAAS,EAAiB,EAAE;IACpC,IAAI,GAAG,CAAC,SAAS;QAAE,OAAO,kBAAO,CAAC,OAAO,EAAE,CAAC;IAE5C,MAAM,EAAE,GAAG,GAAG,CAAC,QAAQ,CAAC;IACxB,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC;IAC5B,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;IAEpB,OAAO,IAAA,gBAAM,EAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;QAC/B,IAAI,CAAC,KAAK;YAAE,OAAO;QAEnB,GAAG,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAC/B,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;QACX,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC;IACvB,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;QACZ,GAAG,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;QACtD,OAAO,IAAA,gBAAM,EAAC,IAAI,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
||||
4
node_modules/hexo/dist/hexo/load_plugins.d.ts
generated
vendored
Normal file
4
node_modules/hexo/dist/hexo/load_plugins.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import Promise from 'bluebird';
|
||||
import type Hexo from './index';
|
||||
declare const _default: (ctx: Hexo) => Promise<void[][]>;
|
||||
export = _default;
|
||||
77
node_modules/hexo/dist/hexo/load_plugins.js
generated
vendored
Normal file
77
node_modules/hexo/dist/hexo/load_plugins.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
const path_1 = require("path");
|
||||
const hexo_fs_1 = require("hexo-fs");
|
||||
const bluebird_1 = __importDefault(require("bluebird"));
|
||||
const picocolors_1 = require("picocolors");
|
||||
function loadModuleList(ctx, basedir) {
|
||||
const packagePath = (0, path_1.join)(basedir, 'package.json');
|
||||
// Make sure package.json exists
|
||||
return (0, hexo_fs_1.exists)(packagePath).then(exist => {
|
||||
if (!exist)
|
||||
return [];
|
||||
// Read package.json and find dependencies
|
||||
return (0, hexo_fs_1.readFile)(packagePath).then(content => {
|
||||
const json = JSON.parse(content);
|
||||
const deps = Object.keys(json.dependencies || {});
|
||||
const devDeps = Object.keys(json.devDependencies || {});
|
||||
return basedir === ctx.base_dir ? deps.concat(devDeps) : deps;
|
||||
});
|
||||
}).filter(name => {
|
||||
// Ignore plugins whose name is not started with "hexo-"
|
||||
if (!/^hexo-|^@[^/]+\/hexo-/.test(name))
|
||||
return false;
|
||||
// Ignore plugin whose name is started with "hexo-theme"
|
||||
if (/^hexo-theme-|^@[^/]+\/hexo-theme-/.test(name))
|
||||
return false;
|
||||
// Ignore typescript definition file that is started with "@types/"
|
||||
if (name.startsWith('@types/'))
|
||||
return false;
|
||||
// Make sure the plugin exists
|
||||
const path = ctx.resolvePlugin(name, basedir);
|
||||
return (0, hexo_fs_1.exists)(path);
|
||||
}).then(modules => {
|
||||
return Object.fromEntries(modules.map(name => [name, ctx.resolvePlugin(name, basedir)]));
|
||||
});
|
||||
}
|
||||
function loadModules(ctx) {
|
||||
return bluebird_1.default.map([ctx.base_dir, ctx.theme_dir], basedir => loadModuleList(ctx, basedir))
|
||||
.then(([hexoModuleList, themeModuleList]) => {
|
||||
return Object.entries(Object.assign(themeModuleList, hexoModuleList));
|
||||
})
|
||||
.map(([name, path]) => {
|
||||
// Load plugins
|
||||
return ctx.loadPlugin(path).then(() => {
|
||||
ctx.log.debug('Plugin loaded: %s', (0, picocolors_1.magenta)(name));
|
||||
}).catch(err => {
|
||||
ctx.log.error({ err }, 'Plugin load failed: %s', (0, picocolors_1.magenta)(name));
|
||||
});
|
||||
});
|
||||
}
|
||||
function loadScripts(ctx) {
|
||||
const baseDirLength = ctx.base_dir.length;
|
||||
return bluebird_1.default.filter([
|
||||
ctx.theme_script_dir,
|
||||
ctx.script_dir
|
||||
], scriptDir => {
|
||||
return scriptDir ? (0, hexo_fs_1.exists)(scriptDir) : false;
|
||||
}).map(scriptDir => (0, hexo_fs_1.listDir)(scriptDir).map(name => {
|
||||
const path = (0, path_1.join)(scriptDir, name);
|
||||
return ctx.loadPlugin(path).then(() => {
|
||||
ctx.log.debug('Script loaded: %s', displayPath(path, baseDirLength));
|
||||
}).catch(err => {
|
||||
ctx.log.error({ err }, 'Script load failed: %s', displayPath(path, baseDirLength));
|
||||
});
|
||||
}));
|
||||
}
|
||||
function displayPath(path, baseDirLength) {
|
||||
return (0, picocolors_1.magenta)(path.substring(baseDirLength));
|
||||
}
|
||||
module.exports = (ctx) => {
|
||||
if (!ctx.env.init || ctx.env.safe)
|
||||
return;
|
||||
return loadModules(ctx).then(() => loadScripts(ctx));
|
||||
};
|
||||
//# sourceMappingURL=load_plugins.js.map
|
||||
1
node_modules/hexo/dist/hexo/load_plugins.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/hexo/load_plugins.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"load_plugins.js","sourceRoot":"","sources":["../../lib/hexo/load_plugins.ts"],"names":[],"mappings":";;;;AAAA,+BAA4B;AAC5B,qCAAoD;AACpD,wDAA+B;AAC/B,2CAAqC;AASrC,SAAS,cAAc,CAAC,GAAS,EAAE,OAAe;IAChD,MAAM,WAAW,GAAG,IAAA,WAAI,EAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAElD,gCAAgC;IAChC,OAAO,IAAA,gBAAM,EAAC,WAAW,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;QACtC,IAAI,CAAC,KAAK;YAAE,OAAO,EAAE,CAAC;QAEtB,0CAA0C;QAC1C,OAAO,IAAA,kBAAQ,EAAC,WAAW,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;YAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACjC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;YAClD,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,EA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,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;YACb,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAC,GAAG,EAAC,EAAE,wBAAwB,EAAE,WAAW,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC;QACnF,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC,CAAC;AACN,CAAC;AAED,SAAS,WAAW,CAAC,IAAY,EAAE,aAAqB;IACtD,OAAO,IAAA,oBAAO,EAAC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC;AAChD,CAAC;AA3ED,iBAAS,CAAC,GAAS,EAAqB,EAAE;IACxC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI;QAAE,OAAO;IAE1C,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;AACvD,CAAC,CAAC"}
|
||||
4
node_modules/hexo/dist/hexo/load_theme_config.d.ts
generated
vendored
Normal file
4
node_modules/hexo/dist/hexo/load_theme_config.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import type Hexo from './index';
|
||||
import type Promise from 'bluebird';
|
||||
declare const _default: (ctx: Hexo) => Promise<void>;
|
||||
export = _default;
|
||||
42
node_modules/hexo/dist/hexo/load_theme_config.js
generated
vendored
Normal file
42
node_modules/hexo/dist/hexo/load_theme_config.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
const path_1 = require("path");
|
||||
const tildify_1 = __importDefault(require("tildify"));
|
||||
const hexo_fs_1 = require("hexo-fs");
|
||||
const picocolors_1 = require("picocolors");
|
||||
const hexo_util_1 = require("hexo-util");
|
||||
function findConfigPath(path) {
|
||||
const { dir, name } = (0, path_1.parse)(path);
|
||||
return (0, hexo_fs_1.readdir)(dir).then(files => {
|
||||
const item = files.find(item => item.startsWith(name));
|
||||
if (item != null)
|
||||
return (0, path_1.join)(dir, item);
|
||||
});
|
||||
}
|
||||
module.exports = (ctx) => {
|
||||
if (!ctx.env.init)
|
||||
return;
|
||||
if (!ctx.config.theme)
|
||||
return;
|
||||
let configPath = (0, path_1.join)(ctx.base_dir, `_config.${String(ctx.config.theme)}.yml`);
|
||||
return (0, hexo_fs_1.exists)(configPath).then(exist => {
|
||||
return exist ? configPath : findConfigPath(configPath);
|
||||
}).then(path => {
|
||||
if (!path)
|
||||
return;
|
||||
configPath = path;
|
||||
return ctx.render.render({ path });
|
||||
}).then(config => {
|
||||
if (!config || typeof config !== 'object')
|
||||
return;
|
||||
ctx.log.debug('Second Theme Config loaded: %s', (0, picocolors_1.magenta)((0, tildify_1.default)(configPath)));
|
||||
// ctx.config.theme_config should have highest priority
|
||||
// If ctx.config.theme_config exists, then merge it with _config.[theme].yml
|
||||
// If ctx.config.theme_config doesn't exist, set it to _config.[theme].yml
|
||||
ctx.config.theme_config = ctx.config.theme_config
|
||||
? (0, hexo_util_1.deepMerge)(config, ctx.config.theme_config) : config;
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=load_theme_config.js.map
|
||||
1
node_modules/hexo/dist/hexo/load_theme_config.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/hexo/load_theme_config.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"load_theme_config.js","sourceRoot":"","sources":["../../lib/hexo/load_theme_config.ts"],"names":[],"mappings":";;;;AAAA,+BAAmC;AACnC,sDAA8B;AAC9B,qCAA0C;AAC1C,2CAAqC;AACrC,yCAAsC;AA8BtC,SAAS,cAAc,CAAC,IAAY;IAClC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,IAAA,YAAK,EAAC,IAAI,CAAC,CAAC;IAElC,OAAO,IAAA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,uDAAuD;QACvD,4EAA4E;QAC5E,0EAA0E;QAC1E,GAAG,CAAC,MAAM,CAAC,YAAY,GAAG,GAAG,CAAC,MAAM,CAAC,YAAY;YAC/C,CAAC,CAAC,IAAA,qBAAS,EAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
||||
11
node_modules/hexo/dist/hexo/locals.d.ts
generated
vendored
Normal file
11
node_modules/hexo/dist/hexo/locals.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
declare class Locals {
|
||||
cache: any;
|
||||
getters: any;
|
||||
constructor();
|
||||
get(name: string): any;
|
||||
set(name: string, value: any): this;
|
||||
remove(name: string): this;
|
||||
invalidate(): this;
|
||||
toObject(): {};
|
||||
}
|
||||
export = Locals;
|
||||
52
node_modules/hexo/dist/hexo/locals.js
generated
vendored
Normal file
52
node_modules/hexo/dist/hexo/locals.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
const hexo_util_1 = require("hexo-util");
|
||||
class Locals {
|
||||
constructor() {
|
||||
this.cache = new hexo_util_1.Cache();
|
||||
this.getters = {};
|
||||
}
|
||||
get(name) {
|
||||
if (typeof name !== 'string')
|
||||
throw new TypeError('name must be a string!');
|
||||
return this.cache.apply(name, () => {
|
||||
const getter = this.getters[name];
|
||||
if (!getter)
|
||||
return;
|
||||
return getter();
|
||||
});
|
||||
}
|
||||
set(name, value) {
|
||||
if (typeof name !== 'string')
|
||||
throw new TypeError('name must be a string!');
|
||||
if (value == null)
|
||||
throw new TypeError('value is required!');
|
||||
const getter = typeof value === 'function' ? value : () => value;
|
||||
this.getters[name] = getter;
|
||||
this.cache.del(name);
|
||||
return this;
|
||||
}
|
||||
remove(name) {
|
||||
if (typeof name !== 'string')
|
||||
throw new TypeError('name must be a string!');
|
||||
this.getters[name] = null;
|
||||
this.cache.del(name);
|
||||
return this;
|
||||
}
|
||||
invalidate() {
|
||||
this.cache.flush();
|
||||
return this;
|
||||
}
|
||||
toObject() {
|
||||
const result = {};
|
||||
const keys = Object.keys(this.getters);
|
||||
for (let i = 0, len = keys.length; i < len; i++) {
|
||||
const key = keys[i];
|
||||
const item = this.get(key);
|
||||
if (item != null)
|
||||
result[key] = item;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
module.exports = Locals;
|
||||
//# sourceMappingURL=locals.js.map
|
||||
1
node_modules/hexo/dist/hexo/locals.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/hexo/locals.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"locals.js","sourceRoot":"","sources":["../../lib/hexo/locals.ts"],"names":[],"mappings":";AAAA,yCAAkC;AAElC,MAAM,MAAM;IAIV;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,iBAAK,EAAE,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACpB,CAAC;IAED,GAAG,CAAC,IAAY;QACd,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,MAAM,IAAI,SAAS,CAAC,wBAAwB,CAAC,CAAC;QAE5E,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE;YACjC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAClC,IAAI,CAAC,MAAM;gBAAE,OAAO;YAEpB,OAAO,MAAM,EAAE,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,GAAG,CAAC,IAAY,EAAE,KAAU;QAC1B,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,MAAM,IAAI,SAAS,CAAC,wBAAwB,CAAC,CAAC;QAC5E,IAAI,KAAK,IAAI,IAAI;YAAE,MAAM,IAAI,SAAS,CAAC,oBAAoB,CAAC,CAAC;QAE7D,MAAM,MAAM,GAAG,OAAO,KAAK,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vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type Hexo from './index';
|
||||
declare const _default: (ctx: Hexo) => (base: string, configPaths?: string, outputDir?: string) => string;
|
||||
export = _default;
|
||||
67
node_modules/hexo/dist/hexo/multi_config_path.js
generated
vendored
Normal file
67
node_modules/hexo/dist/hexo/multi_config_path.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
const path_1 = require("path");
|
||||
const hexo_fs_1 = require("hexo-fs");
|
||||
const js_yaml_1 = __importDefault(require("js-yaml"));
|
||||
const hexo_util_1 = require("hexo-util");
|
||||
module.exports = (ctx) => function multiConfigPath(base, configPaths, outputDir) {
|
||||
const { log } = ctx;
|
||||
const defaultPath = (0, path_1.join)(base, '_config.yml');
|
||||
if (!configPaths) {
|
||||
log.w('No config file entered.');
|
||||
return (0, path_1.join)(base, '_config.yml');
|
||||
}
|
||||
let paths;
|
||||
// determine if comma or space separated
|
||||
if (configPaths.includes(',')) {
|
||||
paths = configPaths.replace(' ', '').split(',');
|
||||
}
|
||||
else {
|
||||
// only one config
|
||||
let configPath = (0, path_1.isAbsolute)(configPaths) ? configPaths : (0, path_1.resolve)(base, configPaths);
|
||||
if (!(0, hexo_fs_1.existsSync)(configPath)) {
|
||||
log.w(`Config file ${configPaths} not found, using default.`);
|
||||
configPath = defaultPath;
|
||||
}
|
||||
return configPath;
|
||||
}
|
||||
const numPaths = paths.length;
|
||||
// combine files
|
||||
let combinedConfig = {};
|
||||
let count = 0;
|
||||
for (let i = 0; i < numPaths; i++) {
|
||||
const configPath = (0, path_1.isAbsolute)(paths[i]) ? paths[i] : (0, path_1.join)(base, paths[i]);
|
||||
if (!(0, hexo_fs_1.existsSync)(configPath)) {
|
||||
log.w(`Config file ${paths[i]} not found.`);
|
||||
continue;
|
||||
}
|
||||
// files read synchronously to ensure proper overwrite order
|
||||
const file = (0, hexo_fs_1.readFileSync)(configPath);
|
||||
const ext = (0, path_1.extname)(paths[i]).toLowerCase();
|
||||
if (ext === '.yml') {
|
||||
combinedConfig = (0, hexo_util_1.deepMerge)(combinedConfig, js_yaml_1.default.load(file));
|
||||
count++;
|
||||
}
|
||||
else if (ext === '.json') {
|
||||
combinedConfig = (0, hexo_util_1.deepMerge)(combinedConfig, js_yaml_1.default.load(file, { json: true }));
|
||||
count++;
|
||||
}
|
||||
else {
|
||||
log.w(`Config file ${paths[i]} not supported type.`);
|
||||
}
|
||||
}
|
||||
if (count === 0) {
|
||||
log.e('No config files found. Using _config.yml.');
|
||||
return defaultPath;
|
||||
}
|
||||
log.i('Config based on', count.toString(), 'files');
|
||||
const multiconfigRoot = outputDir || base;
|
||||
const outputPath = (0, path_1.join)(multiconfigRoot, '_multiconfig.yml');
|
||||
log.d(`Writing _multiconfig.yml to ${outputPath}`);
|
||||
(0, hexo_fs_1.writeFileSync)(outputPath, js_yaml_1.default.dump(combinedConfig));
|
||||
// write file and return path
|
||||
return outputPath;
|
||||
};
|
||||
//# sourceMappingURL=multi_config_path.js.map
|
||||
1
node_modules/hexo/dist/hexo/multi_config_path.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/hexo/multi_config_path.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"multi_config_path.js","sourceRoot":"","sources":["../../lib/hexo/multi_config_path.ts"],"names":[],"mappings":";;;;AAAA,+BAA0D;AAC1D,qCAAkE;AAClE,sDAA0B;AAC1B,yCAAsC;AAGtC,iBAAS,CAAC,GAAS,EAAE,EAAE,CAAC,SAAS,eAAe,CAAC,IAAY,EAAE,WAAoB,EAAE,SAAkB;IACrG,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;IACpB,MAAM,WAAW,GAAG,IAAA,WAAI,EAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAE9C,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,GAAG,CA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;IAEpD,6BAA6B;IAC7B,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC"}
|
||||
27
node_modules/hexo/dist/hexo/post.d.ts
generated
vendored
Normal file
27
node_modules/hexo/dist/hexo/post.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import Promise from 'bluebird';
|
||||
import type Hexo from './index';
|
||||
import type { NodeJSLikeCallback, RenderData } from '../types';
|
||||
interface Result {
|
||||
path?: string;
|
||||
content?: string;
|
||||
}
|
||||
interface PostData {
|
||||
title?: string | number;
|
||||
layout?: string;
|
||||
slug?: string | number;
|
||||
path?: string;
|
||||
[prop: string]: any;
|
||||
}
|
||||
declare class Post {
|
||||
context: Hexo;
|
||||
constructor(context: Hexo);
|
||||
create(data: PostData, callback?: NodeJSLikeCallback<any>): any;
|
||||
create(data: PostData, replace: boolean, callback?: NodeJSLikeCallback<any>): any;
|
||||
_getScaffold(layout: string): Promise<string>;
|
||||
_renderScaffold(data: PostData): Promise<string>;
|
||||
publish(data: PostData, replace?: boolean): any;
|
||||
publish(data: PostData, callback?: NodeJSLikeCallback<Result>): any;
|
||||
publish(data: PostData, replace: boolean, callback?: NodeJSLikeCallback<Result>): any;
|
||||
render(source: string, data?: RenderData, callback?: NodeJSLikeCallback<never>): any;
|
||||
}
|
||||
export = Post;
|
||||
410
node_modules/hexo/dist/hexo/post.js
generated
vendored
Normal file
410
node_modules/hexo/dist/hexo/post.js
generated
vendored
Normal file
@@ -0,0 +1,410 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
const assert_1 = __importDefault(require("assert"));
|
||||
const moment_1 = __importDefault(require("moment"));
|
||||
const bluebird_1 = __importDefault(require("bluebird"));
|
||||
const path_1 = require("path");
|
||||
const picocolors_1 = require("picocolors");
|
||||
const js_yaml_1 = require("js-yaml");
|
||||
const hexo_util_1 = require("hexo-util");
|
||||
const hexo_fs_1 = require("hexo-fs");
|
||||
const hexo_front_matter_1 = require("hexo-front-matter");
|
||||
const preservedKeys = ['title', 'slug', 'path', 'layout', 'date', 'content'];
|
||||
const rHexoPostRenderEscape = /<hexoPostRenderCodeBlock>([\s\S]+?)<\/hexoPostRenderCodeBlock>/g;
|
||||
const rSwigPlaceHolder = /(?:<|<)!--swig\uFFFC(\d+)--(?:>|>)/g;
|
||||
const rCodeBlockPlaceHolder = /(?:<|<)!--code\uFFFC(\d+)--(?:>|>)/g;
|
||||
const STATE_PLAINTEXT = Symbol('plaintext');
|
||||
const STATE_SWIG_VAR = Symbol('swig_var');
|
||||
const STATE_SWIG_COMMENT = Symbol('swig_comment');
|
||||
const STATE_SWIG_TAG = Symbol('swig_tag');
|
||||
const STATE_SWIG_FULL_TAG = Symbol('swig_full_tag');
|
||||
const isNonWhiteSpaceChar = (char) => char !== '\r'
|
||||
&& char !== '\n'
|
||||
&& char !== '\t'
|
||||
&& char !== '\f'
|
||||
&& char !== '\v'
|
||||
&& char !== ' ';
|
||||
class PostRenderEscape {
|
||||
constructor() {
|
||||
this.stored = [];
|
||||
}
|
||||
static escapeContent(cache, flag, str) {
|
||||
return `<!--${flag}\uFFFC${cache.push(str) - 1}-->`;
|
||||
}
|
||||
static restoreContent(cache) {
|
||||
return (_, index) => {
|
||||
(0, assert_1.default)(cache[index]);
|
||||
const value = cache[index];
|
||||
cache[index] = null;
|
||||
return value;
|
||||
};
|
||||
}
|
||||
restoreAllSwigTags(str) {
|
||||
const restored = str.replace(rSwigPlaceHolder, PostRenderEscape.restoreContent(this.stored));
|
||||
return restored;
|
||||
}
|
||||
restoreCodeBlocks(str) {
|
||||
return str.replace(rCodeBlockPlaceHolder, PostRenderEscape.restoreContent(this.stored));
|
||||
}
|
||||
escapeCodeBlocks(str) {
|
||||
return str.replace(rHexoPostRenderEscape, (_, content) => PostRenderEscape.escapeContent(this.stored, 'code', content));
|
||||
}
|
||||
/**
|
||||
* @param {string} str
|
||||
* @returns string
|
||||
*/
|
||||
escapeAllSwigTags(str) {
|
||||
if (!/(\{\{.+?\}\})|(\{#.+?#\})|(\{%.+?%\})/s.test(str)) {
|
||||
return str;
|
||||
}
|
||||
let state = STATE_PLAINTEXT;
|
||||
let buffer = '';
|
||||
let output = '';
|
||||
let swig_tag_name_begin = false;
|
||||
let swig_tag_name_end = false;
|
||||
let swig_tag_name = '';
|
||||
let swig_full_tag_start_buffer = '';
|
||||
const { length } = str;
|
||||
for (let idx = 0; idx < length; idx++) {
|
||||
const char = str[idx];
|
||||
const next_char = str[idx + 1];
|
||||
if (state === STATE_PLAINTEXT) { // From plain text to swig
|
||||
if (char === '{') {
|
||||
// check if it is a complete tag {{ }}
|
||||
if (next_char === '{') {
|
||||
state = STATE_SWIG_VAR;
|
||||
idx++;
|
||||
}
|
||||
else if (next_char === '#') {
|
||||
state = STATE_SWIG_COMMENT;
|
||||
idx++;
|
||||
}
|
||||
else if (next_char === '%') {
|
||||
state = STATE_SWIG_TAG;
|
||||
idx++;
|
||||
swig_tag_name = '';
|
||||
swig_full_tag_start_buffer = '';
|
||||
swig_tag_name_begin = false; // Mark if it is the first non white space char in the swig tag
|
||||
swig_tag_name_end = false;
|
||||
}
|
||||
else {
|
||||
output += char;
|
||||
}
|
||||
}
|
||||
else {
|
||||
output += char;
|
||||
}
|
||||
}
|
||||
else if (state === STATE_SWIG_TAG) {
|
||||
if (char === '%' && next_char === '}') { // From swig back to plain text
|
||||
idx++;
|
||||
if (swig_tag_name !== '' && str.includes(`end${swig_tag_name}`)) {
|
||||
state = STATE_SWIG_FULL_TAG;
|
||||
}
|
||||
else {
|
||||
swig_tag_name = '';
|
||||
state = STATE_PLAINTEXT;
|
||||
output += PostRenderEscape.escapeContent(this.stored, 'swig', `{%${buffer}%}`);
|
||||
}
|
||||
buffer = '';
|
||||
}
|
||||
else {
|
||||
buffer = buffer + char;
|
||||
swig_full_tag_start_buffer = swig_full_tag_start_buffer + char;
|
||||
if (isNonWhiteSpaceChar(char)) {
|
||||
if (!swig_tag_name_begin && !swig_tag_name_end) {
|
||||
swig_tag_name_begin = true;
|
||||
}
|
||||
if (swig_tag_name_begin) {
|
||||
swig_tag_name += char;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (swig_tag_name_begin === true) {
|
||||
swig_tag_name_begin = false;
|
||||
swig_tag_name_end = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (state === STATE_SWIG_VAR) {
|
||||
if (char === '}' && next_char === '}') {
|
||||
idx++;
|
||||
state = STATE_PLAINTEXT;
|
||||
output += PostRenderEscape.escapeContent(this.stored, 'swig', `{{${buffer}}}`);
|
||||
buffer = '';
|
||||
}
|
||||
else {
|
||||
buffer = buffer + char;
|
||||
}
|
||||
}
|
||||
else if (state === STATE_SWIG_COMMENT) { // From swig back to plain text
|
||||
if (char === '#' && next_char === '}') {
|
||||
idx++;
|
||||
state = STATE_PLAINTEXT;
|
||||
buffer = '';
|
||||
}
|
||||
}
|
||||
else if (state === STATE_SWIG_FULL_TAG) {
|
||||
if (char === '{' && next_char === '%') {
|
||||
let swig_full_tag_end_buffer = '';
|
||||
let _idx = idx + 2;
|
||||
for (; _idx < length; _idx++) {
|
||||
const _char = str[_idx];
|
||||
const _next_char = str[_idx + 1];
|
||||
if (_char === '%' && _next_char === '}') {
|
||||
_idx++;
|
||||
break;
|
||||
}
|
||||
swig_full_tag_end_buffer = swig_full_tag_end_buffer + _char;
|
||||
}
|
||||
if (swig_full_tag_end_buffer.includes(`end${swig_tag_name}`)) {
|
||||
state = STATE_PLAINTEXT;
|
||||
output += PostRenderEscape.escapeContent(this.stored, 'swig', `{%${swig_full_tag_start_buffer}%}${buffer}{%${swig_full_tag_end_buffer}%}`);
|
||||
idx = _idx;
|
||||
swig_full_tag_start_buffer = '';
|
||||
swig_full_tag_end_buffer = '';
|
||||
buffer = '';
|
||||
}
|
||||
else {
|
||||
buffer += char;
|
||||
}
|
||||
}
|
||||
else {
|
||||
buffer += char;
|
||||
}
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
}
|
||||
const prepareFrontMatter = (data, jsonMode) => {
|
||||
for (const [key, item] of Object.entries(data)) {
|
||||
if (moment_1.default.isMoment(item)) {
|
||||
data[key] = item.utc().format('YYYY-MM-DD HH:mm:ss');
|
||||
}
|
||||
else if (moment_1.default.isDate(item)) {
|
||||
data[key] = moment_1.default.utc(item).format('YYYY-MM-DD HH:mm:ss');
|
||||
}
|
||||
else if (typeof item === 'string') {
|
||||
if (jsonMode || item.includes(':') || item.startsWith('#') || item.startsWith('!!')
|
||||
|| item.includes('{') || item.includes('}') || item.includes('[') || item.includes(']')
|
||||
|| item.includes('\'') || item.includes('"'))
|
||||
data[key] = `"${item.replace(/"/g, '\\"')}"`;
|
||||
}
|
||||
}
|
||||
return data;
|
||||
};
|
||||
const removeExtname = (str) => {
|
||||
return str.substring(0, str.length - (0, path_1.extname)(str).length);
|
||||
};
|
||||
const createAssetFolder = (path, assetFolder) => {
|
||||
if (!assetFolder)
|
||||
return bluebird_1.default.resolve();
|
||||
const target = removeExtname(path);
|
||||
if ((0, path_1.basename)(target) === 'index')
|
||||
return bluebird_1.default.resolve();
|
||||
return (0, hexo_fs_1.exists)(target).then(exist => {
|
||||
if (!exist)
|
||||
return (0, hexo_fs_1.mkdirs)(target);
|
||||
});
|
||||
};
|
||||
class Post {
|
||||
constructor(context) {
|
||||
this.context = context;
|
||||
}
|
||||
create(data, replace, callback) {
|
||||
if (!callback && typeof replace === 'function') {
|
||||
callback = replace;
|
||||
replace = false;
|
||||
}
|
||||
const ctx = this.context;
|
||||
const { config } = ctx;
|
||||
data.slug = (0, hexo_util_1.slugize)((data.slug || data.title).toString(), { transform: config.filename_case });
|
||||
data.layout = (data.layout || config.default_layout).toLowerCase();
|
||||
data.date = data.date ? (0, moment_1.default)(data.date) : (0, moment_1.default)();
|
||||
return bluebird_1.default.all([
|
||||
// Get the post path
|
||||
ctx.execFilter('new_post_path', data, {
|
||||
args: [replace],
|
||||
context: ctx
|
||||
}),
|
||||
this._renderScaffold(data)
|
||||
]).spread((path, content) => {
|
||||
const result = { path, content };
|
||||
return bluebird_1.default.all([
|
||||
// Write content to file
|
||||
(0, hexo_fs_1.writeFile)(path, content),
|
||||
// Create asset folder
|
||||
createAssetFolder(path, config.post_asset_folder)
|
||||
]).then(() => {
|
||||
ctx.emit('new', result);
|
||||
return result;
|
||||
});
|
||||
}).asCallback(callback);
|
||||
}
|
||||
_getScaffold(layout) {
|
||||
const ctx = this.context;
|
||||
return ctx.scaffold.get(layout).then(result => {
|
||||
if (result != null)
|
||||
return result;
|
||||
return ctx.scaffold.get('normal');
|
||||
});
|
||||
}
|
||||
_renderScaffold(data) {
|
||||
const { tag } = this.context.extend;
|
||||
let splitted;
|
||||
return this._getScaffold(data.layout).then(scaffold => {
|
||||
splitted = (0, hexo_front_matter_1.split)(scaffold);
|
||||
const jsonMode = splitted.separator.startsWith(';');
|
||||
const frontMatter = prepareFrontMatter({ ...data }, jsonMode);
|
||||
return tag.render(splitted.data, frontMatter);
|
||||
}).then(frontMatter => {
|
||||
const { separator } = splitted;
|
||||
const jsonMode = separator.startsWith(';');
|
||||
// Parse front-matter
|
||||
let obj = jsonMode ? JSON.parse(`{${frontMatter}}`) : (0, js_yaml_1.load)(frontMatter);
|
||||
obj = (0, hexo_util_1.deepMerge)(obj, Object.fromEntries(Object.entries(data).filter(([key, value]) => !preservedKeys.includes(key) && value != null)));
|
||||
let content = '';
|
||||
// Prepend the separator
|
||||
if (splitted.prefixSeparator)
|
||||
content += `${separator}\n`;
|
||||
content += (0, hexo_front_matter_1.stringify)(obj, {
|
||||
mode: jsonMode ? 'json' : ''
|
||||
});
|
||||
// Concat content
|
||||
content += splitted.content;
|
||||
if (data.content) {
|
||||
content += `\n${data.content}`;
|
||||
}
|
||||
return content;
|
||||
});
|
||||
}
|
||||
publish(data, replace, callback) {
|
||||
if (!callback && typeof replace === 'function') {
|
||||
callback = replace;
|
||||
replace = false;
|
||||
}
|
||||
if (data.layout === 'draft')
|
||||
data.layout = 'post';
|
||||
const ctx = this.context;
|
||||
const { config } = ctx;
|
||||
const draftDir = (0, path_1.join)(ctx.source_dir, '_drafts');
|
||||
const slug = (0, hexo_util_1.slugize)(data.slug.toString(), { transform: config.filename_case });
|
||||
data.slug = slug;
|
||||
const regex = new RegExp(`^${(0, hexo_util_1.escapeRegExp)(slug)}(?:[^\\/\\\\]+)`);
|
||||
let src = '';
|
||||
const result = {};
|
||||
data.layout = (data.layout || config.default_layout).toLowerCase();
|
||||
// Find the draft
|
||||
return (0, hexo_fs_1.listDir)(draftDir).then(list => {
|
||||
const item = list.find(item => regex.test(item));
|
||||
if (!item)
|
||||
throw new Error(`Draft "${slug}" does not exist.`);
|
||||
// Read the content
|
||||
src = (0, path_1.join)(draftDir, item);
|
||||
return (0, hexo_fs_1.readFile)(src);
|
||||
}).then(content => {
|
||||
// Create post
|
||||
Object.assign(data, (0, hexo_front_matter_1.parse)(content));
|
||||
data.content = data._content;
|
||||
data._content = undefined;
|
||||
return this.create(data, replace);
|
||||
}).then(post => {
|
||||
result.path = post.path;
|
||||
result.content = post.content;
|
||||
return (0, hexo_fs_1.unlink)(src);
|
||||
}).then(() => {
|
||||
if (!config.post_asset_folder)
|
||||
return;
|
||||
// Copy assets
|
||||
const assetSrc = removeExtname(src);
|
||||
const assetDest = removeExtname(result.path);
|
||||
return (0, hexo_fs_1.exists)(assetSrc).then(exist => {
|
||||
if (!exist)
|
||||
return;
|
||||
return (0, hexo_fs_1.copyDir)(assetSrc, assetDest).then(() => (0, hexo_fs_1.rmdir)(assetSrc));
|
||||
});
|
||||
}).thenReturn(result).asCallback(callback);
|
||||
}
|
||||
render(source, data = {}, callback) {
|
||||
const ctx = this.context;
|
||||
const { config } = ctx;
|
||||
const { tag } = ctx.extend;
|
||||
const ext = data.engine || (source ? (0, path_1.extname)(source) : '');
|
||||
let promise;
|
||||
if (data.content != null) {
|
||||
promise = bluebird_1.default.resolve(data.content);
|
||||
}
|
||||
else if (source) {
|
||||
// Read content from files
|
||||
promise = (0, hexo_fs_1.readFile)(source);
|
||||
}
|
||||
else {
|
||||
return bluebird_1.default.reject(new Error('No input file or string!')).asCallback(callback);
|
||||
}
|
||||
// Files like js and css are also processed by this function, but they do not require preprocessing like markdown
|
||||
// data.source does not exist when tag plugins call the markdown renderer
|
||||
const isPost = !data.source || ['html', 'htm'].includes(ctx.render.getOutput(data.source));
|
||||
if (!isPost) {
|
||||
return promise.then(content => {
|
||||
data.content = content;
|
||||
ctx.log.debug('Rendering file: %s', (0, picocolors_1.magenta)(source));
|
||||
return ctx.render.render({
|
||||
text: data.content,
|
||||
path: source,
|
||||
engine: data.engine,
|
||||
toString: true
|
||||
});
|
||||
}).then(content => {
|
||||
data.content = content;
|
||||
return data;
|
||||
}).asCallback(callback);
|
||||
}
|
||||
// disable Nunjucks when the renderer specify that.
|
||||
let disableNunjucks = ext && ctx.render.renderer.get(ext) && !!ctx.render.renderer.get(ext).disableNunjucks;
|
||||
// front-matter overrides renderer's option
|
||||
if (typeof data.disableNunjucks === 'boolean')
|
||||
disableNunjucks = data.disableNunjucks;
|
||||
const cacheObj = new PostRenderEscape();
|
||||
return promise.then(content => {
|
||||
data.content = content;
|
||||
// Run "before_post_render" filters
|
||||
return ctx.execFilter('before_post_render', data, { context: ctx });
|
||||
}).then(() => {
|
||||
data.content = cacheObj.escapeCodeBlocks(data.content);
|
||||
// Escape all Nunjucks/Swig tags
|
||||
if (disableNunjucks === false) {
|
||||
data.content = cacheObj.escapeAllSwigTags(data.content);
|
||||
}
|
||||
const options = data.markdown || {};
|
||||
if (!config.syntax_highlighter)
|
||||
options.highlight = null;
|
||||
ctx.log.debug('Rendering post: %s', (0, picocolors_1.magenta)(source));
|
||||
// Render with markdown or other renderer
|
||||
return ctx.render.render({
|
||||
text: data.content,
|
||||
path: source,
|
||||
engine: data.engine,
|
||||
toString: true,
|
||||
onRenderEnd(content) {
|
||||
// Replace cache data with real contents
|
||||
data.content = cacheObj.restoreAllSwigTags(content);
|
||||
// Return content after replace the placeholders
|
||||
if (disableNunjucks)
|
||||
return data.content;
|
||||
// Render with Nunjucks
|
||||
return tag.render(data.content, data);
|
||||
}
|
||||
}, options);
|
||||
}).then(content => {
|
||||
data.content = cacheObj.restoreCodeBlocks(content);
|
||||
// Run "after_post_render" filters
|
||||
return ctx.execFilter('after_post_render', data, { context: ctx });
|
||||
}).asCallback(callback);
|
||||
}
|
||||
}
|
||||
module.exports = Post;
|
||||
//# sourceMappingURL=post.js.map
|
||||
1
node_modules/hexo/dist/hexo/post.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/hexo/post.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/hexo/dist/hexo/register_models.d.ts
generated
vendored
Normal file
3
node_modules/hexo/dist/hexo/register_models.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type Hexo from './index';
|
||||
declare const _default: (ctx: Hexo) => void;
|
||||
export = _default;
|
||||
34
node_modules/hexo/dist/hexo/register_models.js
generated
vendored
Normal file
34
node_modules/hexo/dist/hexo/register_models.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
const models = __importStar(require("../models"));
|
||||
module.exports = (ctx) => {
|
||||
const db = ctx.database;
|
||||
const keys = Object.keys(models);
|
||||
for (let i = 0, len = keys.length; i < len; i++) {
|
||||
const key = keys[i];
|
||||
db.model(key, models[key](ctx));
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=register_models.js.map
|
||||
1
node_modules/hexo/dist/hexo/register_models.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/hexo/register_models.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"register_models.js","sourceRoot":"","sources":["../../lib/hexo/register_models.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAoC;AAGpC,iBAAS,CAAC,GAAS,EAAQ,EAAE;IAC3B,MAAM,EAAE,GAAG,GAAG,CAAC,QAAQ,CAAC;IAExB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QAChD,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAClC,CAAC;AACH,CAAC,CAAC"}
|
||||
19
node_modules/hexo/dist/hexo/render.d.ts
generated
vendored
Normal file
19
node_modules/hexo/dist/hexo/render.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import Promise from 'bluebird';
|
||||
import type Hexo from './index';
|
||||
import type { Renderer } from '../extend';
|
||||
import type { StoreFunction, StoreFunctionData, StoreSyncFunction } from '../extend/renderer';
|
||||
import { NodeJSLikeCallback } from '../types';
|
||||
declare class Render {
|
||||
context: Hexo;
|
||||
renderer: Renderer;
|
||||
constructor(ctx: Hexo);
|
||||
isRenderable(path: string): boolean;
|
||||
isRenderableSync(path: string): boolean;
|
||||
getOutput(path: string): string;
|
||||
getRenderer(ext: string, sync?: boolean): StoreSyncFunction | StoreFunction;
|
||||
getRendererSync(ext: string): StoreSyncFunction | StoreFunction;
|
||||
render(data: StoreFunctionData, callback?: NodeJSLikeCallback<any>): Promise<any>;
|
||||
render(data: StoreFunctionData, options: any, callback?: NodeJSLikeCallback<any>): Promise<any>;
|
||||
renderSync(data: StoreFunctionData, options?: {}): any;
|
||||
}
|
||||
export = Render;
|
||||
120
node_modules/hexo/dist/hexo/render.js
generated
vendored
Normal file
120
node_modules/hexo/dist/hexo/render.js
generated
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
const path_1 = require("path");
|
||||
const bluebird_1 = __importDefault(require("bluebird"));
|
||||
const hexo_fs_1 = require("hexo-fs");
|
||||
const getExtname = (str) => {
|
||||
if (typeof str !== 'string')
|
||||
return '';
|
||||
const ext = (0, path_1.extname)(str);
|
||||
return ext.startsWith('.') ? ext.slice(1) : ext;
|
||||
};
|
||||
const toString = (result, options) => {
|
||||
if (!Object.prototype.hasOwnProperty.call(options, 'toString') || typeof result === 'string')
|
||||
return result;
|
||||
if (typeof options.toString === 'function') {
|
||||
return options.toString(result);
|
||||
}
|
||||
else if (typeof result === 'object') {
|
||||
return JSON.stringify(result);
|
||||
}
|
||||
else if (result.toString) {
|
||||
return result.toString();
|
||||
}
|
||||
return result;
|
||||
};
|
||||
class Render {
|
||||
constructor(ctx) {
|
||||
this.context = ctx;
|
||||
this.renderer = ctx.extend.renderer;
|
||||
}
|
||||
isRenderable(path) {
|
||||
return this.renderer.isRenderable(path);
|
||||
}
|
||||
isRenderableSync(path) {
|
||||
return this.renderer.isRenderableSync(path);
|
||||
}
|
||||
getOutput(path) {
|
||||
return this.renderer.getOutput(path);
|
||||
}
|
||||
getRenderer(ext, sync) {
|
||||
return this.renderer.get(ext, sync);
|
||||
}
|
||||
getRendererSync(ext) {
|
||||
return this.getRenderer(ext, true);
|
||||
}
|
||||
render(data, options, callback) {
|
||||
if (!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
const ctx = this.context;
|
||||
let ext = '';
|
||||
let promise;
|
||||
if (!data)
|
||||
return bluebird_1.default.reject(new TypeError('No input file or string!'));
|
||||
if (data.text != null) {
|
||||
promise = bluebird_1.default.resolve(data.text);
|
||||
}
|
||||
else if (!data.path) {
|
||||
return bluebird_1.default.reject(new TypeError('No input file or string!'));
|
||||
}
|
||||
else {
|
||||
promise = (0, hexo_fs_1.readFile)(data.path);
|
||||
}
|
||||
return promise.then(text => {
|
||||
data.text = text;
|
||||
ext = data.engine || getExtname(data.path);
|
||||
if (!ext || !this.isRenderable(ext))
|
||||
return text;
|
||||
const renderer = this.getRenderer(ext);
|
||||
return Reflect.apply(renderer, ctx, [data, options]);
|
||||
}).then(result => {
|
||||
result = toString(result, data);
|
||||
if (data.onRenderEnd) {
|
||||
return data.onRenderEnd(result);
|
||||
}
|
||||
return result;
|
||||
}).then(result => {
|
||||
const output = this.getOutput(ext) || ext;
|
||||
return ctx.execFilter(`after_render:${output}`, result, {
|
||||
context: ctx,
|
||||
args: [data]
|
||||
});
|
||||
}).asCallback(callback);
|
||||
}
|
||||
renderSync(data, options = {}) {
|
||||
if (!data)
|
||||
throw new TypeError('No input file or string!');
|
||||
const ctx = this.context;
|
||||
if (data.text == null) {
|
||||
if (!data.path)
|
||||
throw new TypeError('No input file or string!');
|
||||
data.text = (0, hexo_fs_1.readFileSync)(data.path);
|
||||
}
|
||||
if (data.text == null)
|
||||
throw new TypeError('No input file or string!');
|
||||
const ext = data.engine || getExtname(data.path);
|
||||
let result;
|
||||
if (ext && this.isRenderableSync(ext)) {
|
||||
const renderer = this.getRendererSync(ext);
|
||||
result = Reflect.apply(renderer, ctx, [data, options]);
|
||||
}
|
||||
else {
|
||||
result = data.text;
|
||||
}
|
||||
const output = this.getOutput(ext) || ext;
|
||||
result = toString(result, data);
|
||||
if (data.onRenderEnd) {
|
||||
result = data.onRenderEnd(result);
|
||||
}
|
||||
return ctx.execFilterSync(`after_render:${output}`, result, {
|
||||
context: ctx,
|
||||
args: [data]
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports = Render;
|
||||
//# sourceMappingURL=render.js.map
|
||||
1
node_modules/hexo/dist/hexo/render.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/hexo/render.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../lib/hexo/render.ts"],"names":[],"mappings":";;;;AAAA,+BAA+B;AAC/B,wDAA+B;AAC/B,qCAAiD;AAMjD,MAAM,UAAU,GAAG,CAAC,GAAW,EAAU,EAAE;IACzC,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAC;IAEvC,MAAM,GAAG,GAAG,IAAA,cAAO,EAAC,GAAG,CAAC,CAAC;IACzB,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAClD,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,CAAC,MAAW,EAAE,OAA0B,EAAE,EAAE;IAC3D,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC;IAE5G,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,UA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AE,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;QACzD,CAAC;aAAM,CAAC;YACN,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC;QACrB,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC;QAC1C,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAEhC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QACpC,CAAC;QAED,OAAO,GAAG,CAAC,cAAc,CAAC,gBAAgB,MAAM,EAAE,EAAE,MAAM,EAAE;YAC1D,OAAO,EAAE,GAAG;YACZ,IAAI,EAAE,CAAC,IAAI,CAAC;SACb,CAAC,CAAC;IACL,CAAC;CACF;AAED,iBAAS,MAAM,CAAC"}
|
||||
37
node_modules/hexo/dist/hexo/router.d.ts
generated
vendored
Normal file
37
node_modules/hexo/dist/hexo/router.d.ts
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
/// <reference path="router.d.ts" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import { EventEmitter } from 'events';
|
||||
declare const Readable: typeof import("stream").Readable;
|
||||
interface Data {
|
||||
data: any;
|
||||
modified: boolean;
|
||||
}
|
||||
declare module 'stream' {
|
||||
export default class _Stream extends Stream {
|
||||
readable: boolean;
|
||||
}
|
||||
}
|
||||
declare class RouteStream extends Readable {
|
||||
_data: any;
|
||||
_ended: boolean;
|
||||
modified: boolean;
|
||||
constructor(data: Data);
|
||||
_toBuffer(data: Buffer | object | string): Buffer | null;
|
||||
_read(): boolean;
|
||||
}
|
||||
declare class Router extends EventEmitter {
|
||||
routes: {
|
||||
[key: string]: Data | null;
|
||||
};
|
||||
emit: any;
|
||||
constructor();
|
||||
list(): string[];
|
||||
format(path?: string): string;
|
||||
get(path: string): RouteStream;
|
||||
isModified(path: string): boolean;
|
||||
set(path: string, data: any): this;
|
||||
remove(path: string): this;
|
||||
}
|
||||
export = Router;
|
||||
149
node_modules/hexo/dist/hexo/router.js
generated
vendored
Normal file
149
node_modules/hexo/dist/hexo/router.js
generated
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
const events_1 = require("events");
|
||||
const bluebird_1 = __importDefault(require("bluebird"));
|
||||
const stream_1 = __importDefault(require("stream"));
|
||||
const { Readable } = stream_1.default;
|
||||
class RouteStream extends Readable {
|
||||
constructor(data) {
|
||||
super({ objectMode: true });
|
||||
this._data = data.data;
|
||||
this._ended = false;
|
||||
this.modified = data.modified;
|
||||
}
|
||||
// Assume we only accept Buffer, plain object, or string
|
||||
_toBuffer(data) {
|
||||
if (data instanceof Buffer) {
|
||||
return data;
|
||||
}
|
||||
if (typeof data === 'object') {
|
||||
data = JSON.stringify(data);
|
||||
}
|
||||
if (typeof data === 'string') {
|
||||
return Buffer.from(data); // Assume string is UTF-8 encoded string
|
||||
}
|
||||
return null;
|
||||
}
|
||||
_read() {
|
||||
const data = this._data;
|
||||
if (typeof data !== 'function') {
|
||||
const bufferData = this._toBuffer(data);
|
||||
if (bufferData) {
|
||||
this.push(bufferData);
|
||||
}
|
||||
this.push(null);
|
||||
return;
|
||||
}
|
||||
// Don't read it twice!
|
||||
if (this._ended)
|
||||
return false;
|
||||
this._ended = true;
|
||||
data().then(data => {
|
||||
if (data instanceof stream_1.default && data.readable) {
|
||||
data.on('data', d => {
|
||||
this.push(d);
|
||||
});
|
||||
data.on('end', () => {
|
||||
this.push(null);
|
||||
});
|
||||
data.on('error', err => {
|
||||
this.emit('error', err);
|
||||
});
|
||||
}
|
||||
else {
|
||||
const bufferData = this._toBuffer(data);
|
||||
if (bufferData) {
|
||||
this.push(bufferData);
|
||||
}
|
||||
this.push(null);
|
||||
}
|
||||
}).catch(err => {
|
||||
this.emit('error', err);
|
||||
this.push(null);
|
||||
});
|
||||
}
|
||||
}
|
||||
const _format = (path) => {
|
||||
path = path || '';
|
||||
if (typeof path !== 'string')
|
||||
throw new TypeError('path must be a string!');
|
||||
path = path
|
||||
.replace(/^\/+/, '') // Remove prefixed slashes
|
||||
.replace(/\\/g, '/') // Replaces all backslashes
|
||||
.replace(/\?.*$/, ''); // Remove query string
|
||||
// Appends `index.html` to the path with trailing slash
|
||||
if (!path || path.endsWith('/')) {
|
||||
path += 'index.html';
|
||||
}
|
||||
return path;
|
||||
};
|
||||
class Router extends events_1.EventEmitter {
|
||||
constructor() {
|
||||
super();
|
||||
this.routes = {};
|
||||
}
|
||||
list() {
|
||||
const { routes } = this;
|
||||
return Object.keys(routes).filter(key => routes[key]);
|
||||
}
|
||||
format(path) {
|
||||
return _format(path);
|
||||
}
|
||||
get(path) {
|
||||
if (typeof path !== 'string')
|
||||
throw new TypeError('path must be a string!');
|
||||
const data = this.routes[this.format(path)];
|
||||
if (data == null)
|
||||
return;
|
||||
return new RouteStream(data);
|
||||
}
|
||||
isModified(path) {
|
||||
if (typeof path !== 'string')
|
||||
throw new TypeError('path must be a string!');
|
||||
const data = this.routes[this.format(path)];
|
||||
return data ? data.modified : false;
|
||||
}
|
||||
set(path, data) {
|
||||
if (typeof path !== 'string')
|
||||
throw new TypeError('path must be a string!');
|
||||
if (data == null)
|
||||
throw new TypeError('data is required!');
|
||||
let obj;
|
||||
if (typeof data === 'object' && data.data != null) {
|
||||
obj = data;
|
||||
}
|
||||
else {
|
||||
obj = {
|
||||
data,
|
||||
modified: true
|
||||
};
|
||||
}
|
||||
if (typeof obj.data === 'function') {
|
||||
if (obj.data.length) {
|
||||
obj.data = bluebird_1.default.promisify(obj.data);
|
||||
}
|
||||
else {
|
||||
obj.data = bluebird_1.default.method(obj.data);
|
||||
}
|
||||
}
|
||||
path = this.format(path);
|
||||
this.routes[path] = {
|
||||
data: obj.data,
|
||||
modified: obj.modified == null ? true : obj.modified
|
||||
};
|
||||
this.emit('update', path);
|
||||
return this;
|
||||
}
|
||||
remove(path) {
|
||||
if (typeof path !== 'string')
|
||||
throw new TypeError('path must be a string!');
|
||||
path = this.format(path);
|
||||
this.routes[path] = null;
|
||||
this.emit('remove', path);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
module.exports = Router;
|
||||
//# sourceMappingURL=router.js.map
|
||||
1
node_modules/hexo/dist/hexo/router.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/hexo/router.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"router.js","sourceRoot":"","sources":["../../lib/hexo/router.ts"],"names":[],"mappings":";;;;AAAA,mCAAsC;AACtC,wDAA+B;AAC/B,oDAA4B;AAC5B,MAAM,EAAE,QAAQ,EAAE,GAAG,gBAAM,CAAC;AAa5B,MAAM,WAAY,SAAQ,QAAQ;IAKhC,YAAY,IAAU;QACpB,KAAK,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QAE5B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAChC,CAAC;IAED,wDAAwD;IACxD,SAAS,CAAC,IAA8B;QACtC,IAAI,IAAI,YAAY,MAAM,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC9B,CAAC;QACD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,wCAAwC;QACpE,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IA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,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACtC,CAAC;QACH,CAAC;QAED,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAEzB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG;YAClB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,QAAQ,EAAE,GAAG,CAAC,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ;SACrD,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAE1B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,IAAY;QACjB,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,MAAM,IAAI,SAAS,CAAC,wBAAwB,CAAC,CAAC;QAC5E,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAEzB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAE1B,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,iBAAS,MAAM,CAAC"}
|
||||
23
node_modules/hexo/dist/hexo/scaffold.d.ts
generated
vendored
Normal file
23
node_modules/hexo/dist/hexo/scaffold.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import type Hexo from './index';
|
||||
import type { NodeJSLikeCallback } from '../types';
|
||||
import type Promise from 'bluebird';
|
||||
declare class Scaffold {
|
||||
context: Hexo;
|
||||
scaffoldDir: string;
|
||||
defaults: {
|
||||
normal: string;
|
||||
};
|
||||
constructor(context: Hexo);
|
||||
_listDir(): Promise<{
|
||||
name: string;
|
||||
path: string;
|
||||
}[]>;
|
||||
_getScaffold(name: string): Promise<{
|
||||
name: string;
|
||||
path: string;
|
||||
}>;
|
||||
get(name: string, callback?: NodeJSLikeCallback<any>): Promise<string>;
|
||||
set(name: string, content: any, callback?: NodeJSLikeCallback<void>): Promise<void>;
|
||||
remove(name: string, callback?: NodeJSLikeCallback<void>): Promise<void>;
|
||||
}
|
||||
export = Scaffold;
|
||||
61
node_modules/hexo/dist/hexo/scaffold.js
generated
vendored
Normal file
61
node_modules/hexo/dist/hexo/scaffold.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
"use strict";
|
||||
const path_1 = require("path");
|
||||
const hexo_fs_1 = require("hexo-fs");
|
||||
class Scaffold {
|
||||
constructor(context) {
|
||||
this.context = context;
|
||||
this.scaffoldDir = context.scaffold_dir;
|
||||
this.defaults = {
|
||||
normal: [
|
||||
'---',
|
||||
'layout: {{ layout }}',
|
||||
'title: {{ title }}',
|
||||
'date: {{ date }}',
|
||||
'tags:',
|
||||
'---'
|
||||
].join('\n')
|
||||
};
|
||||
}
|
||||
_listDir() {
|
||||
const { scaffoldDir } = this;
|
||||
return (0, hexo_fs_1.exists)(scaffoldDir).then(exist => {
|
||||
if (!exist)
|
||||
return [];
|
||||
return (0, hexo_fs_1.listDir)(scaffoldDir, {
|
||||
ignorePattern: /^_|\/_/
|
||||
});
|
||||
}).map(item => ({
|
||||
name: item.substring(0, item.length - (0, path_1.extname)(item).length),
|
||||
path: (0, path_1.join)(scaffoldDir, item)
|
||||
}));
|
||||
}
|
||||
_getScaffold(name) {
|
||||
return this._listDir().then(list => list.find(item => item.name === name));
|
||||
}
|
||||
get(name, callback) {
|
||||
return this._getScaffold(name).then(item => {
|
||||
if (item) {
|
||||
return (0, hexo_fs_1.readFile)(item.path);
|
||||
}
|
||||
return this.defaults[name];
|
||||
}).asCallback(callback);
|
||||
}
|
||||
set(name, content, callback) {
|
||||
const { scaffoldDir } = this;
|
||||
return this._getScaffold(name).then(item => {
|
||||
let path = item ? item.path : (0, path_1.join)(scaffoldDir, name);
|
||||
if (!(0, path_1.extname)(path))
|
||||
path += '.md';
|
||||
return (0, hexo_fs_1.writeFile)(path, content);
|
||||
}).asCallback(callback);
|
||||
}
|
||||
remove(name, callback) {
|
||||
return this._getScaffold(name).then(item => {
|
||||
if (!item)
|
||||
return;
|
||||
return (0, hexo_fs_1.unlink)(item.path);
|
||||
}).asCallback(callback);
|
||||
}
|
||||
}
|
||||
module.exports = Scaffold;
|
||||
//# sourceMappingURL=scaffold.js.map
|
||||
1
node_modules/hexo/dist/hexo/scaffold.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/hexo/scaffold.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"scaffold.js","sourceRoot":"","sources":["../../lib/hexo/scaffold.ts"],"names":[],"mappings":";AAAA,+BAAqC;AACrC,qCAAuE;AAKvE,MAAM,QAAQ;IAOZ,YAAY,OAAa;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;QACxC,IAAI,CAAC,QAAQ,GAAG;YACd,MAAM,EAAE;gBACN,KAAK;gBACL,sBAAsB;gBACtB,oBAAoB;gBACpB,kBAAkB;gBAClB,OAAO;gBACP,KAAK;aACN,CAAC,IAAI,CAAC,IAAI,CAAC;SACb,CAAC;IACJ,CAAC;IAED,QAAQ;QAIN,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;QAE7B,OAAO,IAAA,gBAAM,EAAC,WAAW,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YACtC,IAAI,CAAC,KAAK;gBAAE,OAAO,EAAE,CAAC;YAEtB,OAAO,IAAA,iBAAO,EAAC,WAAW,EAAE;gBAC1B,aAAa,EAAE,QAAQ;aACxB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,IAAA,cAAO,EAAC,IAAI,CAA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,QAAmC;QACtD,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACzC,IAAI,CAAC,IAAI;gBAAE,OAAO;YAElB,OAAO,IAAA,gBAAM,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC1B,CAAC;CACF;AAED,iBAAS,QAAQ,CAAC"}
|
||||
6
node_modules/hexo/dist/hexo/source.d.ts
generated
vendored
Normal file
6
node_modules/hexo/dist/hexo/source.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import Box from '../box';
|
||||
import type Hexo from './index';
|
||||
declare class Source extends Box {
|
||||
constructor(ctx: Hexo);
|
||||
}
|
||||
export = Source;
|
||||
13
node_modules/hexo/dist/hexo/source.js
generated
vendored
Normal file
13
node_modules/hexo/dist/hexo/source.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
const box_1 = __importDefault(require("../box"));
|
||||
class Source extends box_1.default {
|
||||
constructor(ctx) {
|
||||
super(ctx, ctx.source_dir);
|
||||
this.processors = ctx.extend.processor.list();
|
||||
}
|
||||
}
|
||||
module.exports = Source;
|
||||
//# sourceMappingURL=source.js.map
|
||||
1
node_modules/hexo/dist/hexo/source.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/hexo/source.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"source.js","sourceRoot":"","sources":["../../lib/hexo/source.ts"],"names":[],"mappings":";;;;AAAA,iDAAyB;AAGzB,MAAM,MAAO,SAAQ,aAAG;IACtB,YAAY,GAAS;QACnB,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC;QAE3B,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;IAChD,CAAC;CACF;AAED,iBAAS,MAAM,CAAC"}
|
||||
4
node_modules/hexo/dist/hexo/update_package.d.ts
generated
vendored
Normal file
4
node_modules/hexo/dist/hexo/update_package.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import type Hexo from './index';
|
||||
import type Promise from 'bluebird';
|
||||
declare const _default: (ctx: Hexo) => Promise<void>;
|
||||
export = _default;
|
||||
29
node_modules/hexo/dist/hexo/update_package.js
generated
vendored
Normal file
29
node_modules/hexo/dist/hexo/update_package.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
const path_1 = require("path");
|
||||
const hexo_fs_1 = require("hexo-fs");
|
||||
function readPkg(path) {
|
||||
return (0, hexo_fs_1.exists)(path).then(exist => {
|
||||
if (!exist)
|
||||
return;
|
||||
return (0, hexo_fs_1.readFile)(path).then(content => {
|
||||
const pkg = JSON.parse(content);
|
||||
if (typeof pkg.hexo !== 'object')
|
||||
return;
|
||||
return pkg;
|
||||
});
|
||||
});
|
||||
}
|
||||
module.exports = (ctx) => {
|
||||
const pkgPath = (0, path_1.join)(ctx.base_dir, 'package.json');
|
||||
return readPkg(pkgPath).then(pkg => {
|
||||
if (!pkg)
|
||||
return;
|
||||
ctx.env.init = true;
|
||||
if (pkg.hexo.version === ctx.version)
|
||||
return;
|
||||
pkg.hexo.version = ctx.version;
|
||||
ctx.log.debug('Updating package.json');
|
||||
return (0, hexo_fs_1.writeFile)(pkgPath, JSON.stringify(pkg, null, ' '));
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=update_package.js.map
|
||||
1
node_modules/hexo/dist/hexo/update_package.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/hexo/update_package.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"update_package.js","sourceRoot":"","sources":["../../lib/hexo/update_package.ts"],"names":[],"mappings":";AAAA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@ -0,0 +1,3 @@
|
||||
import type Hexo from './index';
|
||||
declare const _default: (ctx: Hexo) => void;
|
||||
export = _default;
|
||||
23
node_modules/hexo/dist/hexo/validate_config.js
generated
vendored
Normal file
23
node_modules/hexo/dist/hexo/validate_config.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
module.exports = (ctx) => {
|
||||
const { config, log } = ctx;
|
||||
log.info('Validating config');
|
||||
// Validation for config.url && config.root
|
||||
if (typeof config.url !== 'string') {
|
||||
throw new TypeError(`Invalid config detected: "url" should be string, not ${typeof config.url}!`);
|
||||
}
|
||||
try {
|
||||
// eslint-disable-next-line no-new
|
||||
new URL(config.url);
|
||||
}
|
||||
catch {
|
||||
throw new TypeError('Invalid config detected: "url" should be a valid URL!');
|
||||
}
|
||||
if (typeof config.root !== 'string') {
|
||||
throw new TypeError(`Invalid config detected: "root" should be string, not ${typeof config.root}!`);
|
||||
}
|
||||
if (config.root.trim().length <= 0) {
|
||||
throw new TypeError('Invalid config detected: "root" should not be empty!');
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=validate_config.js.map
|
||||
1
node_modules/hexo/dist/hexo/validate_config.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/hexo/validate_config.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"validate_config.js","sourceRoot":"","sources":["../../lib/hexo/validate_config.ts"],"names":[],"mappings":";AAEA,iBAAS,CAAC,GAAS,EAAQ,EAAE;IAC3B,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;IAE5B,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAE9B,2CAA2C;IAC3C,IAAI,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;QACnC,MAAM,IAAI,SAAS,CAAC,wDAAwD,OAAO,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC;IACpG,CAAC;IACD,IAAI,CAAC;QACH,kCAAkC;QAClC,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACtB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,SAAS,CAAC,uDAAuD,CAAC,CAAC;IAC/E,CAAC;IAED,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACpC,MAAM,IAAI,SAAS,CAAC,yDAAyD,OAAO,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC;IACtG,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,SAAS,CAAC,sDAAsD,CAAC,CAAC;IAC9E,CAAC;AACH,CAAC,CAAC"}
|
||||
3
node_modules/hexo/dist/models/asset.d.ts
generated
vendored
Normal file
3
node_modules/hexo/dist/models/asset.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type Hexo from '../hexo';
|
||||
declare const _default: (ctx: Hexo) => import("warehouse/dist/schema").default;
|
||||
export = _default;
|
||||
19
node_modules/hexo/dist/models/asset.js
generated
vendored
Normal file
19
node_modules/hexo/dist/models/asset.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
const warehouse_1 = __importDefault(require("warehouse"));
|
||||
const path_1 = require("path");
|
||||
module.exports = (ctx) => {
|
||||
const Asset = new warehouse_1.default.Schema({
|
||||
_id: { type: String, required: true },
|
||||
path: { type: String, required: true },
|
||||
modified: { type: Boolean, default: true },
|
||||
renderable: { type: Boolean, default: true }
|
||||
});
|
||||
Asset.virtual('source').get(function () {
|
||||
return (0, path_1.join)(ctx.base_dir, this._id);
|
||||
});
|
||||
return Asset;
|
||||
};
|
||||
//# sourceMappingURL=asset.js.map
|
||||
1
node_modules/hexo/dist/models/asset.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/models/asset.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"asset.js","sourceRoot":"","sources":["../../lib/models/asset.ts"],"names":[],"mappings":";;;;AAAA,0DAAkC;AAClC,+BAA4B;AAG5B,iBAAS,CAAC,GAAS,EAAE,EAAE;IACrB,MAAM,KAAK,GAAG,IAAI,mBAAS,CAAC,MAAM,CAAC;QACjC,GAAG,EAAE,EAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAC;QACnC,IAAI,EAAE,EAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAC;QACpC,QAAQ,EAAE,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC;QACxC,UAAU,EAAE,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC;KAC3C,CAAC,CAAC;IAEH,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC;QAC1B,OAAO,IAAA,WAAI,EAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
||||
3
node_modules/hexo/dist/models/cache.d.ts
generated
vendored
Normal file
3
node_modules/hexo/dist/models/cache.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type Hexo from '../hexo';
|
||||
declare const _default: (ctx: Hexo) => import("warehouse/dist/schema").default;
|
||||
export = _default;
|
||||
60
node_modules/hexo/dist/models/cache.js
generated
vendored
Normal file
60
node_modules/hexo/dist/models/cache.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
const warehouse_1 = __importDefault(require("warehouse"));
|
||||
const bluebird_1 = __importDefault(require("bluebird"));
|
||||
module.exports = (ctx) => {
|
||||
const Cache = new warehouse_1.default.Schema({
|
||||
_id: { type: String, required: true },
|
||||
hash: { type: String, default: '' },
|
||||
modified: { type: Number, default: Date.now() } // UnixTime
|
||||
});
|
||||
Cache.static('compareFile', function (id, hashFn, statFn) {
|
||||
const cache = this.findById(id);
|
||||
// If cache does not exist, then it must be a new file. We have to get both
|
||||
// file hash and stats.
|
||||
if (!cache) {
|
||||
return bluebird_1.default.all([hashFn(id), statFn(id)]).spread((hash, stats) => this.insert({
|
||||
_id: id,
|
||||
hash,
|
||||
modified: stats.mtime.getTime()
|
||||
})).thenReturn({
|
||||
type: 'create'
|
||||
});
|
||||
}
|
||||
let mtime;
|
||||
// Get file stats
|
||||
return statFn(id).then(stats => {
|
||||
mtime = stats.mtime.getTime();
|
||||
// Skip the file if the modified time is unchanged
|
||||
if (cache.modified === mtime) {
|
||||
return {
|
||||
type: 'skip'
|
||||
};
|
||||
}
|
||||
// Get file hash
|
||||
return hashFn(id);
|
||||
}).then(result => {
|
||||
// If the result is an object, skip the following steps because it's an
|
||||
// unchanged file
|
||||
if (typeof result === 'object')
|
||||
return result;
|
||||
const hash = result;
|
||||
// Skip the file if the hash is unchanged
|
||||
if (cache.hash === hash) {
|
||||
return {
|
||||
type: 'skip'
|
||||
};
|
||||
}
|
||||
// Update cache info
|
||||
cache.hash = hash;
|
||||
cache.modified = mtime;
|
||||
return cache.save().thenReturn({
|
||||
type: 'update'
|
||||
});
|
||||
});
|
||||
});
|
||||
return Cache;
|
||||
};
|
||||
//# sourceMappingURL=cache.js.map
|
||||
1
node_modules/hexo/dist/models/cache.js.map
generated
vendored
Normal file
1
node_modules/hexo/dist/models/cache.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../lib/models/cache.ts"],"names":[],"mappings":";;;;AAAA,0DAAkC;AAClC,wDAA+B;AAG/B,iBAAS,CAAC,GAAS,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ED,gBAAgB;YAChB,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC;QACpB,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YACf,uEAAuE;YACvE,iBAAiB;YACjB,IAAI,OAAO,MAAM,KAAK,QAAQ;gBAAE,OAAO,MAAM,CAAC;YAE9C,MAAM,IAAI,GAAG,MAAM,CAAC;YAEpB,yCAAyC;YACzC,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;gBACxB,OAAO;oBACL,IAAI,EAAE,MAAM;iBACb,CAAC;YACJ,CAAC;YAED,oBAAoB;YACpB,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;YAClB,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC;YAEvB,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC;gBAC7B,IAAI,EAAE,QAAQ;aACf,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
||||
3
node_modules/hexo/dist/models/category.d.ts
generated
vendored
Normal file
3
node_modules/hexo/dist/models/category.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type Hexo from '../hexo';
|
||||
declare const _default: (ctx: Hexo) => import("warehouse/dist/schema").default;
|
||||
export = _default;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user