forked from sheetjs/sheetjs
		
	dta v0.0.2
This commit is contained in:
		
							parent
							
								
									e4a66516e4
								
							
						
					
					
						commit
						0941ff97a3
					
				| @ -6,6 +6,7 @@ changes may not be included if they are not expected to break existing code. | ||||
| 
 | ||||
| ## v0.20.2 | ||||
| 
 | ||||
| * HTML properly encode data-v attribute | ||||
| * SYLK read and write error cells | ||||
| 
 | ||||
| ## v0.20.1 | ||||
|  | ||||
| @ -84,7 +84,7 @@ function make_html_row(ws/*:Worksheet*/, r/*:Range*/, R/*:number*/, o/*:Sheet2HT | ||||
| 		else if(cell) { | ||||
| 			sp["data-t"] = cell && cell.t || 'z'; | ||||
| 			// note: data-v is unaffected by the timezone interpretation
 | ||||
| 			if(cell.v != null) sp["data-v"] = cell.v instanceof Date ? cell.v.toISOString() : cell.v; | ||||
| 			if(cell.v != null) sp["data-v"] = escapehtml(cell.v instanceof Date ? cell.v.toISOString() : cell.v); | ||||
| 			if(cell.z != null) sp["data-z"] = cell.z; | ||||
| 			if(cell.l && (cell.l.Target || "#").charAt(0) != "#") w = '<a href="' + escapehtml(cell.l.Target) +'">' + w + '</a>'; | ||||
| 		} | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| { | ||||
| 	"name": "xlsx", | ||||
| 	"version": "0.20.1", | ||||
| 	"version": "0.20.2", | ||||
| 	"author": "sheetjs", | ||||
| 	"description": "SheetJS Spreadsheet data parser and writer", | ||||
| 	"keywords": [ | ||||
|  | ||||
| @ -17,7 +17,7 @@ types: dta.ts | ||||
| node: dist/dta.js | ||||
| 
 | ||||
| dist/dta.js: dta.ts | ||||
| 	npx esbuild@0.14.14 dta.ts --bundle --outdir=dist --platform=node | ||||
| 	npx esbuild@0.14.14 $< --bundle --outfile=$@ --platform=node | ||||
| 
 | ||||
| .PHONY: test-node | ||||
| test-node: dist/dta.js test.js | ||||
| @ -28,5 +28,8 @@ test-node: dist/dta.js test.js | ||||
| browser: dist/dta.min.js | ||||
| 
 | ||||
| dist/dta.min.js: dta.ts | ||||
| 	npx esbuild@0.14.14 dta.ts --bundle --outfile=dist/dta.min.js --minify --sourcemap --global-name=DTA | ||||
| 	npx esbuild@0.14.14 $< --bundle --outfile=$@ --minify --sourcemap --global-name=DTA | ||||
| 
 | ||||
| dist/dta.mjs: dta.ts | ||||
| 	npx esbuild@0.14.14 $< --bundle --outfile=$@ --minify --sourcemap --format=esm | ||||
| 
 | ||||
|  | ||||
| @ -13,13 +13,13 @@ The codec will truncate data to 1048576 observations and 16384 variables. | ||||
| Using NodeJS package manager: | ||||
| 
 | ||||
| ```bash | ||||
| npm install --save https://cdn.sheetjs.com/dta-0.0.1/dta-0.0.1.tgz | ||||
| npm install --save https://cdn.sheetjs.com/dta-0.0.2/dta-0.0.2.tgz | ||||
| ``` | ||||
| 
 | ||||
| The standalone script is also hosted on the SheetJS CDN: | ||||
| 
 | ||||
| ```html | ||||
| <script src="https://cdn.sheetjs.com/dta-0.0.1/package/dist/dta.min.js"></script> | ||||
| <script src="https://cdn.sheetjs.com/dta-0.0.2/package/dist/dta.min.js"></script> | ||||
| ``` | ||||
| 
 | ||||
| ## Usage | ||||
| @ -60,4 +60,10 @@ DTA.set_utils(XLSX.utils); | ||||
|   out.innerHTML = html; | ||||
| })(); | ||||
| </script> | ||||
| ``` | ||||
| ``` | ||||
| 
 | ||||
| `dist/dta.mjs` is a ECMAScript Module build designed to be used with bundlers: | ||||
| 
 | ||||
| ```js | ||||
| import * as DTA from 'dta'; | ||||
| ``` | ||||
|  | ||||
							
								
								
									
										4
									
								
								packages/dta/dist/dta.js
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										4
									
								
								packages/dta/dist/dta.js
									
									
									
									
										vendored
									
									
								
							| @ -28,7 +28,7 @@ __export(dta_exports, { | ||||
|   set_utils: () => set_utils, | ||||
|   version: () => version | ||||
| }); | ||||
| var version = "0.0.1"; | ||||
| var version = "0.0.2"; | ||||
| var _utils; | ||||
| function set_utils(utils) { | ||||
|   _utils = utils; | ||||
| @ -524,6 +524,7 @@ function parse_tagged(raw) { | ||||
|     throw err; | ||||
|   const wb = _utils.book_new(); | ||||
|   _utils.book_append_sheet(wb, ws, "Sheet1"); | ||||
|   wb.bookType = "dta"; | ||||
|   return wb; | ||||
| } | ||||
| function parse_legacy(raw) { | ||||
| @ -668,6 +669,7 @@ function parse_legacy(raw) { | ||||
|     } | ||||
|   const wb = _utils.book_new(); | ||||
|   _utils.book_append_sheet(wb, ws, "Sheet1"); | ||||
|   wb.bookType = "dta"; | ||||
|   return wb; | ||||
| } | ||||
| function parse(data) { | ||||
|  | ||||
							
								
								
									
										2
									
								
								packages/dta/dist/dta.min.js
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										2
									
								
								packages/dta/dist/dta.min.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										4
									
								
								packages/dta/dist/dta.min.js.map
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										4
									
								
								packages/dta/dist/dta.min.js.map
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										2
									
								
								packages/dta/dist/dta.mjs
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										2
									
								
								packages/dta/dist/dta.mjs
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										7
									
								
								packages/dta/dist/dta.mjs.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										7
									
								
								packages/dta/dist/dta.mjs.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @ -1,7 +1,7 @@ | ||||
| import { CellObject, DenseWorkSheet, WorkBook, type utils } from 'xlsx'; | ||||
| export { parse, set_utils, version }; | ||||
| 
 | ||||
| const version = "0.0.1"; | ||||
| const version = "0.0.2"; | ||||
| 
 | ||||
| let _utils: typeof utils; | ||||
| /** Set internal instance of `utils` | ||||
| @ -92,7 +92,6 @@ function read_f32(p: Payload, LE: boolean): number | null { | ||||
|   p.ptr += 4; | ||||
|   const d = p.dv.getFloat32(p.ptr - 4, LE); | ||||
|   return d > 1.701e+38 ? null : d; | ||||
| 
 | ||||
| } | ||||
| function read_u32(p: Payload, LE: boolean) { | ||||
|   p.ptr += 4; | ||||
| @ -150,7 +149,7 @@ function parse_tagged(raw: Uint8Array): WorkBook { | ||||
|     ptr: 0, | ||||
|     raw, | ||||
|     dv: u8_to_dataview(raw) | ||||
|   } | ||||
|   }; | ||||
| 
 | ||||
|   let vers: number = 118; | ||||
|   let LE: boolean = true; | ||||
| @ -469,6 +468,7 @@ function parse_tagged(raw: Uint8Array): WorkBook { | ||||
|   if(!valid_inc(d, "</stata_dta>")) throw err; | ||||
|   const wb = _utils.book_new(); | ||||
|   _utils.book_append_sheet(wb, ws, "Sheet1"); | ||||
|   wb.bookType = "dta" as any; | ||||
|   return wb; | ||||
| } | ||||
| 
 | ||||
| @ -480,7 +480,7 @@ function parse_legacy(raw: Uint8Array): WorkBook { | ||||
|     ptr: 1, | ||||
|     raw, | ||||
|     dv: u8_to_dataview(raw) | ||||
|   } | ||||
|   }; | ||||
| 
 | ||||
|   let LE: boolean = true; | ||||
|   let nvar: number = 0, nobs: number = 0; | ||||
| @ -612,6 +612,7 @@ function parse_legacy(raw: Uint8Array): WorkBook { | ||||
| 
 | ||||
|   const wb: WorkBook = _utils.book_new(); | ||||
|   _utils.book_append_sheet(wb, ws, "Sheet1"); | ||||
|   wb.bookType = "dta" as any; | ||||
|   return wb; | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -1,12 +1,13 @@ | ||||
| { | ||||
| 	"name": "dta", | ||||
| 	"version": "0.0.1", | ||||
| 	"version": "0.0.2", | ||||
| 	"author": "sheetjs", | ||||
| 	"description": "Stata .dta codecs for SheetJS Common Spreadsheet Format", | ||||
| 	"bin": { | ||||
| 		"dta2csv": "./bin/dta2csv.njs" | ||||
| 	}, | ||||
| 	"main": "dist/dta.js", | ||||
| 	"module": "dist/dta.mjs", | ||||
| 	"types": "types", | ||||
| 	"files": [ | ||||
| 		"bin/", | ||||
| @ -33,6 +34,6 @@ | ||||
| 		"node": ">=12.0" | ||||
| 	}, | ||||
| 	"devDependencies": { | ||||
| 		"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.0/xlsx-0.20.0.tgz" | ||||
| 		"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.1/xlsx-0.20.1.tgz" | ||||
| 	} | ||||
| } | ||||
|  | ||||
							
								
								
									
										2
									
								
								packages/dta/types/index.d.ts
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										2
									
								
								packages/dta/types/index.d.ts
									
									
									
									
										vendored
									
									
								
							| @ -1,6 +1,6 @@ | ||||
| import { WorkBook } from 'xlsx'; | ||||
| export { parse, set_utils, version }; | ||||
| declare const version = "0.0.1"; | ||||
| declare const version = "0.0.2"; | ||||
| /** Set internal instance of `utils` | ||||
|  * | ||||
|  * Usage: | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user