Skip to content

Commit

Permalink
refactor: re-export 패키지 생성
Browse files Browse the repository at this point in the history
  • Loading branch information
hahnlee committed Apr 9, 2024
1 parent 7669eed commit e6f746a
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 21 deletions.
11 changes: 1 addition & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
{
"name": "hwp.js",
"name": "hwp.js-workspace",
"version": "0.0.3",
"license": "Apache-2.0",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/hahnlee/hwp.js.git"
},
"homepage": "https://hanlee.io/hwp.js",
"bugs": {
"email": "hanlee.dev@gmail.com",
"url": "https://github.com/hahnlee/hwp.js/issues"
},
"lint-staged": {
"src/**/*.(js|ts)?(x)": [
"eslint"
Expand Down
27 changes: 27 additions & 0 deletions packages/hwp.js/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "hwp.js",
"version": "0.0.3",
"license": "Apache-2.0",
"main": "./src/index.ts",
"module": "./src/index.ts",
"types": "./src/index.ts",
"publishConfig": {
"main": "./build/cjs.js",
"module": "./build/esm.js",
"types": "./build/index.d.ts"
},
"siseEffect": false,
"repository": {
"type": "git",
"url": "https://github.com/hahnlee/hwp.js.git"
},
"homepage": "https://hanlee.io/hwp.js",
"bugs": {
"email": "hanlee.dev@gmail.com",
"url": "https://github.com/hahnlee/hwp.js/issues"
},
"dependencies": {
"@hwp.js/parser": "workspace:*",
"@hwp.js/viewer": "workspace:*"
}
}
2 changes: 2 additions & 0 deletions packages/hwp.js/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from '@hwp.js/parser'
export * from '@hwp.js/viewer'
4 changes: 1 addition & 3 deletions packages/parser/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* limitations under the License.
*/

import parse from './parse'

// FIXME: (@hanlee) export 고치기
export { Control } from './models/controls'
export { ShapeControls } from './models/controls/shapes'
Expand All @@ -31,4 +29,4 @@ export { default as HWPDocument } from './models/document'
export { isTable, isShape, isPicture } from './utils/controlUtil'
export { RGB } from './types/color'

export default parse
export * from './parse'
4 changes: 1 addition & 3 deletions packages/parser/src/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function parseSection(container: CFB$Container, header: HWPHeader, sectionNumber
}
}

function parse(input: CFB$Blob, options?: CFB$ParsingOptions): HWPDocument {
export function parse(input: CFB$Blob, options?: CFB$ParsingOptions): HWPDocument {
const container: CFB$Container = read(input, options)

const header = parseFileHeader(container)
Expand All @@ -141,5 +141,3 @@ function parse(input: CFB$Blob, options?: CFB$ParsingOptions): HWPDocument {

return new HWPDocument(header, docInfo, sections)
}

export default parse
4 changes: 1 addition & 3 deletions packages/viewer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@
* limitations under the License.
*/

import HWPViewer from './viewer'

export default HWPViewer
export * from './viewer'
9 changes: 9 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion website/src/pages/demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import HWPViewer from '@hwp.js/viewer'
import { HWPViewer } from '@hwp.js/viewer'
import React, { useCallback, useState, useRef } from 'react'
import { useDropzone } from 'react-dropzone'

Expand Down
2 changes: 1 addition & 1 deletion website/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import HWPViewer from '@hwp.js/viewer'
import { HWPViewer } from '@hwp.js/viewer'
import React, { useState, useCallback, useEffect, useRef } from 'react'
import Loader from 'react-loader-spinner'

Expand Down

0 comments on commit e6f746a

Please sign in to comment.