@prairielearn/csv 2.0.20 → 2.0.22

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @prairielearn/csv
2
2
 
3
+ ## 2.0.22
4
+
5
+ ### Patch Changes
6
+
7
+ - 0425922: Upgrade all JavaScript dependencies
8
+
9
+ ## 2.0.21
10
+
11
+ ### Patch Changes
12
+
13
+ - c0b1c74: Enable `declarationMap`
14
+
3
15
  ## 2.0.20
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -22,3 +22,4 @@ interface StringifyOptions<T, U = any> extends Pick<StringifierOptions, 'columns
22
22
  * `node:stream/promises`, which will help ensure that errors are handled properly.
23
23
  */
24
24
  export declare function stringifyStream<T, U = any>(options?: StringifyOptions<T, U>): NodeJS.ReadWriteStream;
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,OAAO,IAAI,kBAAkB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE3F,OAAO,EAAE,KAAK,OAAO,IAAI,gBAAgB,EAAa,MAAM,kBAAkB,CAAC;AAE/E,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;AAElC,MAAM,WAAW,2BAA4B,SAAQ,kBAAkB;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,GAAG,EAAE,EACX,OAAO,GAAE,2BAAgC,GACxC,WAAW,CAuBb;AAED,UAAU,gBAAgB,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,CAAE,SAAQ,IAAI,CAAC,kBAAkB,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC3F,SAAS,CAAC,EAAE,gBA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,CAAC;IAEH,OAAO,WAAW,CAAC;AACrB,CAAC;AAMD;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAC7B,UAAkC,EAAE;IAEpC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,kBAAkB,EAAE,GAAG,OAAO,CAAC;IACjE,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,kBAAkB,CAAC,CAAC;IACxD,IAAI,CAAC,UAAU;QAAE,OAAO,WAAW,CAAC;IACpC,2DAA2D;IAC3D,OAAO,SAAS,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,CAAC;AACvD,CAAC","sourcesContent":["import { Stringifier, type Options as StringifierOptions, stringify } from 'csv-stringify';\nimport multipipe from 'multipipe';\nimport { type Handler as TransformHandler, transform } from 'stream-transform';\n\nexport { stringify, Stringifier };\n\nexport interface StringifyNonblockingOptions extends StringifierOptions {\n batchSize?: number;\n}\n\n/**\n * Streaming transform from an array of objects to a CSV that doesn't\n * block the event loop.\n */\nexport function stringifyNonblocking(\n data: any[],\n options: StringifyNonblockingOptions = {},\n): Stringifier {\n const { batchSize = 100, ...stringifierOptions } = options;\n const stringifier = new Stringifier(stringifierOptions);\n\n process.nextTick(function () {\n let j = 0;\n function loop() {\n for (let i = 0; i < batchSize; i++) {\n if (j < data.length) {\n stringifier.write(data[j]);\n j += 1;\n } else {\n stringifier.end();\n return;\n }\n }\n setImmediate(loop);\n }\n loop();\n });\n\n return stringifier;\n}\n\ninterface StringifyOptions<T, U = any> extends Pick<StringifierOptions, 'columns' | 'header'> {\n transform?: TransformHandler<T, U>;\n}\n\n/**\n * Transforms an object stream into a CSV stream.\n *\n * This is a thin wrapper around `stringify` from the `csv-stringify` package\n * with added support for transforming the input stream.\n *\n * Works best when combined with the `pipeline` function from\n * `node:stream/promises`, which will help ensure that errors are handled properly.\n */\nexport function stringifyStream<T, U = any>(\n options: StringifyOptions<T, U> = {},\n): NodeJS.ReadWriteStream {\n const { transform: _transform, ...stringifierOptions } = options;\n const stringifier = new Stringifier(stringifierOptions);\n if (!_transform) return stringifier;\n // TODO: use native `node:stream#compose` once it's stable.\n return multipipe(transform(_transform), stringifier);\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAsC,SAAS,EAAE,MAAM,eAAe,CAAC;AAC3F,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAoC,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE/E,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;AAMlC;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAW,EACX,UAAuC,EAAE;IAEzC,MAAM,EAAE,SAAS,GAAG,GAAG,EAAE,GAAG,kBAAkB,EAAE,GAAG,OAAO,CAAC;IAC3D,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,kBAAkB,CAAC,CAAC;IAExD,OAAO,CAAC,QAAQ,CAAC;QACf,IAAI,CAAC,GAAG,CAAC,CAAC;QAEV,SAAS,IAAI;YACX,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC;gBACnC,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;oBACpB,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC3B,CAAC,IAAI,CAAC,CAAC;gBACT,CAAC;qBAAM,CAAC;oBACN,WAAW,CAAC,GAAG,EAAE,CAAC;oBAClB,OAAO;gBACT,CAAC;YACH,CAAC;YACD,YAAY,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;QACD,IAAI,EAAE,CAAC;IACT,CAAC,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC;AACrB,CAAC;AAMD;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAC7B,UAAkC,EAAE;IAEpC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,kBAAkB,EAAE,GAAG,OAAO,CAAC;IACjE,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,kBAAkB,CAAC,CAAC;IACxD,IAAI,CAAC,UAAU;QAAE,OAAO,WAAW,CAAC;IACpC,2DAA2D;IAC3D,OAAO,SAAS,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,CAAC;AACvD,CAAC","sourcesContent":["import { Stringifier, type Options as StringifierOptions, stringify } from 'csv-stringify';\nimport multipipe from 'multipipe';\nimport { type Handler as TransformHandler, transform } from 'stream-transform';\n\nexport { stringify, Stringifier };\n\nexport interface StringifyNonblockingOptions extends StringifierOptions {\n batchSize?: number;\n}\n\n/**\n * Streaming transform from an array of objects to a CSV that doesn't\n * block the event loop.\n */\nexport function stringifyNonblocking(\n data: any[],\n options: StringifyNonblockingOptions = {},\n): Stringifier {\n const { batchSize = 100, ...stringifierOptions } = options;\n const stringifier = new Stringifier(stringifierOptions);\n\n process.nextTick(function () {\n let j = 0;\n\n function loop() {\n for (let i = 0; i < batchSize; i++) {\n if (j < data.length) {\n stringifier.write(data[j]);\n j += 1;\n } else {\n stringifier.end();\n return;\n }\n }\n setImmediate(loop);\n }\n loop();\n });\n\n return stringifier;\n}\n\ninterface StringifyOptions<T, U = any> extends Pick<StringifierOptions, 'columns' | 'header'> {\n transform?: TransformHandler<T, U>;\n}\n\n/**\n * Transforms an object stream into a CSV stream.\n *\n * This is a thin wrapper around `stringify` from the `csv-stringify` package\n * with added support for transforming the input stream.\n *\n * Works best when combined with the `pipeline` function from\n * `node:stream/promises`, which will help ensure that errors are handled properly.\n */\nexport function stringifyStream<T, U = any>(\n options: StringifyOptions<T, U> = {},\n): NodeJS.ReadWriteStream {\n const { transform: _transform, ...stringifierOptions } = options;\n const stringifier = new Stringifier(stringifierOptions);\n if (!_transform) return stringifier;\n // TODO: use native `node:stream#compose` once it's stable.\n return multipipe(transform(_transform), stringifier);\n}\n"]}
@@ -1 +1,2 @@
1
1
  export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prairielearn/csv",
3
- "version": "2.0.20",
3
+ "version": "2.0.22",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,10 +21,10 @@
21
21
  "devDependencies": {
22
22
  "@prairielearn/tsconfig": "^0.0.0",
23
23
  "@types/multipipe": "^3.0.5",
24
- "@types/node": "^22.18.8",
25
- "@vitest/coverage-v8": "^3.2.4",
24
+ "@types/node": "^22.18.13",
25
+ "@vitest/coverage-v8": "^4.0.6",
26
26
  "tsx": "^4.20.6",
27
27
  "typescript": "^5.9.3",
28
- "vitest": "^3.2.4"
28
+ "vitest": "^4.0.6"
29
29
  }
30
30
  }
package/src/index.ts CHANGED
@@ -21,6 +21,7 @@ export function stringifyNonblocking(
21
21
 
22
22
  process.nextTick(function () {
23
23
  let j = 0;
24
+
24
25
  function loop() {
25
26
  for (let i = 0; i < batchSize; i++) {
26
27
  if (j < data.length) {
package/vitest.config.ts CHANGED
@@ -2,10 +2,10 @@ import { defineConfig } from 'vitest/config';
2
2
 
3
3
  export default defineConfig({
4
4
  test: {
5
+ dir: `${import.meta.dirname}/src`,
5
6
  coverage: {
6
7
  reporter: ['html', 'text-summary', 'cobertura'],
7
- all: true,
8
- include: ['src/**'],
8
+ include: ['src/**/*.{ts,tsx}'],
9
9
  },
10
10
  },
11
11
  });