macro-parameters 0.0.2 → 0.0.3
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/{bundle.js → index.js} +9 -1
- package/package.json +6 -3
- package/rollup.config.ts +2 -2
- package/src/main.ts +5 -0
package/{bundle.js → index.js}
RENAMED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsdom = require('jsdom');
|
|
4
|
+
|
|
1
5
|
function getCookie(name) {
|
|
2
6
|
const reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
|
|
3
7
|
let arr;
|
|
@@ -15,6 +19,10 @@ function getLocalStorage(name) {
|
|
|
15
19
|
return null;
|
|
16
20
|
}
|
|
17
21
|
|
|
22
|
+
var JSDOM = jsdom.JSDOM;
|
|
23
|
+
var dom = new JSDOM("<!DOCTYPE html><p>Hello world</p>");
|
|
24
|
+
window = dom.window;
|
|
25
|
+
document = window.document;
|
|
18
26
|
var PlaceHolders = {
|
|
19
27
|
"[tv_domain]": function () {
|
|
20
28
|
return document.domain;
|
|
@@ -173,4 +181,4 @@ var MacroSubstitution = /** @class */ (function () {
|
|
|
173
181
|
return MacroSubstitution;
|
|
174
182
|
}());
|
|
175
183
|
|
|
176
|
-
|
|
184
|
+
module.exports = MacroSubstitution;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "macro-parameters",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Provide unified macro parameter retrieval",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"
|
|
7
|
+
"build": "rollup --config rollup.config.ts --configPlugin typescript2"
|
|
8
8
|
},
|
|
9
9
|
"author": "caiyuanjia",
|
|
10
10
|
"license": "ISC",
|
|
@@ -12,5 +12,8 @@
|
|
|
12
12
|
"rollup": "^4.21.1",
|
|
13
13
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
14
14
|
"typescript": "^5.5.4"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"jsdom": "^25.0.0"
|
|
15
18
|
}
|
|
16
19
|
}
|
package/rollup.config.ts
CHANGED
package/src/main.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { getCookie, getLocalStorage } from "../script/utils"
|
|
2
|
+
import jsdom from "jsdom";
|
|
3
|
+
const { JSDOM } = jsdom;
|
|
4
|
+
const dom = new JSDOM(`<!DOCTYPE html><p>Hello world</p>`);
|
|
5
|
+
window = dom.window;
|
|
6
|
+
document = window.document;
|
|
2
7
|
const PlaceHolders: any = {
|
|
3
8
|
"[tv_domain]"() {
|
|
4
9
|
return document.domain
|