sveld 0.13.3 → 0.13.4
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/lib/rollup-plugin.js +11 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
10
10
|
- add isAccessor field to API
|
|
11
11
|
- update Markdown writer to generate a separate table for accessors -->
|
|
12
12
|
|
|
13
|
+
## [0.13.4](https://github.com/carbon-design-system/sveld/releases/tag/v0.13.4) - 2022-02-26
|
|
14
|
+
|
|
15
|
+
- use file name as module name if library only has a single default export
|
|
16
|
+
|
|
13
17
|
## [0.13.3](https://github.com/carbon-design-system/sveld/releases/tag/v0.13.3) - 2022-02-13
|
|
14
18
|
|
|
15
19
|
- component module exports should not be recognized as accessors
|
package/lib/rollup-plugin.js
CHANGED
|
@@ -92,7 +92,7 @@ function pluginSveld(opts) {
|
|
|
92
92
|
exports["default"] = pluginSveld;
|
|
93
93
|
function generateBundle(input, glob) {
|
|
94
94
|
return __awaiter(this, void 0, void 0, function () {
|
|
95
|
-
var dir, entry, exports, components, parser, _i,
|
|
95
|
+
var dir, entry, exports, components, parser, exportEntries, _i, exportEntries_1, _a, exportName, entry_1, filePath, _b, ext, name_1, moduleName, source, processed;
|
|
96
96
|
return __generator(this, function (_c) {
|
|
97
97
|
switch (_c.label) {
|
|
98
98
|
case 0:
|
|
@@ -110,12 +110,18 @@ function generateBundle(input, glob) {
|
|
|
110
110
|
}
|
|
111
111
|
components = new Map();
|
|
112
112
|
parser = new ComponentParser_1["default"]();
|
|
113
|
-
|
|
113
|
+
exportEntries = Object.entries(exports);
|
|
114
|
+
_i = 0, exportEntries_1 = exportEntries;
|
|
114
115
|
_c.label = 1;
|
|
115
116
|
case 1:
|
|
116
|
-
if (!(_i <
|
|
117
|
-
|
|
118
|
-
filePath = entry_1.source
|
|
117
|
+
if (!(_i < exportEntries_1.length)) return [3 /*break*/, 5];
|
|
118
|
+
_a = exportEntries_1[_i], exportName = _a[0], entry_1 = _a[1];
|
|
119
|
+
filePath = entry_1.source;
|
|
120
|
+
_b = path.parse(filePath), ext = _b.ext, name_1 = _b.name;
|
|
121
|
+
moduleName = exportName;
|
|
122
|
+
if (exportEntries.length === 1 && exportName === "default") {
|
|
123
|
+
moduleName = name_1;
|
|
124
|
+
}
|
|
119
125
|
if (!(ext === ".svelte")) return [3 /*break*/, 4];
|
|
120
126
|
return [4 /*yield*/, fs.readFile(path.resolve(dir, filePath), "utf-8")];
|
|
121
127
|
case 2:
|