diff --git a/package.json b/package.json index 3b80845..b423486 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/packages/hwp.js/package.json b/packages/hwp.js/package.json new file mode 100644 index 0000000..f5cc10f --- /dev/null +++ b/packages/hwp.js/package.json @@ -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:*" + } +} diff --git a/packages/hwp.js/src/index.ts b/packages/hwp.js/src/index.ts new file mode 100644 index 0000000..70b57c9 --- /dev/null +++ b/packages/hwp.js/src/index.ts @@ -0,0 +1,2 @@ +export * from '@hwp.js/parser' +export * from '@hwp.js/viewer' diff --git a/packages/parser/src/index.ts b/packages/parser/src/index.ts index 755831c..9456137 100644 --- a/packages/parser/src/index.ts +++ b/packages/parser/src/index.ts @@ -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' @@ -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' diff --git a/packages/parser/src/parse.ts b/packages/parser/src/parse.ts index 189c7d2..8206272 100644 --- a/packages/parser/src/parse.ts +++ b/packages/parser/src/parse.ts @@ -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) @@ -141,5 +141,3 @@ function parse(input: CFB$Blob, options?: CFB$ParsingOptions): HWPDocument { return new HWPDocument(header, docInfo, sections) } - -export default parse diff --git a/packages/viewer/src/index.ts b/packages/viewer/src/index.ts index 9bc4467..0baf77e 100644 --- a/packages/viewer/src/index.ts +++ b/packages/viewer/src/index.ts @@ -14,6 +14,4 @@ * limitations under the License. */ -import HWPViewer from './viewer' - -export default HWPViewer +export * from './viewer' diff --git a/packages/viewer/src/viewer.ts b/packages/viewer/src/viewer.ts index 3ee97f1..eb9daa6 100644 --- a/packages/viewer/src/viewer.ts +++ b/packages/viewer/src/viewer.ts @@ -14,7 +14,8 @@ * limitations under the License. */ -import parse, { +import { + parse, Control, TableControl, TableColumnOption, @@ -69,7 +70,7 @@ const TEXT_ALIGN: { [key: number]: string } = { 3: 'center', } -class HWPViewer { +export class HWPViewer { private hwpDocument: HWPDocument private container: HTMLElement @@ -380,5 +381,3 @@ class HWPViewer { this.container.appendChild(this.viewer) } } - -export default HWPViewer diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a694e05..35e8e8f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -59,6 +59,15 @@ importers: packages/extension: {} + packages/hwp.js: + dependencies: + '@hwp.js/parser': + specifier: workspace:* + version: link:../parser + '@hwp.js/viewer': + specifier: workspace:* + version: link:../viewer + packages/parser: dependencies: cfb: diff --git a/website/src/pages/demo.tsx b/website/src/pages/demo.tsx index e51de52..e8c9e40 100644 --- a/website/src/pages/demo.tsx +++ b/website/src/pages/demo.tsx @@ -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' diff --git a/website/src/pages/index.tsx b/website/src/pages/index.tsx index 7ecd3ed..fa7c04e 100644 --- a/website/src/pages/index.tsx +++ b/website/src/pages/index.tsx @@ -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'