Skip to content

Commit

Permalink
update buffer ref in esploader (#127)
Browse files Browse the repository at this point in the history
* update buffer ref in esploader

* add missing type set as module

* update rollup to es script
  • Loading branch information
brianignacio5 authored Jan 31, 2024
1 parent 1a7c134 commit bad4a87
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 26 deletions.
28 changes: 11 additions & 17 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "esptool-js",
"version": "0.4.0",
"type": "module",
"module": "lib/index.js",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down Expand Up @@ -28,6 +29,7 @@
"url": "https://github.com/espressif/esptool-js/issues"
},
"dependencies": {
"buffer": "^6.0.3",
"pako": "^2.1.0",
"tslib": "^2.4.1"
},
Expand All @@ -42,7 +44,6 @@
"@typescript-eslint/eslint-plugin": "^5.43.0",
"@typescript-eslint/parser": "^5.43.0",
"babel-loader": "^9.1.0",
"buffer": "^5.7.1",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-jsdoc": "^46.4.5",
Expand Down
15 changes: 8 additions & 7 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const resolve = require('@rollup/plugin-node-resolve');
const babel = require("@rollup/plugin-babel");
const commonjs = require('@rollup/plugin-commonjs');
const terser = require('@rollup/plugin-terser');
const json = require('@rollup/plugin-json');
import resolve from '@rollup/plugin-node-resolve';
import babel from "@rollup/plugin-babel";
import commonjs from '@rollup/plugin-commonjs';
import terser from '@rollup/plugin-terser';
import json from '@rollup/plugin-json';

// rollup.config.js
/**
Expand All @@ -17,12 +17,13 @@ const config = {
inlineDynamicImports: true
},
plugins: [
resolve(),
resolve({ preferBuiltins: false}),
commonjs(),
babel({ exclude: 'node_modules/**', babelHelpers: "runtime", skipPreflightCheck: true }),
json({ namedExports: false, preferConst: true }),
terser()
],
};

module.exports.default = config;
const _default = config;
export { _default as default };
2 changes: 1 addition & 1 deletion src/esploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Data, deflate, Inflate } from "pako";
import { Transport, SerialOptions } from "./webserial";
import { ROM } from "./targets/rom";
import { customReset, usbJTAGSerialReset } from "./reset";
import { Buffer } from "buffer/index";

/* global SerialPort */

Expand Down Expand Up @@ -1140,7 +1141,6 @@ export class ESPLoader {
*/
async runStub() {
this.info("Uploading stub...");

let decoded = Buffer.from(this.chip.ROM_TEXT, "base64").toString("binary");
let chardata = decoded.split("").map(function (x) {
return x.charCodeAt(0);
Expand Down

0 comments on commit bad4a87

Please sign in to comment.