svell_jerry 3 år sedan
förälder
incheckning
88282934ce

+ 0 - 0
packages/csv/index.ts → .babelrc


+ 0 - 0
packages/json/index.ts → .editorconfig


+ 0 - 0
packages/xls/index.ts → .eslintignore


+ 0 - 0
packages/xlsx/src/Merge.ts → .eslintrc.js


+ 89 - 0
build/webpack.config.js

@@ -0,0 +1,89 @@
+const path = require('path');
+const resolve = (url) => path.resolve(__dirname, "..", url);
+
+module.exports = {
+    entry: {
+        'luckysheet-io': resolve("src/index.ts"),
+    },
+    module: {
+        rules: [
+            {
+                test: /\.tsx?$/,
+                use: [
+                    {
+                        loader: 'babel-loader',
+                        options: {
+                            cacheDirectory: true,
+                        },
+                    },
+                    {
+                        loader: 'ts-loader'
+                    }
+                ]
+            },
+            {
+                test: /\.xml$/,
+                use: {
+                    loader: 'raw-loader',
+                },
+                type: "javascript/auto"
+            },
+            {
+                test: /\.(png|svg|jpe?g|gif)$/i,
+                use: [
+                    {
+                        loader: 'url-loader',
+                        options: {
+                            limit: 18192,
+                            outputPath: 'img',
+                            name: '[name].[ext]?[hash]',
+                            esModule: false,
+                        },
+                    },
+                ],
+                type:"javascript/auto"
+            },
+            {
+                test: /\.(mp3|wav)$/i,
+                use: [
+                    {
+                        loader: 'file-loader',
+                        options: {
+                            outputPath: 'audio',
+                            esModule: false,
+                        },
+                    },
+                ],
+                type:"javascript/auto"
+            },
+            {
+                test: /\.(woff|woff2|eot|ttf|otf)$/i,
+                use: [
+                    {
+                        loader: 'file-loader',
+                        options: {
+                            outputPath: 'font',
+                            esModule: false,
+                        },
+                    },
+                ],
+                type:"javascript/auto"
+            },
+            {
+                test: /\.wasm$/,
+                type: 'webassembly/async',
+            },
+        ],
+    },
+    resolve: {
+        extensions: ['.ts', '.tsx', '.js', '.json'],
+        alias: {
+            '@': resolve('src'),
+        },
+    },
+    experiments: {
+        syncWebAssembly: true,
+        asyncWebAssembly: true,
+        topLevelAwait: true,
+    }
+};

+ 43 - 0
build/webpack.dev.js

@@ -0,0 +1,43 @@
+const merge = require('webpack-merge').merge;
+const HtmlWebpackPlugin = require('html-webpack-plugin');
+const ESLintPlugin = require('eslint-webpack-plugin');
+const ProgressBarWebpackPlugin = require('progress-bar-webpack-plugin');
+const path = require('path');
+const common = require('./webpack.config.js');
+
+const resolve = (url) => path.resolve(__dirname, "..", url);
+
+module.exports = merge(common, {
+    mode: 'development',
+    devtool: 'inline-source-map',
+    plugins: [
+        new ProgressBarWebpackPlugin(),
+        new ESLintPlugin({
+            overrideConfigFile: resolve(".eslintrc.js"),
+            context: resolve("src"),
+            extensions: ['ts', 'js'],
+            fix: true,
+        }),
+        new HtmlWebpackPlugin({
+            template: './index.html',
+            title: 'luckysheet-io',
+            scriptLoading: 'blocking',
+        }),
+    ],
+    output: {
+        filename: 'js/[name].[contenthash].js',
+        library: 'luckysheet-io',
+        libraryTarget: 'umd',
+    },
+    devServer: {
+        host: '127.0.0.1',
+        port: 'auto',
+        static: './',
+        hot: true,
+        bonjour: true,
+        client: {
+            progress: true,
+            overlay: true,
+        },
+    },
+});

+ 49 - 0
build/webpack.prod.js

