@twreporter/core 1.22.1 → 1.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/constants/category-set.js +27 -48
- package/lib/constants/color.js +20 -24
- package/lib/constants/donation-link-anchor.js +2 -3
- package/lib/constants/email-subscription.js +2 -3
- package/lib/constants/entity-path.js +2 -3
- package/lib/constants/external-links.js +2 -3
- package/lib/constants/font.js +5 -9
- package/lib/constants/fundraising.js +2 -4
- package/lib/constants/html-attributes.js +2 -3
- package/lib/constants/infogram.js +1 -2
- package/lib/constants/link-type.js +3 -9
- package/lib/constants/member-role.js +3 -6
- package/lib/constants/predefined-css.js +1 -2
- package/lib/constants/prop-types.js +2 -10
- package/lib/constants/read-preference.js +7 -10
- package/lib/constants/reading-time-unit.js +7 -10
- package/lib/constants/release-branch.js +4 -12
- package/lib/constants/request-origins.js +6 -9
- package/lib/constants/site-meta.js +1 -2
- package/lib/constants/size.js +2 -9
- package/lib/constants/storage.js +2 -3
- package/lib/constants/theme.js +7 -13
- package/lib/constants/z-index.js +2 -3
- package/lib/utils/css.js +2 -8
- package/lib/utils/date.js +0 -1
- package/lib/utils/global-env.js +1 -4
- package/lib/utils/media-query.js +2 -8
- package/lib/utils/sign-in-href.js +1 -7
- package/lib/utils/sign-out-href.js +1 -7
- package/lib/utils/smooth-scroll.js +1 -10
- package/lib/utils/storage-url-processor.js +4 -8
- package/lib/utils/truncate.js +0 -1
- package/package.json +2 -2
- package/CHANGELOG.md +0 -726
|
@@ -4,15 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _releaseBranch = _interopRequireDefault(require("./release-branch"));
|
|
9
|
-
|
|
10
8
|
var _forServerSideRenderi, _forClientSideRenderi;
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
-
|
|
14
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
-
|
|
10
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
11
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
13
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
16
14
|
var forServerSideRendering = (_forServerSideRenderi = {}, _defineProperty(_forServerSideRenderi, _releaseBranch["default"].master, {
|
|
17
15
|
accounts: 'http://localhost:3001',
|
|
18
16
|
api: 'http://localhost:8080',
|
|
@@ -45,8 +43,7 @@ var forServerSideRendering = (_forServerSideRenderi = {}, _defineProperty(_forSe
|
|
|
45
43
|
support: 'https://dev-support.twreporter.org'
|
|
46
44
|
}), _forServerSideRenderi);
|
|
47
45
|
var forClientSideRendering = (_forClientSideRenderi = {}, _defineProperty(_forClientSideRenderi, _releaseBranch["default"].master, forServerSideRendering[_releaseBranch["default"].master]), _defineProperty(_forClientSideRenderi, _releaseBranch["default"].test, forServerSideRendering[_releaseBranch["default"].test]), _defineProperty(_forClientSideRenderi, _releaseBranch["default"].staging, forServerSideRendering[_releaseBranch["default"].staging]), _defineProperty(_forClientSideRenderi, _releaseBranch["default"].preview, forServerSideRendering[_releaseBranch["default"].preview]), _defineProperty(_forClientSideRenderi, _releaseBranch["default"].release, forServerSideRendering[_releaseBranch["default"].release]), _defineProperty(_forClientSideRenderi, _releaseBranch["default"].dev, forServerSideRendering[_releaseBranch["default"].dev]), _forClientSideRenderi);
|
|
48
|
-
var _default = {
|
|
46
|
+
var _default = exports["default"] = {
|
|
49
47
|
forClientSideRendering: forClientSideRendering,
|
|
50
48
|
forServerSideRendering: forServerSideRendering
|
|
51
|
-
};
|
|
52
|
-
exports["default"] = _default;
|
|
49
|
+
};
|
|
@@ -4,5 +4,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.shortDescription = void 0;
|
|
7
|
-
var shortDescription = '《報導者》是台灣第一個由公益基金會成立的網路媒體,秉持深度、開放、非營利的精神,致力於公共領域調查報導,與社會共同打造多元進步的媒體環境。';
|
|
8
|
-
exports.shortDescription = shortDescription;
|
|
7
|
+
var shortDescription = exports.shortDescription = '《報導者》是台灣第一個由公益基金會成立的網路媒體,秉持深度、開放、非營利的精神,致力於公共領域調查報導,與社會共同打造多元進步的媒體環境。';
|
package/lib/constants/size.js
CHANGED
|
@@ -4,17 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.SIZE_PROP_TYPES = exports.SIZE = void 0;
|
|
7
|
-
|
|
8
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
|
-
var SIZE = {
|
|
9
|
+
var SIZE = exports.SIZE = {
|
|
13
10
|
S: 'S',
|
|
14
11
|
L: 'L'
|
|
15
12
|
};
|
|
16
|
-
exports.
|
|
17
|
-
|
|
18
|
-
var SIZE_PROP_TYPES = _propTypes["default"].oneOf([SIZE.S, SIZE.L]);
|
|
19
|
-
|
|
20
|
-
exports.SIZE_PROP_TYPES = SIZE_PROP_TYPES;
|
|
13
|
+
var SIZE_PROP_TYPES = exports.SIZE_PROP_TYPES = _propTypes["default"].oneOf([SIZE.S, SIZE.L]);
|
package/lib/constants/storage.js
CHANGED
|
@@ -4,9 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.google = void 0;
|
|
7
|
-
var google = {
|
|
7
|
+
var google = exports.google = {
|
|
8
8
|
schema: 'https',
|
|
9
9
|
hostname: 'storage.googleapis.com',
|
|
10
10
|
bucket: 'twreporter-multimedia'
|
|
11
|
-
};
|
|
12
|
-
exports.google = google;
|
|
11
|
+
};
|
package/lib/constants/theme.js
CHANGED
|
@@ -4,29 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.THEME_PROP_TYPES = exports.THEME = exports.ARTICLE_THEME = void 0;
|
|
7
|
-
|
|
8
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
|
-
var THEME = Object.freeze({
|
|
9
|
+
var THEME = exports.THEME = Object.freeze({
|
|
13
10
|
normal: 'normal',
|
|
14
11
|
photography: 'photography',
|
|
15
12
|
transparent: 'transparent',
|
|
16
13
|
index: 'index'
|
|
17
14
|
});
|
|
18
|
-
exports.
|
|
15
|
+
var THEME_PROP_TYPES = exports.THEME_PROP_TYPES = _propTypes["default"].oneOf([THEME.normal, THEME.photography, THEME.transparent, THEME.index]);
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
exports.THEME_PROP_TYPES = THEME_PROP_TYPES;
|
|
24
|
-
var ARTICLE_THEME = Object.freeze({
|
|
17
|
+
// the value of ARTICLE_THEME is correspond to posts.style
|
|
18
|
+
var ARTICLE_THEME = exports.ARTICLE_THEME = Object.freeze({
|
|
25
19
|
v2: {
|
|
26
20
|
pink: 'article:v2:pink',
|
|
27
21
|
"default": 'article:v2:default',
|
|
28
22
|
photo: 'article:v2:photo',
|
|
29
|
-
interactive: 'interactive'
|
|
23
|
+
interactive: 'interactive',
|
|
24
|
+
embedded: 'article:v2:embedded'
|
|
30
25
|
}
|
|
31
|
-
});
|
|
32
|
-
exports.ARTICLE_THEME = ARTICLE_THEME;
|
|
26
|
+
});
|
package/lib/constants/z-index.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
var _default = {
|
|
7
|
+
var _default = exports["default"] = {
|
|
8
8
|
topBanner: 9999,
|
|
9
9
|
// use in GTM
|
|
10
10
|
articleImgFullScreenMask: 7000,
|
|
@@ -20,5 +20,4 @@ var _default = {
|
|
|
20
20
|
embedUp: 800,
|
|
21
21
|
mobileToolBar: 700,
|
|
22
22
|
embedDown: 600
|
|
23
|
-
};
|
|
24
|
-
exports["default"] = _default;
|
|
23
|
+
};
|
package/lib/utils/css.js
CHANGED
|
@@ -4,16 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.arrayToCssShorthand = arrayToCssShorthand;
|
|
7
|
-
|
|
8
7
|
var _map = _interopRequireDefault(require("lodash/map"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
13
|
-
|
|
9
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
14
10
|
var _ = {
|
|
15
11
|
map: _map["default"]
|
|
16
12
|
};
|
|
13
|
+
|
|
17
14
|
/**
|
|
18
15
|
*
|
|
19
16
|
*
|
|
@@ -22,7 +19,6 @@ var _ = {
|
|
|
22
19
|
* @param {string} [unit='px']
|
|
23
20
|
* @returns {string}
|
|
24
21
|
*/
|
|
25
|
-
|
|
26
22
|
function arrayToCssShorthand() {
|
|
27
23
|
var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
28
24
|
var unit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'px';
|
|
@@ -30,10 +26,8 @@ function arrayToCssShorthand() {
|
|
|
30
26
|
switch (_typeof(value)) {
|
|
31
27
|
case 'number':
|
|
32
28
|
return value === 0 ? '0' : "".concat(value).concat(unit);
|
|
33
|
-
|
|
34
29
|
case 'string':
|
|
35
30
|
return value;
|
|
36
|
-
|
|
37
31
|
default:
|
|
38
32
|
return '';
|
|
39
33
|
}
|
package/lib/utils/date.js
CHANGED
package/lib/utils/global-env.js
CHANGED
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getGlobalEnv = getGlobalEnv;
|
|
7
|
-
|
|
8
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
9
|
-
|
|
7
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
10
8
|
/*
|
|
11
9
|
Webpack defined plugin may replace the value of process.env.NODE_ENV directly.
|
|
12
10
|
So we cannot retireve the value via `_.get(process, 'env.NODE_ENV`)` since process.env is a empty object that the plugin won't touch.
|
|
@@ -17,7 +15,6 @@ var globalEnv = {
|
|
|
17
15
|
nodeEnv: isEnvExists && process.env.NODE_ENV || 'development',
|
|
18
16
|
releaseBranch: isEnvExists && process.env.RELEASE_BRANCH || 'master'
|
|
19
17
|
};
|
|
20
|
-
|
|
21
18
|
function getGlobalEnv() {
|
|
22
19
|
return globalEnv;
|
|
23
20
|
}
|
package/lib/utils/media-query.js
CHANGED
|
@@ -5,10 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.DEFAULT_SCREEN = void 0;
|
|
7
7
|
exports.getMediaQueryUtil = getMediaQueryUtil;
|
|
8
|
-
|
|
9
8
|
var _styledComponents = require("styled-components");
|
|
10
|
-
|
|
11
|
-
var DEFAULT_SCREEN = Object.freeze({
|
|
9
|
+
var DEFAULT_SCREEN = exports.DEFAULT_SCREEN = Object.freeze({
|
|
12
10
|
tablet: {
|
|
13
11
|
minWidth: 768
|
|
14
12
|
},
|
|
@@ -19,8 +17,6 @@ var DEFAULT_SCREEN = Object.freeze({
|
|
|
19
17
|
minWidth: 1440
|
|
20
18
|
}
|
|
21
19
|
});
|
|
22
|
-
exports.DEFAULT_SCREEN = DEFAULT_SCREEN;
|
|
23
|
-
|
|
24
20
|
function getMediaQueryUtil() {
|
|
25
21
|
var screen = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_SCREEN;
|
|
26
22
|
return {
|
|
@@ -50,7 +46,5 @@ function getMediaQueryUtil() {
|
|
|
50
46
|
}
|
|
51
47
|
};
|
|
52
48
|
}
|
|
53
|
-
|
|
54
49
|
var defaultMq = getMediaQueryUtil(DEFAULT_SCREEN);
|
|
55
|
-
var _default = defaultMq;
|
|
56
|
-
exports["default"] = _default;
|
|
50
|
+
var _default = exports["default"] = defaultMq;
|
|
@@ -4,22 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getSignInHref = getSignInHref;
|
|
7
|
-
|
|
8
7
|
var _requestOrigins = _interopRequireDefault(require("../constants/request-origins"));
|
|
9
|
-
|
|
10
8
|
var _globalEnv = require("./global-env");
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
-
|
|
14
10
|
var _getGlobalEnv = (0, _globalEnv.getGlobalEnv)(),
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
releaseBranch = _getGlobalEnv.releaseBranch;
|
|
17
12
|
var signInSearchKeys = {
|
|
18
13
|
destination: 'destination'
|
|
19
14
|
};
|
|
20
15
|
var signInPathname = '/signin';
|
|
21
16
|
var mainHref = _requestOrigins["default"].forClientSideRendering[releaseBranch].main;
|
|
22
|
-
|
|
23
17
|
function getSignInHref() {
|
|
24
18
|
var destination = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : mainHref;
|
|
25
19
|
var signInOrigin = _requestOrigins["default"].forClientSideRendering[releaseBranch].accounts;
|
|
@@ -4,22 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getSignOutHref = getSignOutHref;
|
|
7
|
-
|
|
8
7
|
var _requestOrigins = _interopRequireDefault(require("../constants/request-origins"));
|
|
9
|
-
|
|
10
8
|
var _globalEnv = require("./global-env");
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
-
|
|
14
10
|
var _getGlobalEnv = (0, _globalEnv.getGlobalEnv)(),
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
releaseBranch = _getGlobalEnv.releaseBranch;
|
|
17
12
|
var signOutSearchKeys = {
|
|
18
13
|
destination: 'destination'
|
|
19
14
|
};
|
|
20
15
|
var signOutPathname = '/v2/auth/logout';
|
|
21
16
|
var mainHref = _requestOrigins["default"].forClientSideRendering[releaseBranch].main;
|
|
22
|
-
|
|
23
17
|
function getSignOutHref() {
|
|
24
18
|
var destination = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : mainHref;
|
|
25
19
|
var signOutOrigin = _requestOrigins["default"].forClientSideRendering[releaseBranch].api;
|
|
@@ -11,8 +11,8 @@ exports["default"] = _default;
|
|
|
11
11
|
// of 'smoothScroll' lib. (ref: https://github.com/alicelieutier/smoothScroll/blob/master/smoothscroll.js)
|
|
12
12
|
// P.S. We don't use 'smoothScroll' directly due to it will apply smooth scroll behavior to ALL anchors
|
|
13
13
|
// in the website automatically.
|
|
14
|
-
var defaultDuration = 500;
|
|
15
14
|
|
|
15
|
+
var defaultDuration = 500;
|
|
16
16
|
function _default(el, duration, callback, context) {
|
|
17
17
|
var position = function position(start, end, elapsed, duration) {
|
|
18
18
|
if (elapsed > duration) return end;
|
|
@@ -25,37 +25,29 @@ function _default(el, duration, callback, context) {
|
|
|
25
25
|
if (element.nodeName === 'HTML') return -start;
|
|
26
26
|
return element.getBoundingClientRect().top + start;
|
|
27
27
|
};
|
|
28
|
-
|
|
29
28
|
var easeInOutQuint = function easeInOutQuint(t) {
|
|
30
29
|
return t < 0.5 ? 16 * t * t * t * t * t : 1 - Math.pow(-2 * t + 2, 5) / 2;
|
|
31
30
|
};
|
|
32
|
-
|
|
33
31
|
duration = duration || defaultDuration;
|
|
34
32
|
context = context || window;
|
|
35
33
|
var start = context.scrollTop || window.pageYOffset;
|
|
36
34
|
var end;
|
|
37
|
-
|
|
38
35
|
if (typeof el === 'number') {
|
|
39
36
|
end = parseInt(el);
|
|
40
37
|
} else {
|
|
41
38
|
end = getTop(el, start);
|
|
42
39
|
}
|
|
43
|
-
|
|
44
40
|
var clock = Date.now();
|
|
45
|
-
|
|
46
41
|
var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || function (fn) {
|
|
47
42
|
window.setTimeout(fn, 15);
|
|
48
43
|
};
|
|
49
|
-
|
|
50
44
|
var step = function step() {
|
|
51
45
|
var elapsed = Date.now() - clock;
|
|
52
|
-
|
|
53
46
|
if (context !== window) {
|
|
54
47
|
context.scrollTop = position(start, end, elapsed, duration);
|
|
55
48
|
} else {
|
|
56
49
|
window.scroll(0, position(start, end, elapsed, duration));
|
|
57
50
|
}
|
|
58
|
-
|
|
59
51
|
if (elapsed > duration) {
|
|
60
52
|
if (typeof callback === 'function') {
|
|
61
53
|
callback(el);
|
|
@@ -64,6 +56,5 @@ function _default(el, duration, callback, context) {
|
|
|
64
56
|
requestAnimationFrame(step);
|
|
65
57
|
}
|
|
66
58
|
};
|
|
67
|
-
|
|
68
59
|
step();
|
|
69
60
|
}
|
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.replaceGCSUrlOrigin = replaceGCSUrlOrigin;
|
|
7
|
-
|
|
8
7
|
var _globalEnv = require("./global-env");
|
|
9
|
-
|
|
10
8
|
var storage = {
|
|
11
9
|
google: {
|
|
12
10
|
schema: 'https',
|
|
@@ -17,6 +15,7 @@ var storage = {
|
|
|
17
15
|
var mainSite = {
|
|
18
16
|
url: 'https://www.twreporter.org'
|
|
19
17
|
};
|
|
18
|
+
|
|
20
19
|
/**
|
|
21
20
|
* Replace Google Cloud Storage url origin with the origin of main site
|
|
22
21
|
*
|
|
@@ -25,20 +24,17 @@ var mainSite = {
|
|
|
25
24
|
* @param {boolean} [forceToReplace=false] The defaut action is not to replace the origin when nodeEnv==='development', use the para to overwrite it.
|
|
26
25
|
* @returns
|
|
27
26
|
*/
|
|
28
|
-
|
|
29
27
|
function replaceGCSUrlOrigin() {
|
|
30
28
|
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
31
29
|
var forceToReplace = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
32
30
|
var isDev = (0, _globalEnv.getGlobalEnv)().nodeEnv === 'development';
|
|
33
|
-
|
|
34
31
|
if (!forceToReplace && (isDev || typeof url !== 'string')) {
|
|
35
32
|
return url;
|
|
36
33
|
}
|
|
37
|
-
|
|
38
34
|
var _storage$google = storage.google,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
schema = _storage$google.schema,
|
|
36
|
+
hostname = _storage$google.hostname,
|
|
37
|
+
bucket = _storage$google.bucket;
|
|
42
38
|
var toReplace = mainSite.url;
|
|
43
39
|
var toBeReplaced = "".concat(schema, "://").concat(hostname, "/").concat(bucket);
|
|
44
40
|
return url.replace(toBeReplaced, toReplace);
|
package/lib/utils/truncate.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twreporter/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.0",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"repository": "https://github.com/twreporter/twreporter-npm-packages.git",
|
|
6
6
|
"author": "twreporter <developer@twreporter.org>",
|
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
"files": [
|
|
21
21
|
"lib"
|
|
22
22
|
],
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "4fdc214fd7117dd0af4a323053dfdb2a77884247"
|
|
24
24
|
}
|