Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Commit

Permalink
[fix] excessive export (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
AsPulse authored May 7, 2023
1 parent c6b4cc7 commit c2d05af
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 11 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"rollup": "^3.18.0",
"rollup-plugin-dts": "^5.2.0",
"rollup-plugin-swc3": "^0.8.0",
"rollup-plugin-tsconfig-paths": "^1.5.0",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"tslib": "^2.5.0",
Expand Down
10 changes: 6 additions & 4 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* eslint-disable camelcase */
/* eslint-disable no-restricted-exports */
import commonjs from '@rollup/plugin-commonjs';
import dts from 'rollup-plugin-dts';
import tsConfigPaths from 'rollup-plugin-tsconfig-paths';
import { swc, defineRollupSwcOption, minify, defineRollupSwcMinifyOption } from 'rollup-plugin-swc3';
import packageJson from './package.json' assert { type: 'json' };

Expand Down Expand Up @@ -28,20 +30,20 @@ export default [
sourceMaps: false,
})),
minify(defineRollupSwcMinifyOption({
compress: true,
mangle: true,
compress: {},
mangle: {},
})),
],
external: [ 'react', 'react-dom' ],
},
{
input: 'src/index.ts',
output: [{ file: 'dist/cjs/index.d.ts', format: 'cjs' }],
plugins: [ dts() ],
plugins: [ tsConfigPaths(), dts() ],
},
{
input: 'src/index.ts',
output: [{ file: 'dist/esm/index.d.ts', format: 'esm' }],
plugins: [ dts() ],
plugins: [ tsConfigPaths(), dts() ],
},
];
2 changes: 1 addition & 1 deletion src/component/sugar/maple/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export function mapleArray<T>(
};
}

export function useCountingId(): () => string {
function useCountingId(): () => string {
const id = useId();
const counter = useRef(0);
return () => `${id}#${counter.current++}`;
Expand Down
6 changes: 3 additions & 3 deletions src/component/sugar/maple/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export function mountSugar<T, U extends SugarObject>(
}


export function wrapSugar<T extends SugarObject>(path: string, template: T): SugarObjectNode<T>['fields'] {
function wrapSugar<T extends SugarObject>(path: string, template: T): SugarObjectNode<T>['fields'] {
const fields: SugarObjectNode<T>['fields'] = {} as SugarObjectNode<T>['fields'];

for (const key in template) {
Expand All @@ -114,7 +114,7 @@ export function wrapSugar<T extends SugarObject>(path: string, template: T): Sug
return fields;
}

export function get<T extends SugarObject>(fields: SugarObjectNode<T>['fields']): SugarValue<T> {
function get<T extends SugarObject>(fields: SugarObjectNode<T>['fields']): SugarValue<T> {
const result = {} as { [P in keyof T]: unknown };
let success = true;

Expand All @@ -140,7 +140,7 @@ export function get<T extends SugarObject>(fields: SugarObjectNode<T>['fields'])
};
}

export function set<T extends SugarObject>(
function set<T extends SugarObject>(
fields: SugarObjectNode<T>['fields'],
value: T,
type: {
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export type { Sugar } from './component/sugar';
export { setSugarFormLogLevel } from './util/logger';
export { useSugarForm } from './component/sugarform';
export type { Sugar } from '@component/sugar';
export { setSugarFormLogLevel } from '@util/logger';
export { useSugarForm } from '@component/sugarform';
21 changes: 21 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,7 @@ __metadata:
rollup: ^3.18.0
rollup-plugin-dts: ^5.2.0
rollup-plugin-swc3: ^0.8.0
rollup-plugin-tsconfig-paths: ^1.5.0
ts-jest: ^29.1.0
ts-node: ^10.9.1
tslib: ^2.5.0
Expand Down Expand Up @@ -5795,6 +5796,17 @@ __metadata:
languageName: node
linkType: hard

"rollup-plugin-tsconfig-paths@npm:^1.5.0":
version: 1.5.0
resolution: "rollup-plugin-tsconfig-paths@npm:1.5.0"
dependencies:
typescript-paths: ^1.5.0
peerDependencies:
rollup: ^2 || ^3
checksum: 6189fd946fc1fc6169fd454e7d0046c46990c9c05653a5709897063d73dfdcb2015c9e710d027869f90b38fc53e13ce65889c67faed24a3cbc084d57c4854445
languageName: node
linkType: hard

"rollup@npm:^3.18.0":
version: 3.18.0
resolution: "rollup@npm:3.18.0"
Expand Down Expand Up @@ -6453,6 +6465,15 @@ __metadata:
languageName: node
linkType: hard

"typescript-paths@npm:^1.5.0":
version: 1.5.0
resolution: "typescript-paths@npm:1.5.0"
peerDependencies:
typescript: ^4.7.2 || ^5
checksum: d953250ef198cc093fecda2f53c8a01618133b8fa9f319c02145ac7275112d19ac1098d55befb38032f1f193bfb6f67ec9b632cd3b78cf5a851f7579255f9dc5
languageName: node
linkType: hard

"typescript@npm:^4.9.5":
version: 4.9.5
resolution: "typescript@npm:4.9.5"
Expand Down

0 comments on commit c2d05af

Please sign in to comment.