@shgysk8zer0/11ty-netlify 1.0.3 → 1.0.5
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 +14 -0
- package/markdown.cjs +28 -0
- package/package.json +13 -21
- package/postcss/plugins.js +0 -15
- package/postcss/utils.js +0 -6
- package/rollup/plugins.js +0 -8
- package/rollup/utils.js +0 -65
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
<!-- markdownlint-disable -->
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [v1.0.5] - 2023-06-10
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- Add `@shgysk8zer0/js-utils` and `@shgysk8zer0/css-utils`
|
|
13
|
+
|
|
14
|
+
### Removed
|
|
15
|
+
- Uninstall all `eslint`, `stylelint`, `rollup`, and `postcss` with plugins
|
|
16
|
+
- Remove `postcss/*` and `rollup/*` modules
|
|
17
|
+
|
|
18
|
+
## [v1.0.4] - 2023-06-01
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
- Add missing CommonJS version of `markdown-it` & `highlight.js` config
|
|
22
|
+
|
|
9
23
|
## [v1.0.3] - 2023-06-01
|
|
10
24
|
|
|
11
25
|
### Added
|
package/markdown.cjs
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var MarkdownIt = require('markdown-it');
|
|
4
|
+
var hljs = require('highlight.js');
|
|
5
|
+
|
|
6
|
+
/* eslint-env node */
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
const markdownIt = new MarkdownIt({
|
|
10
|
+
html: true,
|
|
11
|
+
linkify: false,
|
|
12
|
+
breaks: true,
|
|
13
|
+
langPrefix: 'language-',
|
|
14
|
+
highlight: function(str, language) {
|
|
15
|
+
if (typeof str === 'string' && typeof hljs.getLanguage(language) !== 'undefined') {
|
|
16
|
+
try {
|
|
17
|
+
return `<pre class="hljs ${this.langPrefix}${language}"><code>${hljs.highlight(str, { language, ignoreIllegals: true }).value}</code></pre>`;
|
|
18
|
+
} catch(e) {
|
|
19
|
+
console.error(e);
|
|
20
|
+
return `<pre class="hljs"><code>${this.utils.escapeHtml(str)}</code></pre>`;
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
return `<pre class="hljs"><code>${this.utils.escapeHtml(str)}</code></pre>`;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
exports.markdownIt = markdownIt;
|
package/package.json
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shgysk8zer0/11ty-netlify",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=18.13.0"
|
|
6
6
|
},
|
|
7
7
|
"private": false,
|
|
8
8
|
"type": "module",
|
|
9
|
+
"exports": {
|
|
10
|
+
"./*": {
|
|
11
|
+
"import": "./*.js",
|
|
12
|
+
"require": "./*.cjs"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
9
15
|
"description": "A collection of common npm packages for Eleventy sites on Netlify",
|
|
10
16
|
"config": {
|
|
11
17
|
"icons": "./_data/icons.csv",
|
|
@@ -19,6 +25,7 @@
|
|
|
19
25
|
"scripts": {
|
|
20
26
|
"test": "npm run lint && npm run build",
|
|
21
27
|
"preversion": "npm test",
|
|
28
|
+
"prepare": "npm run build:markdown",
|
|
22
29
|
"create:lock": "npm i --package-lock-only",
|
|
23
30
|
"version:bump": "npm run version:bump:patch",
|
|
24
31
|
"version:bump:patch": "npm version --no-git-tag-version patch",
|
|
@@ -31,8 +38,8 @@
|
|
|
31
38
|
"fix:css": "stylelint './**.css' --fix",
|
|
32
39
|
"fix:js": "eslint. --fix",
|
|
33
40
|
"build": "npm run build:icons && npm run build:css && npm run build:js",
|
|
34
|
-
"build:css": "
|
|
35
|
-
"build:js": "
|
|
41
|
+
"build:css": "postcss ${npm_package_config_dir_css}index.css -o ${npm_package_config_dir_css}index.min.css",
|
|
42
|
+
"build:js": "rollup --config rollup.config.js",
|
|
36
43
|
"build:markdown": "rollup -c markdown.config.js",
|
|
37
44
|
"build:icons": "if [ -f ${npm_package_config_icons} ]; then $(svg-sprite-generate -c ${npm_package_config_icons} -o 'img/icons.svg'); fi"
|
|
38
45
|
},
|
|
@@ -53,32 +60,17 @@
|
|
|
53
60
|
"homepage": "https://github.com/shgysk8zer0/11ty-netlify#readme",
|
|
54
61
|
"dependencies": {
|
|
55
62
|
"@11ty/eleventy": "^2.0.1",
|
|
56
|
-
"@rollup/plugin-terser": "^0.4.1",
|
|
57
63
|
"@shgysk8zer0/11ty-filters": "^0.0.2",
|
|
64
|
+
"@shgysk8zer0/css-utils": "^1.0.0",
|
|
58
65
|
"@shgysk8zer0/importmap": "^1.0.2",
|
|
59
|
-
"@shgysk8zer0/
|
|
60
|
-
"
|
|
61
|
-
"cssnano-preset-default": "^6.0.0",
|
|
62
|
-
"eslint": "^8.0.1",
|
|
66
|
+
"@shgysk8zer0/js-utils": "^1.0.0",
|
|
67
|
+
"@shgysk8zer0/rollup-import": "^1.1.0",
|
|
63
68
|
"eslint-plugin-frontmatter": "^0.0.8",
|
|
64
69
|
"highlight.js": "^11.8.0",
|
|
65
70
|
"htmlhint": "^1.1.4",
|
|
66
71
|
"js-yaml": "^4.1.0",
|
|
67
72
|
"markdown-it": "^13.0.1",
|
|
68
73
|
"netlify-cli": "^15.0.0",
|
|
69
|
-
"postcss": "^8.4.7",
|
|
70
|
-
"postcss-cli": "^10.0.0",
|
|
71
|
-
"postcss-discard-comments": "^6.0.0",
|
|
72
|
-
"postcss-import": "^15.0.0",
|
|
73
|
-
"postcss-import-url": "^7.0.0",
|
|
74
|
-
"postcss-media-minmax": "^5.0.0",
|
|
75
|
-
"postcss-nesting": "^11.2.2",
|
|
76
|
-
"postcss-preset-env": "^8.0.0",
|
|
77
|
-
"postcss-url": "^10.1.3",
|
|
78
|
-
"rollup": "^3.2.2",
|
|
79
|
-
"stylelint": "^15.0.0",
|
|
80
|
-
"stylelint-config-recommended": "^12.0.0",
|
|
81
|
-
"stylelint-config-standard": "^33.0.0",
|
|
82
74
|
"svg-sprite-generator": "0.0.7"
|
|
83
75
|
}
|
|
84
76
|
}
|
package/postcss/plugins.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/* eslint-env node */
|
|
2
|
-
import pcImport from 'postcss-import';
|
|
3
|
-
import pcURL from 'postcss-url';
|
|
4
|
-
import pcImportURL from 'postcss-import-url';
|
|
5
|
-
import pcEnv from 'postcss-preset-env';
|
|
6
|
-
import pcDiscardComments from 'postcss-discard-comments';
|
|
7
|
-
import pcCustomProperties from 'postcss-custom-properties';
|
|
8
|
-
import pcMediaMinMax from 'postcss-media-minmax';
|
|
9
|
-
import CSSNano from 'cssnano';
|
|
10
|
-
import postcssNesting from 'postcss-nesting';
|
|
11
|
-
|
|
12
|
-
export const plugins = [
|
|
13
|
-
pcImport, pcURL,pcImportURL, pcEnv, pcDiscardComments, pcCustomProperties,
|
|
14
|
-
pcMediaMinMax, CSSNano, postcssNesting,
|
|
15
|
-
];
|
package/postcss/utils.js
DELETED
package/rollup/plugins.js
DELETED
package/rollup/utils.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { extname } from 'node:path';
|
|
2
|
-
import { readFile } from 'node:fs/promises';
|
|
3
|
-
import { plugins as PLUGINS } from './plugins.js';
|
|
4
|
-
|
|
5
|
-
export const ONWARN = warning => {
|
|
6
|
-
if (warning.code === 'MISSING_GLOBAL_NAME') {
|
|
7
|
-
throw new Error(warning.message);
|
|
8
|
-
} else if (warning.code !== 'CIRCULAR_DEPENDENCY') {
|
|
9
|
-
console.warn(`(!) ${warning.message}`);
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const EXTERNAL = ['node:fs', 'node:fs/promises', 'node:crypto', 'node:path'];
|
|
14
|
-
export const GLOBALS = {};
|
|
15
|
-
export const DEFAULT_EXT = '.min.js';
|
|
16
|
-
export const ESLINT_CONFIG = '.eslintrc.json';
|
|
17
|
-
export const EXTS = {
|
|
18
|
-
'.cjs': ['cjs', 'commonjs'],
|
|
19
|
-
'.mjs': ['es', 'esm', 'module'],
|
|
20
|
-
'.min.js': ['iife'],
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export function getExtension(format) {
|
|
24
|
-
const found = Object.entries(EXTS).find(([, formats]) => formats.includes(format));
|
|
25
|
-
return found[0];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function getFormat(ext) {
|
|
29
|
-
if (ext in EXTS) {
|
|
30
|
-
return EXTS[ext][0];
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export async function getConfig(input, {
|
|
35
|
-
format = 'iife',
|
|
36
|
-
sourcemap = true,
|
|
37
|
-
external = EXTERNAL,
|
|
38
|
-
plugins = PLUGINS,
|
|
39
|
-
onwarn = ONWARN,
|
|
40
|
-
eslintConfig = ESLINT_CONFIG,
|
|
41
|
-
} = {}) {
|
|
42
|
-
const ext = getExtension(format);
|
|
43
|
-
const { globals = {}} = typeof eslintConfig === 'string'
|
|
44
|
-
? await getESLintConfig(eslintConfig)
|
|
45
|
-
: {};
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
input, external, onwarn, plugins,
|
|
49
|
-
output: {
|
|
50
|
-
file: input.replace(extname(input), ext),
|
|
51
|
-
format, sourcemap, globals,
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export async function getESLintConfig(path = ESLINT_CONFIG) {
|
|
57
|
-
try {
|
|
58
|
-
const config = await readFile(path, { encoding: 'utf8' });
|
|
59
|
-
|
|
60
|
-
return JSON.parse(config);
|
|
61
|
-
} catch(err) {
|
|
62
|
-
console.error(err);
|
|
63
|
-
return GLOBALS;
|
|
64
|
-
}
|
|
65
|
-
}
|