fit-file-parser 2.0.4 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ {
2
+ "recommendations": [
3
+ "dbaeumer.vscode-eslint",
4
+ "zixuanchen.vitest-explorer"
5
+ ]
6
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "version": "0.2.0",
3
+ "configurations": [
4
+ {
5
+ "name": "Run Dev (Codegen Watcher)",
6
+ "type": "node",
7
+ "request": "launch",
8
+ "runtimeExecutable": "npm",
9
+ "runtimeArgs": [
10
+ "run",
11
+ "dev"
12
+ ],
13
+ "console": "integratedTerminal"
14
+ },
15
+ {
16
+ "type": "node",
17
+ "request": "launch",
18
+ "name": "Debug Vitest",
19
+ "program": "${workspaceFolder}/node_modules/vitest/vitest.mjs",
20
+ "args": [
21
+ "run"
22
+ ],
23
+ "console": "integratedTerminal",
24
+ "internalConsoleOptions": "neverOpen"
25
+ }
26
+ ]
27
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "version": "2.0.0",
3
+ "tasks": [
4
+ {
5
+ "type": "npm",
6
+ "script": "dev",
7
+ "group": "build",
8
+ "isBackground": true,
9
+ "problemMatcher": {
10
+ "owner": "typescript",
11
+ "pattern": "$tsc",
12
+ "background": {
13
+ "activeOnStart": true,
14
+ "beginsPattern": {
15
+ "regexp": "^.*Starting compilation in watch mode.*$"
16
+ },
17
+ "endsPattern": {
18
+ "regexp": "^.*Found [0-9]+ errors.*$"
19
+ }
20
+ }
21
+ },
22
+ "label": "npm: dev",
23
+ "detail": "tsx --watch --watch-path=src/type_generator.ts --watch-path=src/fit.ts codegen/codegen.ts"
24
+ },
25
+ {
26
+ "type": "npm",
27
+ "script": "test",
28
+ "group": "test",
29
+ "problemMatcher": [],
30
+ "label": "npm: test",
31
+ "detail": "vitest"
32
+ }
33
+ ]
34
+ }
package/README.md CHANGED
@@ -64,6 +64,7 @@ To build the project, run:
64
64
  ```
65
65
  npm run build
66
66
  ```
67
+
67
68
  To run tests, run:
68
69
 
69
70
  ```
@@ -73,6 +74,7 @@ npm test
73
74
  To rebuild the typescript types (as they are autogenerated from the `FIT` object) run:
74
75
 
75
76
  ```npm run codegen
77
+
76
78
  ```
77
79
 
78
80
  > this will update the file `src/fit_types.ts` as it is only running with node (with type stripping), regenerating them requires node>=245
@@ -80,6 +82,7 @@ To rebuild the typescript types (as they are autogenerated from the `FIT` object
80
82
  To run the codegen in watch mode during local development, run:
81
83
 
82
84
  ```npm run dev
85
+
83
86
  ```
84
87
 
85
88
  To build the local examples, run:
package/dist/binary.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { FitParserOptions } from './fit-parser.js';
2
2
  import type { MesgNum } from './fit_types.js';
3
- import { Buffer } from 'node:buffer';
3
+ import { Buffer } from 'buffer';
4
4
  export declare function addEndian(littleEndian: boolean, bytes: number[]): number;
5
5
  export declare function readRecord(blob: Uint8Array, messageTypes: any[], developerFields: any[], startIndex: number, options: FitParserOptions, startDate: number | undefined, pausedTime: number): {
6
6
  messageType: MesgNum | '';
package/dist/binary.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Buffer } from 'node:buffer';
1
+ import { Buffer } from 'buffer';
2
2
  import { FIT } from './fit.js';
3
3
  import { getFitMessage, getFitMessageBaseType } from './messages.js';
4
4
  const CompressedLocalMsgNumMask = 0x60;
@@ -1,4 +1,4 @@
1
- import type { Buffer } from 'node:buffer';
1
+ import type { Buffer } from 'buffer';
2
2
  import type { ParsedFit } from './fit_types.js';
3
3
  export interface FitParserOptions {
4
4
  force?: boolean;
package/eslint.config.js CHANGED
@@ -4,4 +4,12 @@ export default antfu({
4
4
  type: 'lib',
5
5
  gitignore: true,
6
6
  ignores: ['**/test/*.json'],
7
+ stylistic: {
8
+ indent: 2,
9
+ quotes: 'single',
10
+ },
11
+ formatters: true,
12
+ rules: {
13
+ 'unicorn/prefer-node-protocol': 'off',
14
+ },
7
15
  })
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "fit-file-parser",
3
3
  "type": "module",
4
- "version": "2.0.4",
4
+ "version": "2.0.5",
5
5
  "private": false,
6
6
  "description": "Parse your .FIT files easily, directly from JS (Garmin, Polar, Suunto)",
7
7
  "author": {
@@ -35,7 +35,9 @@
35
35
  "exports": {
36
36
  ".": {
37
37
  "types": "./dist/fit-parser.d.ts",
38
- "import": "./dist/fit-parser.js"
38
+ "import": "./dist/fit-parser.js",
39
+ "require": "./dist/fit-parser.js",
40
+ "default": "./dist/fit-parser.js"
39
41
  }
40
42
  },
41
43
  "main": "dist/fit-parser.js",
@@ -61,12 +63,17 @@
61
63
  "build": "tsc --noCheck"
62
64
  },
63
65
  "test": "vitest",
66
+ "dependencies": {
67
+ "buffer": "^6.0.3"
68
+ },
64
69
  "devDependencies": {
65
70
  "@antfu/eslint-config": "^6.2.0",
66
71
  "@types/node": "^24.10.1",
67
72
  "@vitest/coverage-v8": "^4.0.13",
68
73
  "eslint": "^9.10.0",
74
+ "eslint-plugin-format": "^1.1.0",
75
+ "tsx": "^4.21.0",
69
76
  "typescript": "^5.9.3",
70
77
  "vitest": "^4.0.13"
71
78
  }
72
- }
79
+ }