@@ -0,0 +1,49 @@
+const merge = require('webpack-merge').merge;
+const CleanWebpackPlugin = require('clean-webpack-plugin').CleanWebpackPlugin;
+const ESLintPlugin = require('eslint-webpack-plugin');
+const TerserWebpackPlugin = require('terser-webpack-plugin');
+const HtmlWebpackPlugin = require('html-webpack-plugin');
+const ProgressBarWebpackPlugin = require('progress-bar-webpack-plugin');
+const path = require('path');
+const common = require('./webpack.config.js');
+
+const resolve = (url) => path.resolve(__dirname, "..", url);
+
+module.exports = merge(common, {
+    mode: 'production',
+    devtool: 'source-map',
+    plugins: [
+        new CleanWebpackPlugin(),
+        new ESLintPlugin({
+            overrideConfigFile: resolve(".eslintrc.js"),
+            context: resolve("src"),
+            extensions: ['ts', 'js'],
+            fix: true,
+        }),
+        new ProgressBarWebpackPlugin(),
+        new HtmlWebpackPlugin({
+            template: './index.html',
+            title: 'luckysheet-io',
+            scriptLoading: 'blocking',
+        }),
+    ],
+    optimization: {
+        minimize: true,
+        minimizer: [
+            new TerserWebpackPlugin({
+                terserOptions: {
+                    format: {
+                        comments: false,
+                    },
+                },
+                extractComments: false,
+            }),
+        ],
+    },
+    output: {
+        filename: 'js/[name].js',
+        libraryTarget: 'umd',
+        library: 'luckysheet-io',
+        path: resolve('dist'),
+    },
+});

+ 117 - 0
esbuild/webpack.config.js

@@ -0,0 +1,117 @@
+const path = require('path');
+const MiniCssExtractPlugin = require('mini-css-extract-plugin');
+
+const resolve = (url) => path.resolve(__dirname, "..", url);
+
+module.exports = {
+    entry: {
+        'luckysheet-io': resolve("src/index.ts"),
+    },
+    module: {
+        rules: [
+            {
+                test: /\.js$/,
+                loader: 'esbuild-loader',
+                options: {
+                    target: 'es2015'  // Syntax to compile to (see options below for possible values)
+                }
+            },
+            {
+                test: /\.ts$/,
+                loader: 'esbuild-loader',
+                options: {
+                    loader: 'ts',  // Or 'ts' if you don't need tsx
+                    target: 'es2015',
+                    tsconfigRaw: require('../tsconfig.json')
+                }
+            },
+            {
+                test: /\.css$/,
+                use: [
+                    {
+                        loader: MiniCssExtractPlugin.loader,
+                        options: {
+                            publicPath: '../',
+                        },
+                    },
+                    {
+                        loader: 'css-loader',
+                    },
+                ]
+            },
+            {
+                test: /\.less$/,
+                use: [
+                    {
+                        loader: MiniCssExtractPlugin.loader,
+                        options: {
+                            publicPath: '../',
+                        },
+                    },
+                    {
+                        loader: 'css-loader',
+                    },
+                    {
+                        loader: 'less-loader',
+                    },
+                ]
+            },
+            {
+                test: /\.(png|svg|jpe?g|gif)$/i,
+                use: [
+                    {
+                        loader: 'url-loader',
+                        options: {
+                            limit: 18192,
+                            outputPath: 'img',
+                            name: '[name].[ext]?[hash]',
+                            esModule: false,
+                        },
+                    },
+                ],
+                type: "javascript/auto"
+            },
+            {
+                test: /\.(mp3|wav)$/i,
+                use: [
+                    {
+                        loader: 'file-loader',
+                        options: {
+                            outputPath: 'audio',
+                            esModule: false,
+                        },
+                    },
+                ],
+                type: "javascript/auto"
+            },
+            {
+                test: /\.(woff|woff2|eot|ttf|otf)$/i,
+                use: [
+                    {
+                        loader: 'file-loader',
+                        options: {
+                            outputPath: 'font',
+                            esModule: false,
+                        },
+                    },
+                ],
+                type: "javascript/auto"
+            },
+            {
+                test: /\.wasm$/,
+                type: 'webassembly/async',
+            },
+        ],
+    },
+    resolve: {
+        extensions: ['.ts', '.tsx', '.js', '.json'],
+        alias: {
+            '@': resolve('src'),
+        },
+    },
+    experiments: {
+        syncWebAssembly: true,
+        asyncWebAssembly: true,
+        topLevelAwait: true,
+    }
+};

+ 47 - 0
esbuild/webpack.dev.js

