@podlite/publisher 0.0.45 → 0.0.47
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.podlite +8 -0
- package/esm/react-plugin.js +11 -4
- package/esm/react-plugin.js.map +1 -1
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/lib/react-plugin.js +11 -4
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +4 -4
package/CHANGELOG.podlite
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
=head1 Upcoming
|
|
4
4
|
|
|
5
|
+
=head1 0.0.46
|
|
6
|
+
|
|
7
|
+
=item resolve a component path that starts with C<../>, which was passed through unchanged and reached the build as written
|
|
8
|
+
|
|
9
|
+
=item read a component list written with spaces after the comma, which used to drop the whole import with a warning
|
|
10
|
+
|
|
11
|
+
=item import a component under another name
|
|
12
|
+
|
|
5
13
|
=head1 0.0.44
|
|
6
14
|
|
|
7
15
|
=item skip an image whose declared orientation is outside the range a build can read, instead of letting one such file stop the whole site
|
package/esm/react-plugin.js
CHANGED
|
@@ -13,8 +13,12 @@ const plugin = () => {
|
|
|
13
13
|
let componensFileContent = '';
|
|
14
14
|
for (const key of componensMap.keys()) {
|
|
15
15
|
const componentName = componensMap.get(key);
|
|
16
|
+
// a renamed import binds the local name, so that is what may be re-exported
|
|
17
|
+
const exported = Array.isArray(componentName)
|
|
18
|
+
? componentName.map(name => name.split(/\s+as\s+/).pop())
|
|
19
|
+
: componentName;
|
|
16
20
|
componensFileContent += `import ${Array.isArray(componentName) ? `{ ${componentName} }` : componentName} from "${key}"
|
|
17
|
-
export { ${
|
|
21
|
+
export { ${exported} }
|
|
18
22
|
`;
|
|
19
23
|
}
|
|
20
24
|
componensFileContent += `
|
|
@@ -29,17 +33,20 @@ export default {}
|
|
|
29
33
|
// process JSX
|
|
30
34
|
useReact: (node, ctx, interator) => {
|
|
31
35
|
const text = getTextContentFromNode(node);
|
|
32
|
-
const importMatchResult = text.match(/^\s*(?<component>\S+)\s*from\s*['"](?<source>\S+)['"]/);
|
|
36
|
+
const importMatchResult = text.match(/^\s*(?<component>\{[^}]*\}|\S+)\s*from\s*['"](?<source>\S+)['"]/);
|
|
33
37
|
if (importMatchResult) {
|
|
34
38
|
//@ts-ignore
|
|
35
39
|
const { component, source } = (importMatchResult || {
|
|
36
40
|
groups: { component: undefined, source: undefined },
|
|
37
41
|
}).groups;
|
|
38
|
-
const { path } = source.match(
|
|
42
|
+
const { path } = source.match(/^\.{0,2}\//) ? getPathToOpen(source, file) : { path: source };
|
|
39
43
|
// save absolute Component path and Component name
|
|
40
44
|
const notDefaultImport = component.match(/{(.*)}/);
|
|
41
45
|
if (notDefaultImport) {
|
|
42
|
-
const components = notDefaultImport[1]
|
|
46
|
+
const components = notDefaultImport[1]
|
|
47
|
+
.split(',')
|
|
48
|
+
.map(name => name.trim())
|
|
49
|
+
.filter(Boolean);
|
|
43
50
|
// check if already exists
|
|
44
51
|
if (componensMap.has(path)) {
|
|
45
52
|
const savedComponents = componensMap.get(path);
|
package/esm/react-plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-plugin.js","sourceRoot":"","sources":["../src/react-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAA4B,MAAM,iBAAiB,CAAA;AACjG,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAEzC,MAAM,MAAM,GAAG,GAAqB,EAAE;IACpC,MAAM,YAAY,GAAG,IAAI,GAAG,EAAE,CAAA;IAC9B,MAAM,cAAc,GAAG,IAAI,OAAO,EAAO,CAAA;IACzC,MAAM,MAAM,GAA4B,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AAiB,CAAA;gBACvC,IAAI,MAAM,EAAE,CAAC;oBACX,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;gBACjE,CAAC;gBACD,IAAI,MAAM,EAAE,CAAC;oBACX,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;gBACjE,CAAC;gBACD,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;YACnC,CAAC;YACD,iCAAiC;YACjC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;YAC/B,IAAI,MAAM,EAAE,CAAC;gBACX,KAAK,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;YAC/C,CAAC;YACD,IAAI,MAAM,EAAE,CAAC;gBACX,KAAK,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;YAC/C,CAAC;YAED,OAAO,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,CAAA;QACpC,CAAC,CAAC,CAAA;QACF,OAAO,GAAG,CAAA;IACZ,CAAC,CAAA;IACD,0CAA0C;IAC1C,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;AAC5B,CAAC,CAAA;AAED,eAAe,MAAM,CAAA"}
|
package/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.0.
|
|
1
|
+
export declare const version = "0.0.47";
|
package/esm/version.js
CHANGED
package/lib/react-plugin.js
CHANGED
|
@@ -48,8 +48,12 @@ const plugin = () => {
|
|
|
48
48
|
let componensFileContent = '';
|
|
49
49
|
for (const key of componensMap.keys()) {
|
|
50
50
|
const componentName = componensMap.get(key);
|
|
51
|
+
// a renamed import binds the local name, so that is what may be re-exported
|
|
52
|
+
const exported = Array.isArray(componentName)
|
|
53
|
+
? componentName.map(name => name.split(/\s+as\s+/).pop())
|
|
54
|
+
: componentName;
|
|
51
55
|
componensFileContent += `import ${Array.isArray(componentName) ? `{ ${componentName} }` : componentName} from "${key}"
|
|
52
|
-
export { ${
|
|
56
|
+
export { ${exported} }
|
|
53
57
|
`;
|
|
54
58
|
}
|
|
55
59
|
componensFileContent += `
|
|
@@ -64,17 +68,20 @@ export default {}
|
|
|
64
68
|
// process JSX
|
|
65
69
|
useReact: (node, ctx, interator) => {
|
|
66
70
|
const text = (0, schema_1.getTextContentFromNode)(node);
|
|
67
|
-
const importMatchResult = text.match(/^\s*(?<component>\S+)\s*from\s*['"](?<source>\S+)['"]/);
|
|
71
|
+
const importMatchResult = text.match(/^\s*(?<component>\{[^}]*\}|\S+)\s*from\s*['"](?<source>\S+)['"]/);
|
|
68
72
|
if (importMatchResult) {
|
|
69
73
|
//@ts-ignore
|
|
70
74
|
const { component, source } = (importMatchResult || {
|
|
71
75
|
groups: { component: undefined, source: undefined },
|
|
72
76
|
}).groups;
|
|
73
|
-
const { path } = source.match(
|
|
77
|
+
const { path } = source.match(/^\.{0,2}\//) ? (0, node_utils_1.getPathToOpen)(source, file) : { path: source };
|
|
74
78
|
// save absolute Component path and Component name
|
|
75
79
|
const notDefaultImport = component.match(/{(.*)}/);
|
|
76
80
|
if (notDefaultImport) {
|
|
77
|
-
const components = notDefaultImport[1]
|
|
81
|
+
const components = notDefaultImport[1]
|
|
82
|
+
.split(',')
|
|
83
|
+
.map(name => name.trim())
|
|
84
|
+
.filter(Boolean);
|
|
78
85
|
// check if already exists
|
|
79
86
|
if (componensMap.has(path)) {
|
|
80
87
|
const savedComponents = componensMap.get(path);
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.0.
|
|
1
|
+
export declare const version = "0.0.47";
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@podlite/publisher",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.47",
|
|
4
4
|
"description": "Publishing toolkit for Podlite — transform documents to HTML, generate sites",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -66,13 +66,13 @@
|
|
|
66
66
|
"transform"
|
|
67
67
|
],
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@podlite/markdown": "0.0.
|
|
70
|
-
"@podlite/schema": "0.0.
|
|
69
|
+
"@podlite/markdown": "0.0.59",
|
|
70
|
+
"@podlite/schema": "0.0.66",
|
|
71
71
|
"crc-32": "^1.2.2",
|
|
72
72
|
"gray-matter": "^4.0.3",
|
|
73
73
|
"iso_9": "^1.0.4",
|
|
74
74
|
"newbase60": "^1.3.1",
|
|
75
|
-
"podlite": "0.0.
|
|
75
|
+
"podlite": "0.0.79"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@types/node": "^17.0.7",
|