@nteract/commutable
Advanced tools
+32
-1
@@ -1,2 +0,2 @@ | ||
| import { fromJS, isNotebookV3 } from "../src/v3"; | ||
| import { CodeCell, NotebookV3, fromJS, isNotebookV3 } from "../src/v3"; | ||
@@ -157,2 +157,33 @@ describe("isNotebookV3", () => { | ||
| }); | ||
| const getCell = (source: string): CodeCell => { | ||
| return { | ||
| cell_type: "code", | ||
| collapsed: false, | ||
| input: [source], | ||
| language: "python", | ||
| metadata: {}, | ||
| outputs: [], | ||
| prompt_number: 7 | ||
| }; | ||
| }; | ||
| it("normalizes line endings to LF for all cell sources", () => { | ||
| const notebook: NotebookV3 = { | ||
| worksheets: [{ | ||
| cells: [ | ||
| getCell("line1\nline2\r\nline3\r\n"), | ||
| getCell("line1\r\nline2\r\nline3\n") | ||
| ], | ||
| metadata: {} | ||
| }], | ||
| metadata: {}, | ||
| nbformat: 3, | ||
| nbformat_minor: 0 | ||
| }; | ||
| const out = fromJS(notebook); | ||
| expect(out.cellMap.get(out.cellOrder.get(0))?.source).toEqual("line1\nline2\nline3\n"); | ||
| expect(out.cellMap.get(out.cellOrder.get(1))?.source).toEqual("line1\nline2\nline3\n"); | ||
| }); | ||
| }); |
+25
-0
@@ -231,2 +231,27 @@ import Immutable, { Record } from "immutable"; | ||
| }); | ||
| describe("fromJS", () => { | ||
| const getCell = (id: string, source: string) => { | ||
| return { | ||
| id, | ||
| cell_type: "code", | ||
| execution_count: null, | ||
| source, | ||
| outputs: [] | ||
| }; | ||
| }; | ||
| it("normalizes line endings to LF for all cell sources", () => { | ||
| const notebook = getNotebook({ | ||
| cells: [ | ||
| getCell("cell1", "line1\nline2\r\nline3\r\n"), | ||
| getCell("cell2", "line1\r\nline2\r\nline3\n") | ||
| ] | ||
| }); | ||
| const out = fromJS(notebook); | ||
| expect(out.cellMap.get("cell1")?.source).toEqual("line1\nline2\nline3\n"); | ||
| expect(out.cellMap.get("cell2")?.source).toEqual("line1\nline2\nline3\n"); | ||
| }); | ||
| }); | ||
| }); |
+18
-6
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.makeRawCell = exports.makeMarkdownCell = exports.makeCodeCell = void 0; | ||
| const primitives_1 = require("./primitives"); | ||
| const immutable_1 = require("immutable"); | ||
| exports.makeCodeCell = immutable_1.Record({ | ||
| function normalizedSourceCellRecord(recordFn) { | ||
| // Transparently wrap the factory, but overwrite the source with its normalized value | ||
| function factory(...args) { | ||
| const res = recordFn.apply(this, args); | ||
| return res.set("source", primitives_1.normalizeLineEndings(res.source)); | ||
| } | ||
| ; | ||
| factory.prototype = recordFn.prototype; | ||
| factory.displayName = recordFn.displayName; | ||
| return factory; | ||
| } | ||
| exports.makeCodeCell = normalizedSourceCellRecord(immutable_1.Record({ | ||
| cell_type: "code", | ||
@@ -21,4 +33,4 @@ execution_count: null, | ||
| outputs: immutable_1.List(), | ||
| }); | ||
| exports.makeMarkdownCell = immutable_1.Record({ | ||
| })); | ||
| exports.makeMarkdownCell = normalizedSourceCellRecord(immutable_1.Record({ | ||
| attachments: undefined, | ||
@@ -34,4 +46,4 @@ cell_type: "markdown", | ||
| source: "", | ||
| }); | ||
| exports.makeRawCell = immutable_1.Record({ | ||
| })); | ||
| exports.makeRawCell = normalizedSourceCellRecord(immutable_1.Record({ | ||
| cell_type: "raw", | ||
@@ -46,3 +58,3 @@ metadata: immutable_1.Map({ | ||
| source: "", | ||
| }); | ||
| })); | ||
| //# sourceMappingURL=cells.js.map |
+1
-1
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"cells.js","sourceRoot":"","sources":["../src/cells.ts"],"names":[],"mappings":";;;AAIA,yCAKmB;AAcN,QAAA,YAAY,GAAG,kBAAM,CAAiB;IACjD,SAAS,EAAE,MAAM;IACjB,eAAe,EAAE,IAAI;IACrB,QAAQ,EAAE,eAAY,CAAC;QACrB,OAAO,EAAE,eAAY,CAAC;YACpB,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,KAAK;SACtB,CAAC;QACF,OAAO,EAAE,eA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AC;AACtC,CAAC;AAcY,QAAA,YAAY,GAAG,0BAA0B,CAAC,kBAAM,CAAiB;IAC5E,SAAS,EAAE,MAAM;IACjB,eAAe,EAAE,IAAI;IACrB,QAAQ,EAAE,eAAY,CAAC;QACrB,OAAO,EAAE,eAAY,CAAC;YACpB,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,KAAK;SACtB,CAAC;QACF,OAAO,EAAE,eAAY,CAAC;YACpB,SAAS,EAAE,eAAY,CAAC;gBACtB,QAAQ,EAAE,KAAK;aAChB,CAAC;SACH,CAAC;KACH,CAAC;IACF,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,gBAAa,EAAE;CACzB,CAAC,CAAC,CAAC;AAcS,QAAA,gBAAgB,GAAG,0BAA0B,CAAC,kBAAM,CAAqB;IACpF,WAAW,EAAE,SAAS;IACtB,SAAS,EAAE,UAAU;IACrB,QAAQ,EAAE,eAAY,CAAC;QACrB,OAAO,EAAE,eAAY,CAAC;YACpB,SAAS,EAAE,eAAY,CAAC;gBACtB,QAAQ,EAAE,KAAK;aAChB,CAAC;SACH,CAAC;KACH,CAAC;IACF,MAAM,EAAE,EAAE;CACX,CAAC,CAAC,CAAC;AAaS,QAAA,WAAW,GAAG,0BAA0B,CAAC,kBAAM,CAAgB;IAC1E,SAAS,EAAE,KAAK;IAChB,QAAQ,EAAE,eAAY,CAAC;QACrB,OAAO,EAAE,eAAY,CAAC;YACpB,SAAS,EAAE,eAAY,CAAC;gBACtB,QAAQ,EAAE,KAAK;aAChB,CAAC;SACH,CAAC;KACH,CAAC;IACF,MAAM,EAAE,EAAE;CACX,CAAC,CAAC,CAAC"} |
@@ -114,2 +114,6 @@ import * as Immutable from "immutable"; | ||
| /** | ||
| * Normalize line endings to \n line feed to be consistent across OS platforms. | ||
| */ | ||
| export declare function normalizeLineEndings(text?: string): string | undefined; | ||
| /** | ||
| * Turn nbformat multiline strings (arrays of strings for simplifying diffs) | ||
@@ -116,0 +120,0 @@ * into strings |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.createOnDiskMediaBundle = exports.createFrozenMediaBundle = exports.deepFreeze = exports.remultiline = exports.demultiline = exports.createCellId = void 0; | ||
| exports.createOnDiskMediaBundle = exports.createFrozenMediaBundle = exports.deepFreeze = exports.remultiline = exports.demultiline = exports.normalizeLineEndings = exports.createCellId = void 0; | ||
| const uuid_1 = require("uuid"); | ||
@@ -10,2 +10,9 @@ function createCellId() { | ||
| /** | ||
| * Normalize line endings to \n line feed to be consistent across OS platforms. | ||
| */ | ||
| function normalizeLineEndings(text) { | ||
| return text ? text.replace(/\r\n/g, "\n") : text; | ||
| } | ||
| exports.normalizeLineEndings = normalizeLineEndings; | ||
| /** | ||
| * Turn nbformat multiline strings (arrays of strings for simplifying diffs) | ||
@@ -12,0 +19,0 @@ * into strings |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"primitives.js","sourceRoot":"","sources":["../src/primitives.ts"],"names":[],"mappings":";;;AACA,+BAAkC;AAalC,SAAgB,YAAY;IAC1B,OAAO,SAAI,EAAE,CAAC;AAChB,CAAC;AAFD,oCAEC;AAqGD;;;GAGG;AACH,SAAgB,WAAW,CAAC,CAAoB;IAC9C,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;QACpB,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;KACnB;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AALD,kCAKC;AAED;;;GAGG;AACH,SAAgB,WAAW,CAAC,CAAoB;IAC9C,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;QACpB,kCAAkC;QAClC,OAAO,CAAC,CAAC;KACV;IACD,2CAA2C;IAC3C,OAAO,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;AAC5D,CAAC;AAPD,kCAOC;AAED,SAAS,SAAS,CAAC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B,OAAO,WAAW,CAAC;IAEnB,sFAAsF;IACtF,0EAA0E;IAE1E,wEAAwE;IACxE,wCAAwC;IACxC,6CAA6C;IAC7C,mCAAmC;IACnC,6BAA6B;IAC7B,iEAAiE;IACjE,gBAAgB;IAChB,yBAAyB;IACzB,gFAAgF;IAChF,QAAQ;IACR,2EAA2E;IAC3E,aAAa;IACb,2CAA2C;IAC3C,MAAM;IACN,IAAI;IACJ,sBAAsB;AACxB,CAAC;AAzBD,0DAyBC"} |
+1
-1
| { | ||
| "name": "@nteract/commutable", | ||
| "version": "7.5.0", | ||
| "version": "7.5.1", | ||
| "description": "library for immutable notebook operations", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
+18
-7
| import { ImmutableOutput } from "./outputs"; | ||
| import { ExecutionCount, MimeBundle } from "./primitives"; | ||
| import { ExecutionCount, MimeBundle, normalizeLineEndings } from "./primitives"; | ||
@@ -12,2 +12,13 @@ import { | ||
| function normalizedSourceCellRecord<T extends { source?: string }>(recordFn: Record.Factory<T>): Record.Factory<T> { | ||
| // Transparently wrap the factory, but overwrite the source with its normalized value | ||
| function factory(this: ThisType<typeof recordFn>, ...args: Parameters<typeof recordFn>) { | ||
| const res = recordFn.apply(this, args); | ||
| return res.set("source", normalizeLineEndings(res.source)); | ||
| }; | ||
| factory.prototype = recordFn.prototype; | ||
| factory.displayName = recordFn.displayName; | ||
| return factory as Record.Factory<T>; | ||
| } | ||
| /* CodeCell Record Boilerplate */ | ||
@@ -25,3 +36,3 @@ | ||
| export const makeCodeCell = Record<CodeCellParams>({ | ||
| export const makeCodeCell = normalizedSourceCellRecord(Record<CodeCellParams>({ | ||
| cell_type: "code", | ||
@@ -42,3 +53,3 @@ execution_count: null, | ||
| outputs: ImmutableList(), | ||
| }); | ||
| })); | ||
@@ -57,3 +68,3 @@ export type ImmutableCodeCell = RecordOf<CodeCellParams>; | ||
| export const makeMarkdownCell = Record<MarkdownCellParams>({ | ||
| export const makeMarkdownCell = normalizedSourceCellRecord(Record<MarkdownCellParams>({ | ||
| attachments: undefined, | ||
@@ -69,3 +80,3 @@ cell_type: "markdown", | ||
| source: "", | ||
| }); | ||
| })); | ||
@@ -83,3 +94,3 @@ export type ImmutableMarkdownCell = RecordOf<MarkdownCellParams>; | ||
| export const makeRawCell = Record<RawCellParams>({ | ||
| export const makeRawCell = normalizedSourceCellRecord(Record<RawCellParams>({ | ||
| cell_type: "raw", | ||
@@ -94,3 +105,3 @@ metadata: ImmutableMap({ | ||
| source: "", | ||
| }); | ||
| })); | ||
@@ -97,0 +108,0 @@ export type ImmutableRawCell = RecordOf<RawCellParams>; |
@@ -119,2 +119,9 @@ import * as Immutable from "immutable"; | ||
| /** | ||
| * Normalize line endings to \n line feed to be consistent across OS platforms. | ||
| */ | ||
| export function normalizeLineEndings(text?: string): string | undefined { | ||
| return text ? text.replace(/\r\n/g, "\n") : text; | ||
| } | ||
| /** | ||
| * Turn nbformat multiline strings (arrays of strings for simplifying diffs) | ||
@@ -121,0 +128,0 @@ * into strings |
Sorry, the diff of this file is not supported yet
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
744231
0.68%3475
2.63%