@@ -0,0 +1,47 @@
+const merge = require('webpack-merge').merge;
+const MiniCssExtractPlugin = require('mini-css-extract-plugin');
+const HtmlWebpackPlugin = require('html-webpack-plugin');
+const ESLintPlugin = require('eslint-webpack-plugin');
+const ProgressBarWebpackPlugin = require('progress-bar-webpack-plugin');
+const path = require('path');
+const common = require('./webpack.config.js');
+
+const resolve = (url) => path.resolve(__dirname, "..", url);
+
+module.exports = merge(common, {
+    mode: 'development',
+    devtool: 'inline-source-map',
+    plugins: [
+        new ESLintPlugin({
+            overrideConfigFile: resolve(".eslintrc.js"),
+            context: resolve("src"),
+            extensions: ['ts', 'js'],
+            fix: true,
+        }),
+        new ProgressBarWebpackPlugin(),
+        new HtmlWebpackPlugin({
+            template: './index.html',
+            title: 'luckysheet-io',
+            scriptLoading: 'blocking',
+        }),
+        new MiniCssExtractPlugin({
+            filename: 'css/[name].[contenthash].css',
+        }),
+    ],
+    output: {
+        filename: 'js/[name].[contenthash].js',
+        library: 'luckysheet-io',
+        libraryTarget: 'umd',
+    },
+    devServer: {
+        host: '127.0.0.1',
+        port: 'auto',
+        static: './',
+        hot: true,
+        bonjour: true,
+        client: {
+            progress: true,
+            overlay: true,
+        },
+    },
+});

+ 11 - 0
index.html

@@ -0,0 +1,11 @@
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+</head>
+<body>
+    
+</body>
+</html>

+ 74 - 0
package.json

@@ -0,0 +1,74 @@
+{
+  "name": "luckysheet-io",
+  "version": "1.0.0",
+  "description": "luckysheet xlsx io project",
+  "main": "index.ts",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "repository": {
+    "type": "git",
+    "url": "http://gogs.lashuju.com/opensource/luckysheet-io.git"
+  },
+  "keywords": [
+    "xlsx",
+    "io",
+    "excel"
+  ],
+  "author": "jerry",
+  "license": "ISC",
+  "dependencies": {
+    "archiver": "^5.0.0",
+    "dayjs": "^1.8.34",
+    "fast-csv": "^4.3.1",
+    "jszip": "^3.7.1",
+    "readable-stream": "^3.6.0",
+    "saxes": "^5.0.1",
+    "tmp": "^0.2.0",
+    "unzipper": "^0.10.11",
+    "uuid": "^8.3.0"
+  },
+  "devDependencies": {
+    "@babel/preset-env": "7.16.4",
+    "@babel/preset-typescript": "7.16.5",
+    "@babel/core": "7.16.0",
+
+    "eslint": "8.4.1",
+    "eslint-config-airbnb-base": "15.0.0",
+    "eslint-plugin-import": "2.25.3",
+    "eslint-config-airbnb-typescript": "16.1.0",
+    "@typescript-eslint/eslint-plugin": "5.6.0",
+    "@typescript-eslint/parser": "5.6.0",
+
+    "typescript": "4.7.2",
+    "assert":"2.0.0",
+    "buffer": "6.0.3",
+    "typedoc": "0.22",
+
+    "jest": "27.0.6",
+    "@types/jest": "27.0.3",
+    "jest-canvas-mock": "2.3.1",
+    "ts-jest": "27.1.0",
+
+    "webpack": "5.73.0",
+    "webpack-cli": "4.10.0",
+    "webpack-dev-server": "4.9.2",
+
+    "babel-loader": "8.2.3",
+    "css-loader": "6.5.1",
+    "file-loader": "6.2.0",
+    "less-loader": "10.2.0",
+    "ts-loader": "9.2.8",
+    "url-loader": "4.1.1",
+    "esbuild-loader": "2.18.0",
+
+    "clean-webpack-plugin": "4.0.0",
+    "eslint-webpack-plugin": "3.1.1",
+    "mini-css-extract-plugin": "2.4.5",
+    "webpack-merge": "5.8.0",
+    "webpack-javascript-obfuscator-plugin": "1.0.9",
+    "webpack-obfuscator": "3.5.1",
+    "html-webpack-plugin": "5.5.0",
+    "progress-bar-webpack-plugin": "2.1.0"
+  }
+}

+ 0 - 7
packages/xlsx/package.json

@@ -1,7 +0,0 @@
-{
-  "name": "xlsx",
-  "version": "1.0.0",
-  "dependencies": {
-    "jszip": "3.10.0"
-  }
-}

+ 0 - 8
packages/xlsx/src/Cell.ts

@@ -1,8 +0,0 @@
-export class Cell {
-    // origin value
-    v: string | number | boolean;
-    // formatted value
-    m: string;
-    // formula '=SUM(1)'
-    f: string;
-}

+ 0 - 182
packages/xlsx/src/CellStyle.ts

