Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
169 changes: 86 additions & 83 deletions README.md

Large diffs are not rendered by default.

23 changes: 19 additions & 4 deletions dev-server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ if (!fs.existsSync(distPath)) {
process.exit(1);
}

const srcPath = path.join(__dirname, "../src");
const nodeModulesPath = path.join(__dirname, "../node_modules");

const app = express();

// Rate limiting
Expand All @@ -41,8 +44,23 @@ app.use(
})
);

let httpPort = 3000;
let httpsPort = 3001;

// Serve static files
app.use("/dist", express.static(distPath));
// Use setHeaders to inject the SourceMap header pointing to the HTTP port
// This works around the Firefox self-signed certificate issue for source maps
app.use("/dist", express.static(distPath, {
setHeaders: (res, filePath) => {
if (filePath.endsWith(".js") || filePath.endsWith(".mjs")) {
const filename = path.basename(filePath);
res.setHeader("SourceMap", `http://localhost:${httpPort}/dist/${filename}.map`);
}
}
}));

app.use("/src", express.static(srcPath));
app.use("/node_modules", express.static(nodeModulesPath));
Comment thread Dismissed
app.use("/assets", express.static(path.join(__dirname, "../samples/demo/assets")));
app.use("/css", express.static(path.join(__dirname, "../samples/demo/css")));
app.use("/font", express.static(path.join(__dirname, "../samples/demo/font")));
Expand Down Expand Up @@ -136,9 +154,6 @@ app.post("/upload", function (req, res) {
}
});

let httpPort = 3000;
let httpsPort = 3001;

// redirect handling
app.use((req, res, next) => {
const host = req.get("Host"); // Get the host name from the request
Expand Down
6 changes: 3 additions & 3 deletions dist/dds.bundle.esm.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/dds.bundle.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/dds.bundle.mjs

Large diffs are not rendered by default.

150 changes: 106 additions & 44 deletions package-lock.json

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

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dynamsoft-document-scanner",
"version": "1.4.0",
"version": "1.4.2",
"description": "Dynamsoft Document Scanner (DDS) is a ready-to-use SDK for capturing and enhancing document images with automatic border detection, correction, and customizable workflows.",
"files": [
"/dist",
Expand All @@ -24,6 +24,7 @@
"scripts": {
"serve": "node dev-server/index.js",
"build": "rollup -c",
"build:development": "rollup -c --environment BUILD:development",
"build:production": "rollup -c --environment BUILD:production"
},
"repository": {
Expand Down Expand Up @@ -53,7 +54,7 @@
"@rollup/plugin-typescript": "^11.1.6",
"@types/node": "^20.11.6",
"cors": "^2.8.5",
"dynamsoft-capture-vision-bundle": "3.2.4000",
"dynamsoft-capture-vision-bundle": "^3.2.5000",
"express": "^4.21.2",
"express-rate-limit": "^8.2.1",
"formidable": "^3.5.2",
Expand Down
16 changes: 10 additions & 6 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import { dts } from "rollup-plugin-dts";
const pkg = JSON.parse(await fs.promises.readFile("./package.json"));
const version = pkg.version;

// Check build mode from environment variable
const isDev = process.env.BUILD === "development";
const enableSourceMaps = isDev; // Enable source maps in dev mode

fs.rmSync("dist", { recursive: true, force: true });

const strProduct = "Dynamsoft Document Scanner JS Edition Bundle";
Expand Down Expand Up @@ -60,7 +64,7 @@ export default [
typescript({
tsconfig: "./tsconfig.json",
declaration: true,
sourceMap: false,
sourceMap: enableSourceMaps,
}),
plugin_terser_es5,
copyFiles(),
Expand All @@ -80,7 +84,7 @@ export default [
name: "Dynamsoft",
banner: banner,
exports: "named",
sourcemap: false,
sourcemap: enableSourceMaps,
},
],
},
Expand All @@ -92,7 +96,7 @@ export default [
typescript({
tsconfig: "./tsconfig.json",
declaration: true,
sourceMap: false,
sourceMap: enableSourceMaps,
}),
plugin_terser_es6,
],
Expand All @@ -102,7 +106,7 @@ export default [
format: "es",
banner: banner,
exports: "named",
sourcemap: false,
sourcemap: enableSourceMaps,
},
],
},
Expand All @@ -113,7 +117,7 @@ export default [
nodeResolve({ browser: true }),
typescript({
tsconfig: "./tsconfig.json",
sourceMap: false,
sourceMap: enableSourceMaps,
}),
plugin_terser_es6,
],
Expand All @@ -123,7 +127,7 @@ export default [
format: "es",
banner: banner,
exports: "named",
sourcemap: false,
sourcemap: enableSourceMaps,
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion samples/demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Dynamsoft Document Scanner</title>
<link rel="stylesheet" href="./css/index.css" />
<!-- <script src="https://cdn.jsdelivr.net/npm/dynamsoft-document-scanner@1.4.0/dist/dds.bundle.js"></script> -->
<!-- <script src="https://cdn.jsdelivr.net/npm/dynamsoft-document-scanner@1.4.2/dist/dds.bundle.js"></script> -->
<!-- To use locally: -->
<script src="../../dist/dds.bundle.js"></script>
</head>
Expand Down
3 changes: 3 additions & 0 deletions samples/frameworks/angular/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,8 @@
}
}
}
},
"cli": {
"analytics": false
}
}
Loading
Loading