Deno
Deno 是一个 JavaScript 运行时,可以从 URL 导入脚本。
¥Deno is a JavaScript runtime that can import scripts from URLs.
模块脚本和类型定义可在 https://cdn.sheetjs.com/ 处获得。
¥Module scripts and type definitions are available at https://cdn.sheetjs.com/.
使用 URL 导入,deno run
将自动下载脚本和类型:
¥Using the URL imports, deno run
will automatically download scripts and types:
// @deno-types="https://cdn.sheetjs.com/xlsx-0.20.3/package/types/index.d.ts"
import * as XLSX from 'https://cdn.sheetjs.com/xlsx-0.20.3/package/xlsx.mjs';
模块 URL 是在 SheetJS CDN 上构建的 ECMAScript 模块。@deno-types
指示 Deno 使用 SheetJS CDN 中的类型定义。
¥The module URL is the ECMAScript Module build on the SheetJS CDN. @deno-types
instructs Deno to use the type definitions from the SheetJS CDN.
优秀的开源软件会随着用户测试和报告而不断成长。任何问题都应报告给 Deno 项目以进行进一步诊断。
¥Great open source software grows with user tests and reports. Any issues should be reported to the Deno project for further diagnosis.
监视存储库 或订阅 RSS 订阅 以在新版本发布时收到通知!
¥Watch the repo or subscribe to the RSS feed to be notified when new versions are released!
编码支持
¥Encoding support
如果需要编码支持,则必须手动导入 cpexcel.full.mjs
:
¥If Encoding support is required, cpexcel.full.mjs
must be manually imported:
/* load the codepage support library for extended support with older formats */
import * as cptable from 'https://cdn.sheetjs.com/xlsx-0.20.3/package/dist/cpexcel.full.mjs';
XLSX.set_cptable(cptable);
升级注意事项
¥Upgrade Notes
升级到最新版本涉及更改导入 URL。导入和类型 URL 应同时更新:
¥Upgrading to the latest version involves changing the import URLs. The import and the types URLs should be updated at the same time:
-// @deno-types="https://cdn.sheetjs.com/xlsx-0.18.3/package/types/index.d.ts"
+// @deno-types="https://cdn.sheetjs.com/xlsx-0.20.3/package/types/index.d.ts"
-import * as XLSX from 'https://cdn.sheetjs.com/xlsx-0.18.3/package/xlsx.mjs';
+import * as XLSX from 'https://cdn.sheetjs.com/xlsx-0.20.3/package/xlsx.mjs';
-import * as cptable from 'https://cdn.sheetjs.com/xlsx-0.18.3/package/dist/cpexcel.full.mjs';
+import * as cptable from 'https://cdn.sheetjs.com/xlsx-0.20.3/package/dist/cpexcel.full.mjs';
Deno 注册表
¥Deno Registry
官方 Deno 注册表已过时。这是一个注册表错误。
¥The official Deno registry is out of date. This is a registry bug.
SheetJS CDN https://cdn.sheetjs.com/ 是 SheetJS 模块的权威来源。
¥The SheetJS CDN https://cdn.sheetjs.com/ is the authoritative source for SheetJS modules.
使用 Deno 注册表的应用可以通过更改 URL 进行迁移。迁移后,可以通过更改版本号来更新脚本。
¥Applications using the Deno registry can migrate by changing the URLs. After migrating, scripts can be updated by changing the version number.
- URL with version
- URL without version
SheetJS CDN 版本没有 v
。例如,v0.18.3
映射到 0.18.3
:
¥The SheetJS CDN version has no v
. For example, v0.18.3
maps to 0.18.3
:
-// @deno-types="https://deno.land/x/sheetjs@v0.18.3/types/index.d.ts"
+// @deno-types="https://cdn.sheetjs.com/xlsx-0.18.3/package/types/index.d.ts"
-import * as XLSX from 'https://deno.land/x/sheetjs@v0.18.3/xlsx.mjs';
+import * as XLSX from 'https://cdn.sheetjs.com/xlsx-0.18.3/package/xlsx.mjs';
-import * as cptable from 'https://deno.land/x/sheetjs@v0.18.3/dist/cpexcel.full.mjs';
+import * as cptable from 'https://cdn.sheetjs.com/xlsx-0.18.3/package/dist/cpexcel.full.mjs';
无版本导入 (https://deno.land/x/sheetjs/xlsx.mjs
) 映射到 0.18.3
:
¥Version-less imports (https://deno.land/x/sheetjs/xlsx.mjs
) map to 0.18.3
:
-// @deno-types="https://deno.land/x/sheetjs/types/index.d.ts"
+// @deno-types="https://cdn.sheetjs.com/xlsx-0.18.3/package/types/index.d.ts"
-import * as XLSX from 'https://deno.land/x/sheetjs/xlsx.mjs';
+import * as XLSX from 'https://cdn.sheetjs.com/xlsx-0.18.3/package/xlsx.mjs';
-import * as cptable from 'https://deno.land/x/sheetjs/dist/cpexcel.full.mjs';
+import * as cptable from 'https://cdn.sheetjs.com/xlsx-0.18.3/package/dist/cpexcel.full.mjs';