@@ -1,182 +0,0 @@
-export enum BorderStyleTypes {
-    NONE,
-    THIN,
-    HAIR,
-    DOTTED,
-    DASHED,
-    DASH_DOT,
-    DASH_DOT_DOT,
-    DOUBLE,
-    MEDIUM,
-    MEDIUM_DASHED,
-    MEDIUM_DASHDOT,
-    MEDIUM_DASH_DOT_DOT,
-    SLANT_DASH_DOT,
-    THICK,
-}
-
-export enum ThemeColor{
-    TEXT,
-    BACKGROUND,
-    ACCENT1,
-    ACCENT2,
-    ACCENT3,
-    ACCENT4,
-    ACCENT5,
-    ACCENT6,
-    LINK,
-}
-
-export enum TextDecoration {
-    DASH,
-    DASH_DOT_DOT_HEAVY,
-    DASH_DOT_HEAVY,
-    DASHED_HEAVY,
-    DASH_LONG,
-    DASH_LONG_HEAVY,
-    DOT_DASH,
-    DOT_DOT_DASH,
-    DOTTED,
-    DOTTED_HEAVY,
-    DOUBLE,
-    NONE,
-    SINGLE,
-    THICK,
-    WAVE,
-    WAVY_DOUBLE,
-    WAVY_HEAVY,
-    WORDS,
-}
-
-export interface IBorderStyleData {
-    /**
-     * color type
-     */
-    cl: IColorStyle;
-
-    /**
-     * border type
-     */
-    s: BorderStyleTypes;
-}
-
-export interface IBorderData {
-    /**
-     * top border
-     */
-    t: IBorderStyleData;
-
-    /**
-     * right border
-     */
-    r: IBorderStyleData;
-
-    /**
-     * bottom border
-     */
-    b: IBorderStyleData;
-
-    /**
-     * left border
-     */
-    l: IBorderStyleData;
-}
-
-export interface IColorStyle {
-    /**
-     * rgb color
-     */
-    rgb: string;
-
-    /**
-     * theme color
-     */
-    th: ThemeColor;
-}
-
-export interface ITextRotation {
-    /**
-     * angle
-     */
-    a: number;
-
-    /**
-     * vertical
-     * true : 1
-     * false : 0
-     */
-    v?: number;
-}
-
-export interface ITextDecoration {
-    /**
-     * colorType
-     */
-    cl: IColorStyle;
-
-    /**
-     * controller display textDecoration
-     */
-    s: boolean;
-
-    /**
-     * text decoration type
-     */
-    t: TextDecoration;
-}
-
-export class CellStyle {
-    /**
-     * fontFamily
-     */
-    ff: string;
-
-    /**
-     * fontSize
-     */
-    fs: number;
-
-    /**
-     * italic
-     * 0: false
-     * 1: true
-     */
-    it: number;
-
-    /**
-     * bold
-     * 0: false
-     * 1: true
-     */
-    bl: number;
-
-    /**
-     * underline
-     */
-    ul: ITextDecoration;
-
-    /**
-     * strikethrough
-     */
-    st: ITextDecoration;
-
-    /**
-     * overline
-     */
-    ol: ITextDecoration;
-
-    /**
-     * background
-     */
-    bg: IColorStyle;
-
-    /**
-     * border
-     */
-    bd: IBorderData;
-
-    /**
-     * foreground
-     */
-    cl: IColorStyle;
-}

+ 0 - 10
packages/xlsx/src/Column.ts

@@ -1,10 +0,0 @@
-export class Column {
-    /**
-     * width
-     */
-    w: number;
-    /**
-     * hidden
-     */
-    hd: boolean;
-}

+ 0 - 10
packages/xlsx/src/Row.ts

@@ -1,10 +0,0 @@
-export class Row {
-    /**
-     * height
-     */
-    h: number;
-    /**
-     * hidden
-     */
-    hd: boolean;
-}

+ 0 - 11
packages/xlsx/src/WorkSheet.ts

@@ -1,11 +0,0 @@
-class WorkSheet {
-    sheetId: string | null;
-    name: string;
-    tabColor: string;
-    freezeColumn: number;
-    freezeRow: number;
-    zoomRatio: number;
-    defaultColumnWidth: number;
-    defaultRowHeight: null;
-    mergeData: Merge;
-}

+ 0 - 3
packages/xlsx/src/Zipper.ts

@@ -1,3 +0,0 @@
-export class Zipper {
-
-}

+ 0 - 0
packages/xlsx/src/WorkBook.ts → tsconfig.json


+ 0 - 0
packages/xlsx/src/XLSX.ts → typedoc.json