svelte-readme 3.6.2 → 3.6.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/CHANGELOG.md +4 -0
- package/dist/createConfig.js +5 -5
- package/dist/preprocessReadme.js +13 -13
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [3.6.3](https://github.com/metonym/svelte-readme/releases/tag/v3.6.3) - 2022-02-25
|
|
9
|
+
|
|
10
|
+
- patch dependencies to resolve security warnings
|
|
11
|
+
|
|
8
12
|
## [3.6.2](https://github.com/metonym/svelte-readme/releases/tag/v3.6.2) - 2021-12-29
|
|
9
13
|
|
|
10
14
|
- remove deprecated `svelteBracketNewLine` prettier option
|
package/dist/createConfig.js
CHANGED
|
@@ -99,7 +99,7 @@ function createConfig(opts) {
|
|
|
99
99
|
(0, preprocessReadme_1.preprocessReadme)(__assign(__assign({}, pkg), { prefixUrl: opts.prefixUrl })),
|
|
100
100
|
], false)
|
|
101
101
|
};
|
|
102
|
-
console.log("[createConfig] Running in "
|
|
102
|
+
console.log("[createConfig] Running in ".concat(DEV ? "development" : "production"));
|
|
103
103
|
console.log("[createConfig] options:");
|
|
104
104
|
console.group();
|
|
105
105
|
console.log("minify:", minify);
|
|
@@ -110,11 +110,11 @@ function createConfig(opts) {
|
|
|
110
110
|
if (!opts.disableDefaultCSS) {
|
|
111
111
|
css += "/**\n * GitHub Primer button CSS\n * https://primer.style/css/components/buttons\n **/\n .code-fence button {\n font-family: inherit;\n text-transform: none;\n position: relative;\n display: inline-block;\n padding: 5px 16px;\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n white-space: nowrap;\n vertical-align: middle;\n cursor: pointer;\n user-select: none;\n border: 1px solid;\n border-radius: 6px;\n appearance: none;\n color: #24292e;\n background-color: #fafbfc;\n border-color: rgba(27,31,35,0.15);\n box-shadow: 0 1px 0 rgba(27,31,35,0.04), inset 0 1px 0 rgba(255,255,255,0.25);\n transition: background-color 0.2s cubic-bezier(0.3, 0, 0.5, 1);\n }";
|
|
112
112
|
}
|
|
113
|
-
var template = "\n <!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <meta name=\"description\" content=\""
|
|
113
|
+
var template = "\n <!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <meta name=\"description\" content=\"".concat(pkg.description || "".concat(pkg.name, " demo"), "\" />\n <title>").concat(pkg.name, "</title>\n <style>\n ").concat(!opts.disableDefaultCSS ? css : "", "\n ").concat(custom_css, "\n ").concat(opts.style || "", "\n </style>\n ").concat((_h = opts === null || opts === void 0 ? void 0 : opts.head) !== null && _h !== void 0 ? _h : "", "\n </head>\n <body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <script src=\"s").concat(hash, ".js\"></script>\n </body>\n </html>\n");
|
|
114
114
|
if (minify)
|
|
115
115
|
fs_extra_1["default"].removeSync(output_dir);
|
|
116
|
-
fs_extra_1["default"].ensureFileSync(output_dir
|
|
117
|
-
fs_extra_1["default"].writeFileSync(output_dir
|
|
116
|
+
fs_extra_1["default"].ensureFileSync("".concat(output_dir, "/index.html"));
|
|
117
|
+
fs_extra_1["default"].writeFileSync("".concat(output_dir, "/index.html"), minify
|
|
118
118
|
? html_minifier_1["default"].minify(template, {
|
|
119
119
|
collapseWhitespace: true,
|
|
120
120
|
conservativeCollapse: true,
|
|
@@ -126,7 +126,7 @@ function createConfig(opts) {
|
|
|
126
126
|
watch: { clearScreen: false },
|
|
127
127
|
input: "entry",
|
|
128
128
|
// @ts-ignore
|
|
129
|
-
output: __assign({ format: "iife", name: "app", file: output_dir
|
|
129
|
+
output: __assign({ format: "iife", name: "app", file: "".concat(output_dir, "/s").concat(hash, ".js") }, (opts.output || {})),
|
|
130
130
|
plugins: __spreadArray(__spreadArray([
|
|
131
131
|
(0, plugin_virtual_1["default"])({
|
|
132
132
|
entry: "import App from \"./README.md\";\n const app = new App({ target: document.body });\n export default app;"
|
package/dist/preprocessReadme.js
CHANGED
|
@@ -57,7 +57,7 @@ var getChildNodeText = function (node) {
|
|
|
57
57
|
.join("");
|
|
58
58
|
};
|
|
59
59
|
function preprocessReadme(opts) {
|
|
60
|
-
var prefixUrl = opts.prefixUrl || opts.homepage
|
|
60
|
+
var prefixUrl = opts.prefixUrl || "".concat(opts.homepage, "/tree/master/");
|
|
61
61
|
var script_content = [];
|
|
62
62
|
if (!md) {
|
|
63
63
|
md = new markdown_it_1["default"]({
|
|
@@ -82,15 +82,15 @@ function preprocessReadme(opts) {
|
|
|
82
82
|
parser: "svelte"
|
|
83
83
|
});
|
|
84
84
|
var svelteCode = prismjs_1["default"].highlight(formattedCode, prismjs_1["default"].languages.svelte, "svelte");
|
|
85
|
-
return "<pre class=\"language-"
|
|
85
|
+
return "<pre class=\"language-".concat(lang, "\" ").concat(noEval || noDisplay ? "" : "data-svelte=\"".concat(modifiedSource, "\""), ">{@html `").concat(svelteCode, "`}</pre>");
|
|
86
86
|
}
|
|
87
87
|
try {
|
|
88
88
|
var alias_lang = aliases[lang] || lang;
|
|
89
|
-
return "<pre class=\"language-"
|
|
89
|
+
return "<pre class=\"language-".concat(alias_lang, "\">{@html `").concat(prismjs_1["default"].highlight(source, prismjs_1["default"].languages[alias_lang], alias_lang), "`}</pre>");
|
|
90
90
|
}
|
|
91
91
|
catch (e) {
|
|
92
|
-
console.error("Could not highlight language \""
|
|
93
|
-
return "<pre class=\"language-"
|
|
92
|
+
console.error("Could not highlight language \"".concat(lang, "\"."));
|
|
93
|
+
return "<pre class=\"language-".concat(lang, "\">{@html `").concat(source, "`}</pre>");
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
});
|
|
@@ -100,10 +100,10 @@ function preprocessReadme(opts) {
|
|
|
100
100
|
// @ts-ignore
|
|
101
101
|
markup: function (_a) {
|
|
102
102
|
var content = _a.content, filename = _a.filename;
|
|
103
|
-
if (/node_modules/.test(filename) || !filename.endsWith(".md"))
|
|
103
|
+
if (filename && (/node_modules/.test(filename) || !filename.endsWith(".md")))
|
|
104
104
|
return null;
|
|
105
105
|
if (opts.repoUrl) {
|
|
106
|
-
content = content.replace("<!-- REPO_URL -->", "[GitHub repo]("
|
|
106
|
+
content = content.replace("<!-- REPO_URL -->", "[GitHub repo](".concat(opts.repoUrl, ")"));
|
|
107
107
|
}
|
|
108
108
|
content = content.replace("<!-- TOC -->", "\n## Table of Contents\n ");
|
|
109
109
|
var style_content = "";
|
|
@@ -136,10 +136,10 @@ function preprocessReadme(opts) {
|
|
|
136
136
|
var text = getChildNodeText(node);
|
|
137
137
|
if (text !== undefined) {
|
|
138
138
|
if (prev === "h3") {
|
|
139
|
-
headings.push("</ul><li><a href=\"#"
|
|
139
|
+
headings.push("</ul><li><a href=\"#".concat(id, "\">").concat(text, "</a></li>"));
|
|
140
140
|
}
|
|
141
141
|
else {
|
|
142
|
-
headings.push("<li><a href=\"#"
|
|
142
|
+
headings.push("<li><a href=\"#".concat(id, "\">").concat(text, "</a></li>"));
|
|
143
143
|
}
|
|
144
144
|
prev = "h2";
|
|
145
145
|
}
|
|
@@ -150,10 +150,10 @@ function preprocessReadme(opts) {
|
|
|
150
150
|
var text = getChildNodeText(node);
|
|
151
151
|
if (text !== undefined) {
|
|
152
152
|
if (prev === "h2") {
|
|
153
|
-
headings.push("<ul><li><a href=\"#"
|
|
153
|
+
headings.push("<ul><li><a href=\"#".concat(id, "\">").concat(text, "</a></li>"));
|
|
154
154
|
}
|
|
155
155
|
else {
|
|
156
|
-
headings.push("<li><a href=\"#"
|
|
156
|
+
headings.push("<li><a href=\"#".concat(id, "\">").concat(text, "</a></li>"));
|
|
157
157
|
}
|
|
158
158
|
prev = "h3";
|
|
159
159
|
}
|
|
@@ -172,9 +172,9 @@ function preprocessReadme(opts) {
|
|
|
172
172
|
if (prev === "h3") {
|
|
173
173
|
headings.push("</ul>");
|
|
174
174
|
}
|
|
175
|
-
result = result.replace("<h2 id=\"table-of-contents\">Table of Contents</h2>", "<p><strong>Table of Contents</strong></p><ul>"
|
|
175
|
+
result = result.replace("<h2 id=\"table-of-contents\">Table of Contents</h2>", "<p><strong>Table of Contents</strong></p><ul>".concat(headings.join("\n"), "</ul>"));
|
|
176
176
|
return {
|
|
177
|
-
code: "<script>"
|
|
177
|
+
code: "<script>".concat(__spreadArray([], __read(new Set(script_content)), false).join(""), "</script>\n <style>").concat(style_content, "</style>\n <main class=\"markdown-body\">").concat(result, "</main>")
|
|
178
178
|
};
|
|
179
179
|
}
|
|
180
180
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-readme",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Develop and demo your Svelte components in your README.md",
|
|
6
6
|
"author": "Eric Liu (https://github.com/metonym)",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"preprocess": "node scripts/preprocessStyles",
|
|
11
11
|
"dev": "yarn preprocess && tsc -w",
|
|
12
12
|
"prepack": "yarn preprocess && tsc",
|
|
13
|
-
"format": "prettier --write
|
|
13
|
+
"format": "prettier --ignore-path .gitignore --write ."
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@rollup/plugin-node-resolve": "^11.1.0",
|