Skip to content

Commit 9e4cd7c

Browse files
refactor(src): move plugins to a separate package (@posthtml/esm)
1 parent 9e3871f commit 9e4cd7c

File tree

3 files changed

+7
-179
lines changed

3 files changed

+7
-179
lines changed

src/index.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
/* eslint-disable */
21
import schema from './options.json';
32
import { getOptions } from 'loader-utils';
43
import validateOptions from 'schema-utils';
54

65
import posthtml from 'posthtml';
7-
import urls from './plugins/url';
8-
import imports from './plugins/import';
6+
import { urls, imports } from '@posthtml/esm';
97
import minifier from 'htmlnano';
108

119
import LoaderError from './Error';
1210

1311
// Loader Defaults
14-
const DEFAULTS = {
12+
const defaults = {
1513
url: true,
1614
import: true,
1715
minimize: false,
@@ -22,7 +20,7 @@ export default function loader(html, map, meta) {
2220
// Loader Options
2321
const options = Object.assign(
2422
{},
25-
DEFAULTS,
23+
defaults,
2624
getOptions(this)
2725
);
2826

@@ -81,7 +79,7 @@ export default function loader(html, map, meta) {
8179
imports += msg;
8280
} catch (err) {
8381
// TODO(michael-ciniawsky)
84-
// revisit
82+
// revisit HTMLImportError
8583
this.emitError(err)
8684
}
8785

@@ -99,17 +97,16 @@ export default function loader(html, map, meta) {
9997
exports += msg;
10098
} catch (err) {
10199
// TODO(michael-ciniawsky)
102-
// revisit
100+
// revisit HTMLExportError
103101
this.emitError(err)
104102
}
105103

106104
return exports;
107105
}, '')
108106

109107
// TODO(michael-ciniawsky)
110-
// replace posthtml with @post5/core
111-
// HACK Ensure to cleanup/reset messages
112-
// during recursive resolving of imports
108+
// HACK Ensure to cleanup/reset messages between files
109+
// @see https://github.com/posthtml/posthtml/pull/250
113110
messages.length = 0;
114111

115112
html = options.template

src/plugins/import.js

Lines changed: 0 additions & 60 deletions
This file was deleted.

src/plugins/url.js

Lines changed: 0 additions & 109 deletions
This file was deleted.

0 commit comments

Comments
 (0)