Skip to content

Commit

Permalink
fix bug #553
Browse files Browse the repository at this point in the history
  • Loading branch information
aui committed Sep 25, 2018
1 parent db4db6b commit 771ec16
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 20 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## v4.13.1

1. 修复在某些情况 runtime 提示 window 未定义的问题 [#553](https://github.com/aui/art-template/issues/553)

## v4.13.0

1. 修复超大模板编译性能问题 [#539](https://github.com/aui/art-template/issues/539)[#4](https://github.com/aui/express-art-template/issues/4)
Expand Down
2 changes: 1 addition & 1 deletion lib/compile/adapter/html-minifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }

var detectNode = require('detect-node');
var detectNode = typeof window === 'undefined';

/**
* HTML 压缩器
Expand Down
2 changes: 1 addition & 1 deletion lib/compile/adapter/loader.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var detectNode = require('detect-node');
var detectNode = typeof window === 'undefined';

/**
* 读取模板内容(同步方法)
Expand Down
3 changes: 2 additions & 1 deletion lib/compile/defaults.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

var detectNode = require('detect-node');
var runtime = require('./runtime');
var extend = require('./adapter/extend');
var include = require('./adapter/include');
Expand All @@ -12,6 +11,8 @@ var nativeRule = require('./adapter/rule.native');
var htmlMinifier = require('./adapter/html-minifier');
var resolveFilename = require('./adapter/resolve-filename');

var detectNode = typeof window === 'undefined';

/** 模板编译器默认配置 */
var settings = {
// 模板内容。如果没有此字段,则会根据 filename 来加载模板内容
Expand Down
2 changes: 1 addition & 1 deletion lib/compile/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/*! art-template@runtime | https://github.com/aui/art-template */

var detectNode = require('detect-node');
var detectNode = typeof window === 'undefined';
var runtime = Object.create(detectNode ? global : window);
var ESCAPE_REG = /["&'<>]/;

Expand Down
6 changes: 3 additions & 3 deletions lib/template-web.js

Large diffs are not rendered by default.

7 changes: 1 addition & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"typings": "index.d.ts",
"description": "JavaScript Template Engine",
"homepage": "http://aui.github.com/art-template/",
"version": "4.13.0",
"version": "4.13.1",
"keywords": [
"template"
],
Expand All @@ -29,7 +29,6 @@
},
"dependencies": {
"acorn": "^5.0.3",
"detect-node": "^2.0.3",
"escodegen": "^1.8.1",
"estraverse": "^4.2.0",
"html-minifier": "^3.4.3",
Expand Down
2 changes: 1 addition & 1 deletion src/compile/adapter/html-minifier.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const detectNode = require('detect-node');
const detectNode = typeof window === 'undefined';

/**
* HTML 压缩器
Expand Down
2 changes: 1 addition & 1 deletion src/compile/adapter/loader.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const detectNode = require('detect-node');
const detectNode = typeof window === 'undefined';

/**
* 读取模板内容(同步方法)
Expand Down
2 changes: 1 addition & 1 deletion src/compile/adapter/resolve-filename.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const detectNode = require('detect-node');
const detectNode = typeof window === 'undefined';
const LOCAL_MODULE = /^\.+\//;

/**
Expand Down
3 changes: 2 additions & 1 deletion src/compile/defaults.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const detectNode = require('detect-node');
const runtime = require('./runtime');
const extend = require('./adapter/extend');
const include = require('./adapter/include');
Expand All @@ -10,6 +9,8 @@ const nativeRule = require('./adapter/rule.native');
const htmlMinifier = require('./adapter/html-minifier');
const resolveFilename = require('./adapter/resolve-filename');

const detectNode = typeof window === 'undefined';

/** 模板编译器默认配置 */
const settings = {
// 模板内容。如果没有此字段,则会根据 filename 来加载模板内容
Expand Down
2 changes: 1 addition & 1 deletion src/compile/runtime.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*! art-template@runtime | https://github.com/aui/art-template */

const detectNode = require('detect-node');
const detectNode = typeof window === 'undefined';
const runtime = Object.create(detectNode ? global : window);
const ESCAPE_REG = /["&'<>]/;

Expand Down

0 comments on commit 771ec16

Please sign in to comment.