Skip to content

Commit e0deee2

Browse files
committed
fix svelte exports
1 parent 3c6e3dd commit e0deee2

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

compiler/platforms/svelte.js

+13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import fs from 'fs';
2+
import glob from 'glob';
23
import compiler from '../base.compiler.js';
34

45
const DEFAULT_OPTIONS = {
@@ -21,6 +22,18 @@ const DEFAULT_OPTIONS = {
2122
.replace(/\/helpers\.svelte/g, '');
2223

2324
fs.writeFileSync(`${outPath}/src/index.ts`, result, 'utf8');
25+
26+
// Add .svelte to all the indexes in src folder
27+
glob.sync(`${outPath}/src/elements/**/index.ts`).map((src) => {
28+
const data = fs
29+
.readFileSync(src, 'utf8')
30+
// add svelte to index
31+
.replace(/(export { default } from)(.*)(';)/g, '$1$2.svelte$3')
32+
// but remove from hooks
33+
.replace(/\.hook\.svelte/g, '.hook');
34+
35+
fs.writeFileSync(src, data, 'utf8');
36+
});
2437
}
2538

2639
const data = fs.readFileSync(outFile, 'utf8');

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "papanasi",
33
"private": true,
44
"license": "MIT",
5-
"version": "1.1.1",
5+
"version": "1.1.2",
66
"type": "module",
77
"scripts": {
88
"compile": "node ./compiler",
@@ -17,7 +17,7 @@
1717
"postinstall": "node ./hooks/post-install.hook.js",
1818
"build-storybook": "cross-env NODE_OPTIONS=--openssl-legacy-provider build-storybook",
1919
"build": "yarn compile",
20-
"package": "lerna version 1.1.1 --force-publish",
20+
"package": "lerna version 1.1.2 --force-publish",
2121
"postpackage": "node ./hooks/post-package.hook.js",
2222
"release": "lerna publish from-package --force-publish"
2323
},

0 commit comments

Comments
 (0)