author
int64 4.98k
943k
| date
stringdate 2017-04-15 16:45:02
2022-02-25 15:32:15
| timezone
int64 -46,800
39.6k
| hash
stringlengths 40
40
| message
stringlengths 8
468
| mods
listlengths 1
16
| language
stringclasses 9
values | license
stringclasses 2
values | repo
stringclasses 119
values | original_message
stringlengths 12
491
| is_CCS
int64 1
1
| commit_type
stringclasses 129
values | commit_scope
stringlengths 1
44
⌀ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
807,849
|
17.04.2018 18:49:59
| 25,200
|
881bc2a44702bd7a592c3dada4037fc2952f4ebc
|
test(helpers): Switch to new snapshot serializer API
|
[
{
"change_type": "MODIFY",
"diff": "\"use strict\";\nconst normalizeNewline = require(\"normalize-newline\");\n-const serializeGitSHA = require(\"@lerna-test/serialize-git-sha\");\n+const gitSHA = require(\"@lerna-test/serialize-git-sha\");\n// expect.addSnapshotSerializer(require(\"@lerna-test/serialize-changelog\"));\nmodule.exports = {\n- print(val) {\n- return serializeGitSHA\n- .print(normalizeNewline(val))\n+ serialize(str) {\n+ return gitSHA\n+ .serialize(normalizeNewline(str))\n.replace(/(\\[.*?\\])\\(.*\\/commits\\/SHA\\)/g, \"$1(COMMIT_URL)\")\n.replace(/\\(\\d{4}-\\d{2}-\\d{2}\\)/g, \"(YYYY-MM-DD)\");\n},\ntest(val) {\n- return val && typeof val === \"string\";\n+ return val != null && typeof val === \"string\";\n},\n};\n",
"new_path": "helpers/serialize-changelog/index.js",
"old_path": "helpers/serialize-changelog/index.js"
},
{
"change_type": "MODIFY",
"diff": "// expect.addSnapshotSerializer(require(\"@lerna-test/serialize-git-sha\"));\nmodule.exports = {\n- print(val) {\n+ serialize(str) {\nreturn (\n- val\n+ str\n// short SHA tends to be in the path diff comparisons\n.replace(/\\b[0-9a-f]{7,8}\\b/g, \"SHA\")\n// full SHA corresponds to gitHead property in package.json files\n@@ -12,6 +12,6 @@ module.exports = {\n);\n},\ntest(val) {\n- return val && typeof val === \"string\";\n+ return val != null && typeof val === \"string\" && /[0-9a-f]{7,40}/.test(val);\n},\n};\n",
"new_path": "helpers/serialize-git-sha/index.js",
"old_path": "helpers/serialize-git-sha/index.js"
},
{
"change_type": "MODIFY",
"diff": "\"use strict\";\nconst execa = require(\"execa\");\n-const serializeGitSHA = require(\"@lerna-test/serialize-git-sha\");\n+const gitSHA = require(\"@lerna-test/serialize-git-sha\");\nmodule.exports = showCommit;\nfunction showCommit(cwd, ...args) {\nreturn execa\n.stdout(\"git\", [\"show\", \"--unified=0\", \"--ignore-space-at-eol\", \"--pretty=%B%+D\", ...args], { cwd })\n- .then(stdout => serializeGitSHA.print(stdout));\n+ .then(stdout => gitSHA.serialize(stdout));\n}\n",
"new_path": "helpers/show-commit/index.js",
"old_path": "helpers/show-commit/index.js"
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
test(helpers): Switch to new snapshot serializer API
| 1
|
test
|
helpers
|
807,849
|
17.04.2018 19:00:28
| 25,200
|
48096c4dc47fd9cd6a152926ca0640a70c836dd0
|
feat: Remove core/git-utils package
BREAKING CHANGE: `@lerna/git-utils` is gone. Don't use it.
|
[
{
"change_type": "DELETE",
"diff": "-# Change Log\n-\n-All notable changes to this project will be documented in this file.\n-See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n-\n-<a name=\"3.0.0-beta.15\"></a>\n-# [3.0.0-beta.15](https://github.com/lerna/lerna/compare/v3.0.0-beta.14...v3.0.0-beta.15) (2018-04-09)\n-\n-\n-### Bug Fixes\n-\n-* **publish:** Allow tag check to fail with strong warning ([#1355](https://github.com/lerna/lerna/issues/1355)) ([f5268cd](https://github.com/lerna/lerna/commit/f5268cd))\n-\n-\n-\n-\n-\n-<a name=\"3.0.0-beta.13\"></a>\n-# [3.0.0-beta.13](https://github.com/lerna/lerna/compare/v3.0.0-beta.12...v3.0.0-beta.13) (2018-03-31)\n-\n-**Note:** Version bump only for package @lerna/git-utils\n-\n-\n-\n-\n-\n-<a name=\"3.0.0-beta.12\"></a>\n-# [3.0.0-beta.12](https://github.com/lerna/lerna/compare/v3.0.0-beta.11...v3.0.0-beta.12) (2018-03-30)\n-\n-**Note:** Version bump only for package @lerna/git-utils\n-\n-\n-\n-\n-\n-<a name=\"3.0.0-beta.11\"></a>\n-# [3.0.0-beta.11](https://github.com/lerna/lerna/compare/v3.0.0-beta.10...v3.0.0-beta.11) (2018-03-29)\n-\n-**Note:** Version bump only for package @lerna/git-utils\n-\n-\n-\n-\n-\n-<a name=\"3.0.0-beta.9\"></a>\n-# [3.0.0-beta.9](https://github.com/lerna/lerna/compare/v3.0.0-beta.8...v3.0.0-beta.9) (2018-03-24)\n-\n-\n-### Bug Fixes\n-\n-* **git-utils:** Remove unused methods, stop mocking tests ([3e00d7a](https://github.com/lerna/lerna/commit/3e00d7a))\n-\n-\n-\n-\n-\n-<a name=\"3.0.0-beta.3\"></a>\n-# [3.0.0-beta.3](https://github.com/lerna/lerna/compare/v3.0.0-beta.2...v3.0.0-beta.3) (2018-03-15)\n-\n-\n-### Bug Fixes\n-\n-* **utils:** Use safe relative path when calling git diff ([#1323](https://github.com/lerna/lerna/issues/1323)) ([619c477](https://github.com/lerna/lerna/commit/619c477))\n-\n-\n-### Features\n-\n-* Check for upstream changes before attempting to publish ([#1317](https://github.com/lerna/lerna/issues/1317)) ([cef0a69](https://github.com/lerna/lerna/commit/cef0a69))\n",
"new_path": null,
"old_path": "core/git-utils/CHANGELOG.md"
},
{
"change_type": "DELETE",
"diff": "-# `@lerna/git-utils`\n-\n-> description TODO\n-\n-## Usage\n-\n-TODO\n",
"new_path": null,
"old_path": "core/git-utils/README.md"
},
{
"change_type": "DELETE",
"diff": "-{\n- \"name\": \"git-utils-basic\",\n- \"version\": \"0.0.0-ignored\",\n- \"description\": \"Just here to create empty git repos\"\n-}\n",
"new_path": null,
"old_path": "core/git-utils/__tests__/__fixtures__/basic/package.json"
},
{
"change_type": "DELETE",
"diff": "-\"use strict\";\n-\n-const execa = require(\"execa\");\n-const fs = require(\"fs-extra\");\n-const path = require(\"path\");\n-\n-// helpers\n-const initFixture = require(\"@lerna-test/init-fixture\")(__dirname);\n-\n-// file under test\n-const GitUtilities = require(\"..\");\n-\n-describe(\"GitUtilities\", () => {\n- describe(\".hasTags()\", () => {\n- it(\"returns true when one or more git tags exist\", async () => {\n- const cwd = await initFixture(\"basic\");\n-\n- expect(GitUtilities.hasTags({ cwd })).toBe(false);\n-\n- await execa(\"git\", [\"tag\", \"v1.2.3\", \"-m\", \"v1.2.3\"], { cwd });\n- expect(GitUtilities.hasTags({ cwd })).toBe(true);\n- });\n- });\n-\n- describe(\".getLastTag()\", () => {\n- it(\"returns the closest tag\", async () => {\n- const cwd = await initFixture(\"basic\");\n-\n- await execa(\"git\", [\"tag\", \"v1.2.3\", \"-m\", \"v1.2.3\"], { cwd });\n-\n- expect(GitUtilities.getLastTag({ cwd })).toBe(\"v1.2.3\");\n- });\n- });\n-\n- describe(\".diffSinceIn()\", () => {\n- it(\"omits location filter when location is current working directory\", async () => {\n- const cwd = await initFixture(\"basic\");\n- const file = path.join(cwd, \"packages\", \"pkg-5\", \"index.js\");\n-\n- await execa(\"git\", [\"tag\", \"v1.2.3\", \"-m\", \"v1.2.3\"], { cwd });\n-\n- await fs.outputFile(file, \"hello\");\n- await fs.writeJSON(path.join(cwd, \"package.json\"), { foo: \"bar\" });\n-\n- await execa(\"git\", [\"add\", \".\"], { cwd });\n- await execa(\"git\", [\"commit\", \"-m\", \"change\"], { cwd });\n-\n- const rootDiff = GitUtilities.diffSinceIn(\"v1.2.3\", cwd, { cwd });\n- const fileDiff = GitUtilities.diffSinceIn(\"v1.2.3\", path.dirname(file), { cwd });\n-\n- expect(rootDiff).toMatch(\"package.json\");\n- expect(fileDiff).toBe(\"packages/pkg-5/index.js\");\n- });\n- });\n-});\n",
"new_path": null,
"old_path": "core/git-utils/__tests__/git-utils.test.js"
},
{
"change_type": "DELETE",
"diff": "-\"use strict\";\n-\n-const log = require(\"npmlog\");\n-const path = require(\"path\");\n-const slash = require(\"slash\");\n-\n-const ChildProcessUtilities = require(\"@lerna/child-process\");\n-\n-function hasTags(opts) {\n- log.silly(\"hasTags\");\n- let result = false;\n-\n- try {\n- result = !!ChildProcessUtilities.execSync(\"git\", [\"tag\"], opts);\n- } catch (err) {\n- log.warn(\"ENOTAGS\", \"No git tags were reachable from this branch!\");\n- log.verbose(\"hasTags error\", err);\n- }\n-\n- log.verbose(\"hasTags\", result);\n-\n- return result;\n-}\n-\n-function getLastTag(opts) {\n- log.silly(\"getLastTag\");\n-\n- const lastTag = ChildProcessUtilities.execSync(\"git\", [\"describe\", \"--tags\", \"--abbrev=0\"], opts);\n- log.verbose(\"getLastTag\", lastTag);\n-\n- return lastTag;\n-}\n-\n-function diffSinceIn(committish, location, opts) {\n- const args = [\"diff\", \"--name-only\", committish];\n- const formattedLocation = slash(path.relative(opts.cwd, location));\n-\n- if (formattedLocation) {\n- // avoid same-directory path.relative() === \"\"\n- args.push(\"--\", formattedLocation);\n- }\n-\n- log.silly(\"diffSinceIn\", committish, formattedLocation);\n-\n- const diff = ChildProcessUtilities.execSync(\"git\", args, opts);\n- log.silly(\"diff\", diff);\n-\n- return diff;\n-}\n-\n-exports.hasTags = hasTags;\n-exports.getLastTag = getLastTag;\n-exports.diffSinceIn = diffSinceIn;\n",
"new_path": null,
"old_path": "core/git-utils/index.js"
},
{
"change_type": "DELETE",
"diff": "-{\n- \"name\": \"@lerna/git-utils\",\n- \"version\": \"3.0.0-beta.15\",\n- \"description\": \"TODO\",\n- \"keywords\": [\n- \"lerna\",\n- \"utils\"\n- ],\n- \"homepage\": \"https://github.com/lerna/lerna\",\n- \"license\": \"MIT\",\n- \"author\": {\n- \"name\": \"Daniel Stockman\",\n- \"url\": \"https://github.com/evocateur\"\n- },\n- \"files\": [\n- \"index.js\"\n- ],\n- \"main\": \"index.js\",\n- \"engines\": {\n- \"node\": \">= 6.9.0\"\n- },\n- \"publishConfig\": {\n- \"access\": \"public\"\n- },\n- \"repository\": {\n- \"type\": \"git\",\n- \"url\": \"git+https://github.com/lerna/lerna.git\"\n- },\n- \"scripts\": {\n- \"test\": \"echo \\\"Run tests from root\\\" && exit 1\"\n- },\n- \"dependencies\": {\n- \"@lerna/child-process\": \"file:../child-process\",\n- \"npmlog\": \"^4.1.2\",\n- \"slash\": \"^1.0.0\"\n- }\n-}\n",
"new_path": null,
"old_path": "core/git-utils/package.json"
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
feat: Remove core/git-utils package
BREAKING CHANGE: `@lerna/git-utils` is gone. Don't use it.
| 1
|
feat
| null |
217,922
|
17.04.2018 19:02:13
| -7,200
|
358e81f8a4fd783cabb74e14fd1397ff3514e023
|
fix: final permissions system fix, thanks javascript references
|
[
{
"change_type": "MODIFY",
"diff": "@@ -98,6 +98,7 @@ export class ListManagerService {\npublic upgradeList(list: List): Observable<List> {\nreturn this.zone.runOutsideAngular(() => {\n+ const permissions = list.permissionsRegistry;\nconst backup = [];\nlist.crystals.forEach(item => {\nbackup.push({array: 'crystals', item: item});\n@@ -151,6 +152,7 @@ export class ListManagerService {\n}\n}\n});\n+ resultList.permissionsRegistry = permissions;\nreturn resultList;\n});\n});\n",
"new_path": "src/app/core/list/list-manager.service.ts",
"old_path": "src/app/core/list/list-manager.service.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -33,6 +33,10 @@ export class PermissionsPopupComponent {\nconstructor(@Inject(MAT_DIALOG_DATA) public data: DataWithPermissions, private dialog: MatDialog, private userService: UserService,\nprivate dialogRef: MatDialogRef<PermissionsPopupComponent>, serializer: NgSerializerService,\nprivate dataService: DataService) {\n+ // If this permissions registry is bugged, rebuild it.\n+ if (data.permissionsRegistry.everyone.write === true) {\n+ this.registry = new PermissionsRegistry();\n+ }\n// Create a copy to work on.\nthis.registry = serializer.deserialize(JSON.parse(JSON.stringify(data.permissionsRegistry)), PermissionsRegistry);\n@@ -107,7 +111,7 @@ export class PermissionsPopupComponent {\n.subscribe(user => {\nif (this.registry.registry[user.$key] === undefined && this.data.authorId !== user.$key) {\n// By default, a new row has the same permissions as everyone.\n- this.registry.registry[user.$key] = this.registry.everyone;\n+ this.registry.registry[user.$key] = JSON.parse(JSON.stringify(this.registry.everyone));\nthis.registrySubject.next(this.registry);\n}\n});\n@@ -130,15 +134,13 @@ export class PermissionsPopupComponent {\n}\nsave(): void {\n+ console.log(this.registry);\nthis.saving = true;\nconst usersSharedDeletions: string[] = [];\nconst usersSharedAdditions: string[] = [];\nthis.data.permissionsRegistry.forEach((userId, permissions) => {\n// If user has been deleted from permissions and had write permissions, remove the list from shared lists, same if write\n// permission has been removed\n- if (this.registry.registry[userId] !== undefined) {\n- console.log(permissions.write, this.registry.registry[userId].write, userId);\n- }\nif (permissions.write && (this.registry.registry[userId] === undefined || this.registry.registry[userId].write === false)) {\nusersSharedDeletions.push(userId)\n} else if (!permissions.write && this.registry.registry[userId] !== undefined && this.registry.registry[userId].write) {\n",
"new_path": "src/app/modules/common-components/permissions-popup/permissions-popup.component.ts",
"old_path": "src/app/modules/common-components/permissions-popup/permissions-popup.component.ts"
},
{
"change_type": "MODIFY",
"diff": "></app-list-panel>\n</div>\n<div class=\"shared-lists\" *ngIf=\"sharedLists | async as sharedListsData\">\n+ <div *ngIf=\"sharedListsData.length > 0\">\n<h2>{{\"LISTS.Shared_lists\" | translate}}</h2>\n<mat-divider class=\"divider\"></mat-divider>\n+ </div>\n<div class=\"row\" *ngFor=\"let list of sharedListsData;trackBy: trackByListsFn; let i = index;\">\n<app-list-panel\n[list]=\"list\"\n{{'WORKSHOP.Add_workshop' | translate}}\n</button>\n</div>\n- <div class=\"workshops\" *ngIf=\"sharedWorkshops as sharedWorkshopsData\">\n+ <div class=\"workshops\" *ngIf=\"sharedWorkshops | async as sharedWorkshopsData\">\n+ <div *ngIf=\"sharedWorkshopsData.length > 0\">\n<h2>{{'WORKSHOP.Shared_workshops' | translate}}</h2>\n<mat-divider class=\"divider\"></mat-divider>\n- <div *ngFor=\"let workshopData of sharedWorkshopsData | async; trackBy: trackByWorkshopFn; let i = index\"\n+ </div>\n+ <div *ngFor=\"let workshopData of sharedWorkshopsData; trackBy: trackByWorkshopFn; let i = index\"\nclass=\"row\">\n<mat-expansion-panel [ngClass]=\"{odd: i%2>0}\">\n<mat-expansion-panel-header>\n",
"new_path": "src/app/pages/lists/lists/lists.component.html",
"old_path": "src/app/pages/lists/lists/lists.component.html"
},
{
"change_type": "MODIFY",
"diff": "@@ -261,7 +261,8 @@ export class ListsComponent extends ComponentWithSubscriptions implements OnInit\n}\nngOnInit() {\n- this.sharedLists = this.userService.getUserData().mergeMap(user => {\n+ this.sharedLists = this.userService.getUserData()\n+ .mergeMap(user => {\nreturn Observable.combineLatest((user.sharedLists || []).map(listId => this.listService.get(listId)\n.catch(() => {\nuser.sharedLists = user.sharedLists.filter(id => id !== listId);\n",
"new_path": "src/app/pages/lists/lists/lists.component.ts",
"old_path": "src/app/pages/lists/lists/lists.component.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -9,11 +9,11 @@ export const environment = {\nproduction: false,\nversion: version,\nfirebase: {\n- apiKey: 'AIzaSyCkrNPf7XlyuxQeqNtynvDFDnQ-XigG3WA',\n- authDomain: 'ffxiv-teamcraft-beta.firebaseapp.com',\n- databaseURL: 'https://ffxiv-teamcraft-beta.firebaseio.com',\n- projectId: 'ffxiv-teamcraft-beta',\n- storageBucket: 'ffxiv-teamcraft-beta.appspot.com',\n- messagingSenderId: '716469847404'\n+ apiKey: 'AIzaSyDZPSJj-nXHLIATOz3IBESUTFk8zvFaUc0',\n+ authDomain: 'ffxivteamcraft.firebaseapp.com',\n+ databaseURL: 'https://ffxivteamcraft.firebaseio.com',\n+ projectId: 'ffxivteamcraft',\n+ storageBucket: 'ffxivteamcraft.appspot.com',\n+ messagingSenderId: '1082504004791'\n}\n};\n",
"new_path": "src/environments/environment.ts",
"old_path": "src/environments/environment.ts"
}
] |
TypeScript
|
MIT License
|
ffxiv-teamcraft/ffxiv-teamcraft
|
fix: final permissions system fix, thanks javascript references
| 1
|
fix
| null |
217,922
|
17.04.2018 19:07:55
| -7,200
|
b89377244d1e0298d616c0e812bd9d53f9044f47
|
fix: gathering item location can't find non-timed nodes
|
[
{
"change_type": "MODIFY",
"diff": "@@ -43,9 +43,11 @@ export class BellNodesService {\ngetNode(id: number): any {\nconst node = this.nodes.find(n => n.id === id);\n+ if (node !== undefined) {\nnode.itemId = id;\nnode.zoneid = this.localizedDataService.getAreaIdByENName(node.zone);\nnode.areaid = this.localizedDataService.getAreaIdByENName(node.title);\n+ }\nreturn node;\n}\n}\n",
"new_path": "src/app/core/data/bell-nodes.service.ts",
"old_path": "src/app/core/data/bell-nodes.service.ts"
}
] |
TypeScript
|
MIT License
|
ffxiv-teamcraft/ffxiv-teamcraft
|
fix: gathering item location can't find non-timed nodes
| 1
|
fix
| null |
807,849
|
17.04.2018 19:29:58
| 25,200
|
9879fef6b8adc4f314919d4e8f18041d69558a45
|
fix(diff): Diff since last release in branch, _not_ most recent global tag
|
[
{
"change_type": "MODIFY",
"diff": "@@ -7,14 +7,16 @@ module.exports = getLastCommit;\nfunction getLastCommit(execOpts) {\nif (hasTags(execOpts)) {\n- return getLastTaggedCommit(execOpts);\n+ log.silly(\"getLastTagInBranch\");\n+\n+ return childProcess.execSync(\"git\", [\"describe\", \"--tags\", \"--abbrev=0\"], execOpts);\n}\n- return getFirstCommit(execOpts);\n+ log.silly(\"getFirstCommit\");\n+ return childProcess.execSync(\"git\", [\"rev-list\", \"--max-parents=0\", \"HEAD\"], execOpts);\n}\nfunction hasTags(opts) {\n- log.silly(\"hasTags\");\nlet result = false;\ntry {\n@@ -28,21 +30,3 @@ function hasTags(opts) {\nreturn result;\n}\n-\n-function getLastTaggedCommit(opts) {\n- log.silly(\"getLastTaggedCommit\");\n-\n- const taggedCommit = childProcess.execSync(\"git\", [\"rev-list\", \"--tags\", \"--max-count=1\"], opts);\n- log.verbose(\"getLastTaggedCommit\", taggedCommit);\n-\n- return taggedCommit;\n-}\n-\n-function getFirstCommit(opts) {\n- log.silly(\"getFirstCommit\");\n-\n- const firstCommit = childProcess.execSync(\"git\", [\"rev-list\", \"--max-parents=0\", \"HEAD\"], opts);\n- log.verbose(\"getFirstCommit\", firstCommit);\n-\n- return firstCommit;\n-}\n",
"new_path": "commands/diff/lib/get-last-commit.js",
"old_path": "commands/diff/lib/get-last-commit.js"
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
fix(diff): Diff since last release in branch, _not_ most recent global tag
| 1
|
fix
|
diff
|
217,922
|
17.04.2018 20:32:54
| -7,200
|
0bc58ac911ec7d2c69a5dc0a318c43bf0f6d1217
|
chore: fix for workshops with lists not found inside
|
[
{
"change_type": "MODIFY",
"diff": "@@ -103,7 +103,8 @@ export class ListService {\nif (workshop.listIds.length === 0) {\nreturn Observable.of([]);\n}\n- return Observable.combineLatest(workshop.listIds.map(listId => this.get(listId)));\n+ return Observable.combineLatest(workshop.listIds.map(listId => this.get(listId).catch(() => Observable.of(null))))\n+ .map(lists => lists.filter(l => l !== null));\n}\npublic add(list: List): Observable<string> {\n",
"new_path": "src/app/core/database/list.service.ts",
"old_path": "src/app/core/database/list.service.ts"
}
] |
TypeScript
|
MIT License
|
ffxiv-teamcraft/ffxiv-teamcraft
|
chore: fix for workshops with lists not found inside
| 1
|
chore
| null |
217,922
|
17.04.2018 20:34:34
| -7,200
|
3d213cabc936fdcef02bcd537407b802b14c2aa7
|
fix: updated translations to avoid confusion with shared items (which are only write access items)
|
[
{
"change_type": "MODIFY",
"diff": "\"Created_by\": \"Created by {{name}}\",\n\"Share_link_copied\": \"Workshop share link copied\",\n\"Not_found\": \"Workshop not found or you don't have access to it\",\n- \"Shared_workshops\": \"Workshops shared with you\"\n+ \"Shared_workshops\": \"Workshops you have write access to\"\n},\n\"ABOUT\": {\n\"title\": \"About\",\n\"LISTS\": {\n\"Regenerate_all\": \"Regenerate all lists\",\n\"Merge_lists\": \"Merge lists\",\n- \"Shared_lists\": \"Lists shared with you\",\n+ \"Shared_lists\": \"Lists you have write access to\",\n\"IMPORT\": {\n\"Title\": \"Import list from external website\",\n\"Paste_link_step_title\": \"Paste your link to the external list\",\n",
"new_path": "src/assets/i18n/en.json",
"old_path": "src/assets/i18n/en.json"
}
] |
TypeScript
|
MIT License
|
ffxiv-teamcraft/ffxiv-teamcraft
|
fix: updated translations to avoid confusion with shared items (which are only write access items)
| 1
|
fix
| null |
679,913
|
17.04.2018 20:43:53
| -3,600
|
8f3a3d1003e452eb6341a09d10ad0bc165bca497
|
feat(paths): add setInMany() and mutInMany(), add dependency
|
[
{
"change_type": "MODIFY",
"diff": "\"typescript\": \"^2.8.1\"\n},\n\"dependencies\": {\n+ \"@thi.ng/api\": \"^2.2.0\",\n\"@thi.ng/checks\": \"^1.4.0\"\n},\n\"keywords\": [\n",
"new_path": "packages/paths/package.json",
"old_path": "packages/paths/package.json"
},
{
"change_type": "MODIFY",
"diff": "+import { illegalArgs } from \"@thi.ng/api/error\";\nimport { isArray } from \"@thi.ng/checks/is-array\";\nimport { isString } from \"@thi.ng/checks/is-string\";\n@@ -188,6 +189,31 @@ export function setIn(state: any, path: Path, val: any) {\nreturn setter(path)(state, val);\n}\n+/**\n+ * Like `setIn()`, but takes any number of path-value pairs and applies\n+ * them in sequence by calling `setIn()` for each. Any key paths missing\n+ * in the data structure will be created. Does *not* mutate original\n+ * (instead use `mutInMany()` for this purpose).\n+ *\n+ * ```\n+ * setInMany({}, \"a.b\", 10, \"x.y.z\", 20)\n+ * // { a: { b: 10 }, x: { y: { z: 20 } } }\n+ * ```\n+ *\n+ * @param state\n+ * @param pairs\n+ */\n+export function setInMany(state: any, ...pairs: any[]) {\n+ const n = pairs.length;\n+ if ((n & 1)) {\n+ illegalArgs(`require an even number of args (got ${pairs.length})`);\n+ }\n+ for (let i = 0; i < n; i += 2) {\n+ state = setIn(state, pairs[i], pairs[i + 1]);\n+ }\n+ return state;\n+}\n+\n/**\n* Similar to `setIn()`, but applies given function to current path\n* value (incl. any additional/optional arguments passed to `updateIn`)\n@@ -287,3 +313,27 @@ export function mutator(path: Path) {\nexport function mutIn(state: any, path: Path, val: any) {\nreturn mutator(path)(state, val);\n}\n+\n+/**\n+ * Like `mutIn()`, but takes any number of path-value pairs and applies\n+ * them in sequence. All key paths must already be present in the given\n+ * data structure until their penultimate key.\n+ *\n+ * ```\n+ * mutInMany({a: {b: 1}, x: {y: {z: 2}}}, \"a.b\", 10, \"x.y.z\", 20)\n+ * // { a: { b: 10 }, x: { y: { z: 20 } } }\n+ * ```\n+ *\n+ * @param state\n+ * @param pairs\n+ */\n+export function mutInMany(state: any, ...pairs: any[]) {\n+ const n = pairs.length;\n+ if ((n & 1)) {\n+ illegalArgs(`require an even number of args (got ${pairs.length})`);\n+ }\n+ for (let i = 0; i < n && state; i += 2) {\n+ state = mutIn(state, pairs[i], pairs[i + 1]);\n+ }\n+ return state;\n+}\n",
"new_path": "packages/paths/src/index.ts",
"old_path": "packages/paths/src/index.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
feat(paths): add setInMany() and mutInMany(), add @thi.ng/api dependency
| 1
|
feat
|
paths
|
679,913
|
18.04.2018 01:00:54
| -3,600
|
c67607b78125516676b717a95d5c3f87b466a771
|
build(examples): update dev deps
|
[
{
"change_type": "MODIFY",
"diff": "\"start\": \"webpack-dev-server --open --mode development --devtool inline-source-map\"\n},\n\"devDependencies\": {\n- \"ts-loader\": \"^4.1.0\",\n+ \"ts-loader\": \"^4.2.0\",\n\"typescript\": \"^2.8.1\",\n- \"webpack\": \"^4.4.1\",\n- \"webpack-cli\": \"^2.0.13\",\n- \"webpack-dev-server\": \"^3.1.1\"\n+ \"webpack\": \"^4.6.0\",\n+ \"webpack-cli\": \"^2.0.14\",\n+ \"webpack-dev-server\": \"^3.1.3\"\n},\n\"dependencies\": {\n\"@thi.ng/api\": \"latest\",\n",
"new_path": "examples/async-effect/package.json",
"old_path": "examples/async-effect/package.json"
},
{
"change_type": "MODIFY",
"diff": "\"start\": \"webpack-dev-server --open --mode development --devtool inline-source-map\"\n},\n\"devDependencies\": {\n- \"ts-loader\": \"^4.1.0\",\n+ \"ts-loader\": \"^4.2.0\",\n\"typescript\": \"^2.8.1\",\n- \"webpack\": \"^4.4.1\",\n- \"webpack-cli\": \"^2.0.13\",\n- \"webpack-dev-server\": \"^3.1.1\"\n+ \"webpack\": \"^4.6.0\",\n+ \"webpack-cli\": \"^2.0.14\",\n+ \"webpack-dev-server\": \"^3.1.3\"\n},\n\"dependencies\": {\n\"@thi.ng/api\": \"latest\",\n",
"new_path": "examples/cellular-automata/package.json",
"old_path": "examples/cellular-automata/package.json"
},
{
"change_type": "MODIFY",
"diff": "\"start\": \"webpack-dev-server --open --mode development --devtool inline-source-map\"\n},\n\"devDependencies\": {\n- \"ts-loader\": \"^4.1.0\",\n+ \"ts-loader\": \"^4.2.0\",\n\"typescript\": \"^2.8.1\",\n- \"webpack\": \"^4.4.1\",\n- \"webpack-cli\": \"^2.0.13\",\n- \"webpack-dev-server\": \"^3.1.1\"\n+ \"webpack\": \"^4.6.0\",\n+ \"webpack-cli\": \"^2.0.14\",\n+ \"webpack-dev-server\": \"^3.1.3\"\n},\n\"dependencies\": {\n\"@thi.ng/hdom\": \"latest\"\n",
"new_path": "examples/dashboard/package.json",
"old_path": "examples/dashboard/package.json"
},
{
"change_type": "MODIFY",
"diff": "\"start\": \"webpack-dev-server --open --mode development --devtool inline-source-map\"\n},\n\"devDependencies\": {\n- \"ts-loader\": \"^4.1.0\",\n+ \"ts-loader\": \"^4.2.0\",\n\"typescript\": \"^2.8.1\",\n- \"webpack\": \"^4.4.1\",\n- \"webpack-cli\": \"^2.0.13\",\n- \"webpack-dev-server\": \"^3.1.1\"\n+ \"webpack\": \"^4.6.0\",\n+ \"webpack-cli\": \"^2.0.14\",\n+ \"webpack-dev-server\": \"^3.1.3\"\n},\n\"dependencies\": {\n\"@thi.ng/api\": \"latest\",\n",
"new_path": "examples/devcards/package.json",
"old_path": "examples/devcards/package.json"
},
{
"change_type": "MODIFY",
"diff": "\"start\": \"webpack-dev-server --open --mode development --devtool inline-source-map\"\n},\n\"devDependencies\": {\n- \"ts-loader\": \"^4.1.0\",\n+ \"ts-loader\": \"^4.2.0\",\n\"typescript\": \"^2.8.1\",\n- \"webpack\": \"^4.4.1\",\n- \"webpack-cli\": \"^2.0.13\",\n- \"webpack-dev-server\": \"^3.1.1\"\n+ \"webpack\": \"^4.6.0\",\n+ \"webpack-cli\": \"^2.0.14\",\n+ \"webpack-dev-server\": \"^3.1.3\"\n},\n\"dependencies\": {\n\"@thi.ng/hdom\": \"latest\"\n",
"new_path": "examples/hdom-basics/package.json",
"old_path": "examples/hdom-basics/package.json"
},
{
"change_type": "MODIFY",
"diff": "\"start\": \"webpack-dev-server --open --mode development --devtool inline-source-map\"\n},\n\"devDependencies\": {\n- \"ts-loader\": \"^4.1.0\",\n+ \"ts-loader\": \"^4.2.0\",\n\"typescript\": \"^2.8.1\",\n- \"webpack\": \"^4.4.1\",\n- \"webpack-cli\": \"^2.0.13\",\n- \"webpack-dev-server\": \"^3.1.1\"\n+ \"webpack\": \"^4.6.0\",\n+ \"webpack-cli\": \"^2.0.14\",\n+ \"webpack-dev-server\": \"^3.1.3\"\n},\n\"dependencies\": {\n\"@thi.ng/api\": \"latest\",\n",
"new_path": "examples/hdom-benchmark/package.json",
"old_path": "examples/hdom-benchmark/package.json"
},
{
"change_type": "MODIFY",
"diff": "\"start\": \"webpack-dev-server --open --mode development --devtool inline-source-map\"\n},\n\"devDependencies\": {\n- \"ts-loader\": \"^4.1.0\",\n+ \"ts-loader\": \"^4.2.0\",\n\"typescript\": \"^2.8.1\",\n- \"webpack\": \"^4.4.1\",\n- \"webpack-cli\": \"^2.0.13\",\n- \"webpack-dev-server\": \"^3.1.1\"\n+ \"webpack\": \"^4.6.0\",\n+ \"webpack-cli\": \"^2.0.14\",\n+ \"webpack-dev-server\": \"^3.1.3\"\n},\n\"dependencies\": {\n\"@thi.ng/api\": \"latest\",\n",
"new_path": "examples/interceptor-basics/package.json",
"old_path": "examples/interceptor-basics/package.json"
},
{
"change_type": "MODIFY",
"diff": "\"start\": \"webpack-dev-server --open --mode development --devtool inline-source-map\"\n},\n\"devDependencies\": {\n- \"ts-loader\": \"^4.1.0\",\n+ \"ts-loader\": \"^4.2.0\",\n\"typescript\": \"^2.8.1\",\n- \"webpack\": \"^4.4.1\",\n- \"webpack-cli\": \"^2.0.13\",\n- \"webpack-dev-server\": \"^3.1.1\"\n+ \"webpack\": \"^4.6.0\",\n+ \"webpack-cli\": \"^2.0.14\",\n+ \"webpack-dev-server\": \"^3.1.3\"\n},\n\"dependencies\": {\n\"@thi.ng/hdom\": \"latest\",\n",
"new_path": "examples/json-components/package.json",
"old_path": "examples/json-components/package.json"
},
{
"change_type": "MODIFY",
"diff": "\"start\": \"webpack-dev-server --open --mode development --devtool inline-source-map\"\n},\n\"devDependencies\": {\n- \"ts-loader\": \"^4.1.0\",\n+ \"ts-loader\": \"^4.2.0\",\n\"typescript\": \"^2.8.1\",\n- \"webpack\": \"^4.4.1\",\n- \"webpack-cli\": \"^2.0.13\",\n- \"webpack-dev-server\": \"^3.1.1\"\n+ \"webpack\": \"^4.6.0\",\n+ \"webpack-cli\": \"^2.0.14\",\n+ \"webpack-dev-server\": \"^3.1.3\"\n},\n\"dependencies\": {\n\"@thi.ng/atom\": \"latest\",\n",
"new_path": "examples/login-form/package.json",
"old_path": "examples/login-form/package.json"
},
{
"change_type": "MODIFY",
"diff": "\"@thi.ng/router\": \"latest\"\n},\n\"devDependencies\": {\n- \"ts-loader\": \"^4.1.0\",\n+ \"ts-loader\": \"^4.2.0\",\n\"typescript\": \"^2.8.1\",\n- \"webpack\": \"^4.4.1\",\n- \"webpack-cli\": \"^2.0.13\",\n- \"webpack-dev-server\": \"^3.1.1\"\n+ \"webpack\": \"^4.6.0\",\n+ \"webpack-cli\": \"^2.0.14\",\n+ \"webpack-dev-server\": \"^3.1.3\"\n}\n}\n\\ No newline at end of file\n",
"new_path": "examples/router-basics/package.json",
"old_path": "examples/router-basics/package.json"
},
{
"change_type": "MODIFY",
"diff": "\"start\": \"webpack-dev-server --open --mode development --devtool inline-source-map\"\n},\n\"devDependencies\": {\n- \"ts-loader\": \"^4.1.0\",\n+ \"ts-loader\": \"^4.2.0\",\n\"typescript\": \"^2.8.1\",\n- \"webpack\": \"^4.4.1\",\n- \"webpack-cli\": \"^2.0.13\",\n- \"webpack-dev-server\": \"^3.1.1\"\n+ \"webpack\": \"^4.6.0\",\n+ \"webpack-cli\": \"^2.0.14\",\n+ \"webpack-dev-server\": \"^3.1.3\"\n},\n\"dependencies\": {\n\"@thi.ng/api\": \"latest\",\n",
"new_path": "examples/rstream-dataflow/package.json",
"old_path": "examples/rstream-dataflow/package.json"
},
{
"change_type": "MODIFY",
"diff": "\"start\": \"webpack-dev-server --open --mode development --devtool inline-source-map\"\n},\n\"devDependencies\": {\n- \"ts-loader\": \"^4.1.0\",\n+ \"ts-loader\": \"^4.2.0\",\n\"typescript\": \"^2.8.1\",\n- \"webpack\": \"^4.4.1\",\n- \"webpack-cli\": \"^2.0.13\",\n- \"webpack-dev-server\": \"^3.1.1\"\n+ \"webpack\": \"^4.6.0\",\n+ \"webpack-cli\": \"^2.0.14\",\n+ \"webpack-dev-server\": \"^3.1.3\"\n},\n\"dependencies\": {\n\"@thi.ng/hdom\": \"latest\",\n",
"new_path": "examples/svg-particles/package.json",
"old_path": "examples/svg-particles/package.json"
},
{
"change_type": "MODIFY",
"diff": "\"devDependencies\": {\n\"@types/node\": \"^9.6.2\",\n\"typescript\": \"^2.8.1\",\n- \"ts-loader\": \"^4.1.0\",\n+ \"ts-loader\": \"^4.2.0\",\n\"webpack\": \"^4.5.0\",\n\"webpack-cli\": \"^2.0.14\",\n- \"webpack-dev-server\": \"^3.1.1\"\n+ \"webpack-dev-server\": \"^3.1.3\"\n}\n}\n\\ No newline at end of file\n",
"new_path": "examples/svg-waveform/package.json",
"old_path": "examples/svg-waveform/package.json"
},
{
"change_type": "MODIFY",
"diff": "\"start\": \"webpack-dev-server --open --mode development --devtool inline-source-map\"\n},\n\"devDependencies\": {\n- \"ts-loader\": \"^4.1.0\",\n+ \"ts-loader\": \"^4.2.0\",\n\"typescript\": \"^2.8.1\",\n- \"webpack\": \"^4.4.1\",\n- \"webpack-cli\": \"^2.0.13\",\n- \"webpack-dev-server\": \"^3.1.1\"\n+ \"webpack\": \"^4.6.0\",\n+ \"webpack-cli\": \"^2.0.14\",\n+ \"webpack-dev-server\": \"^3.1.3\"\n},\n\"dependencies\": {\n\"@thi.ng/atom\": \"latest\",\n",
"new_path": "examples/todo-list/package.json",
"old_path": "examples/todo-list/package.json"
},
{
"change_type": "MODIFY",
"diff": "\"start\": \"webpack-dev-server --open --mode development --devtool inline-source-map\"\n},\n\"devDependencies\": {\n- \"ts-loader\": \"^4.1.0\",\n+ \"ts-loader\": \"^4.2.0\",\n\"typescript\": \"^2.8.1\",\n- \"webpack\": \"^4.4.1\",\n- \"webpack-cli\": \"^2.0.13\",\n- \"webpack-dev-server\": \"^3.1.1\"\n+ \"webpack\": \"^4.6.0\",\n+ \"webpack-cli\": \"^2.0.14\",\n+ \"webpack-dev-server\": \"^3.1.3\"\n},\n\"dependencies\": {\n\"@thi.ng/hdom\": \"latest\",\n",
"new_path": "examples/webgl/package.json",
"old_path": "examples/webgl/package.json"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
build(examples): update dev deps
| 1
|
build
|
examples
|
679,913
|
18.04.2018 01:08:21
| -3,600
|
0de3d200926013a051bba13cf13ba3038603e9ad
|
docs(examples): add undo info (svg-waveform)
|
[
{
"change_type": "MODIFY",
"diff": "@@ -13,6 +13,10 @@ export function sidebar(ctx: AppContext, ...specs: SliderOpts[]) {\n[buttonGroup,\n[[ev.UNDO], \"undo\"],\n[[ev.REDO], \"redo\"]],\n+ [\"div\",\n+ \"Undo / Redo can also be triggered via \",\n+ [\"code\", \"Ctrl+Z\"], \" / \", [\"code\", \"Ctrl+Y\"],\n+ \". The last 1000 edits are stored.\"],\n[\"div\", ctx.ui.footer,\n[link, \"https://github.com/thi-ng/umbrella/tree/master/examples/svg-waveform\", \"Source\"],\n[\"br\"],\n",
"new_path": "examples/svg-waveform/src/components/sidebar.ts",
"old_path": "examples/svg-waveform/src/components/sidebar.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -81,7 +81,7 @@ export const CONFIG: AppConfig = {\n// re-skinning of the whole app\nui: {\nbutton: { class: \"pointer bg-black hover-bg-blue bg-animate white pa2 mr1 w-100 ttu b tracked-tight\" },\n- buttongroup: { class: \"flex\" },\n+ buttongroup: { class: \"flex mb2\" },\nfooter: { class: \"absolute bottom-1\" },\nlink: { class: \"pointer link dim black b\" },\nroot: { class: \"vw-100 vh-100 flex\" },\n",
"new_path": "examples/svg-waveform/src/config.ts",
"old_path": "examples/svg-waveform/src/config.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
docs(examples): add undo info (svg-waveform)
| 1
|
docs
|
examples
|
679,913
|
18.04.2018 01:35:39
| -3,600
|
de474933bca211537b2d6b13a43345f4d914eddd
|
docs(rstream-log): fix typo
|
[
{
"change_type": "MODIFY",
"diff": "@@ -21,7 +21,7 @@ yarn add @thi.ng/rstream-log\n## Usage examples\n```typescript\n-import * as log from \"@thi.ng/rstream-logger\";\n+import * as log from \"@thi.ng/rstream-log\";\nconst logger = new log.Logger(\"main\");\n// or with min level\n",
"new_path": "packages/rstream-log/README.md",
"old_path": "packages/rstream-log/README.md"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
docs(rstream-log): fix typo
| 1
|
docs
|
rstream-log
|
679,913
|
18.04.2018 01:40:25
| -3,600
|
08af60afa4a1995877b8ef17c519dde583354def
|
refactor(rstream-log): minor update matchID()
|
[
{
"change_type": "MODIFY",
"diff": "@@ -17,7 +17,9 @@ export function maxLevel(level: Level): Transducer<LogEntry, LogEntry> {\n}\nexport function matchID(id: string | RegExp): Transducer<LogEntry, LogEntry> {\n- return isString(id) ?\n- filter((l) => l[1] === id) :\n- filter((l) => id.test(l[1]));\n+ return filter(\n+ isString(id) ?\n+ (l) => l[1] === id :\n+ (l) => id.test(l[1])\n+ );\n}\n",
"new_path": "packages/rstream-log/src/xform/filter.ts",
"old_path": "packages/rstream-log/src/xform/filter.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
refactor(rstream-log): minor update matchID()
| 1
|
refactor
|
rstream-log
|
679,913
|
18.04.2018 01:48:56
| -3,600
|
3087776e56e80ecc99b57727e9cfc4e2818c9251
|
fix(rstream-log): ID handling in Logger ctor
|
[
{
"change_type": "MODIFY",
"diff": "@@ -20,7 +20,9 @@ export class Logger extends StreamMerge<LogEntry, LogEntry> implements\nlet src;\nswitch (args.length) {\ncase 0:\n+ break;\ncase 1:\n+ id = args[0];\nbreak;\ncase 2:\n[id, level] = args;\n",
"new_path": "packages/rstream-log/src/logger.ts",
"old_path": "packages/rstream-log/src/logger.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
fix(rstream-log): ID handling in Logger ctor
| 1
|
fix
|
rstream-log
|
791,834
|
18.04.2018 09:45:22
| 25,200
|
84debe279f006c966bc42b1ff88fcee09646b7da
|
core(config): remove config.artifacts; always use auditMode
|
[
{
"change_type": "MODIFY",
"diff": "@@ -26,6 +26,8 @@ last-run-results.html\n!lighthouse-core/test/results/artifacts/*.trace.json\n!lighthouse-core/test/results/artifacts/*.devtoolslog.json\n+!lighthouse-core/test/fixtures/artifacts/**/*.trace.json\n+!lighthouse-core/test/fixtures/artifacts/**/*.devtoolslog.json\nlatest-run\n",
"new_path": ".gitignore",
"old_path": ".gitignore"
},
{
"change_type": "MODIFY",
"diff": "@@ -93,28 +93,22 @@ $ lighthouse --port=9222 --disable-device-emulation --disable-cpu-throttling htt\n## Lighthouse as trace processor\n-Lighthouse can be used to analyze trace and performance data collected from other tools (like WebPageTest and ChromeDriver). The `traces` and `devtoolsLogs` artifact items can be provided using a string for the absolute path on disk. The `devtoolsLogs` array is captured from the `Network` and `Page` domains (a la ChromeDriver's [enableNetwork and enablePage options]((https://sites.google.com/a/chromium.org/chromedriver/capabilities#TOC-perfLoggingPrefs-object)).\n+Lighthouse can be used to analyze trace and performance data collected from other tools (like WebPageTest and ChromeDriver). The `traces` and `devtoolsLogs` artifact items can be provided using a string for the absolute path on disk if they're saved with `.trace.json` and `.devtoolslog.json` file extensions, respectively. The `devtoolsLogs` array is captured from the `Network` and `Page` domains (a la ChromeDriver's [enableNetwork and enablePage options]((https://sites.google.com/a/chromium.org/chromedriver/capabilities#TOC-perfLoggingPrefs-object)).\n-As an example, here's a trace-only run that's reporting on user timings and critical request chains:\n+As an example, here's a trace-only run that reports on user timings and critical request chains:\n### `config.json`\n```json\n{\n+ \"settings\": {\n+ \"auditMode\": \"/User/me/lighthouse/lighthouse-core/test/fixtures/artifacts/perflog/\",\n+ },\n\"audits\": [\n\"user-timings\",\n\"critical-request-chains\"\n],\n- \"artifacts\": {\n- \"traces\": {\n- \"defaultPass\": \"/User/me/lighthouse/lighthouse-core/test/fixtures/traces/trace-user-timings.json\"\n- },\n- \"devtoolsLogs\": {\n- \"defaultPass\": \"/User/me/lighthouse/lighthouse-core/test/fixtures/traces/perflog.json\"\n- }\n- },\n-\n\"categories\": {\n\"performance\": {\n\"name\": \"Performance Metrics\",\n",
"new_path": "docs/readme.md",
"old_path": "docs/readme.md"
},
{
"change_type": "MODIFY",
"diff": "@@ -17,89 +17,6 @@ const path = require('path');\nconst Audit = require('../audits/audit');\nconst Runner = require('../runner');\n-// cleanTrace is run to remove duplicate TracingStartedInPage events,\n-// and to change TracingStartedInBrowser events into TracingStartedInPage.\n-// This is done by searching for most occuring threads and basing new events\n-// off of those.\n-function cleanTrace(trace) {\n- const traceEvents = trace.traceEvents;\n- // Keep track of most occuring threads\n- const threads = [];\n- const countsByThread = {};\n- const traceStartEvents = [];\n- const makeMockEvent = (evt, ts) => {\n- return {\n- pid: evt.pid,\n- tid: evt.tid,\n- ts: ts || 0, // default to 0 for now\n- ph: 'I',\n- cat: 'disabled-by-default-devtools.timeline',\n- name: 'TracingStartedInPage',\n- args: {\n- data: {\n- page: evt.frame,\n- },\n- },\n- s: 't',\n- };\n- };\n-\n- let frame;\n- let data;\n- let name;\n- let counter;\n-\n- traceEvents.forEach((evt, idx) => {\n- if (evt.name.startsWith('TracingStartedIn')) {\n- traceStartEvents.push(idx);\n- }\n-\n- // find the event's frame\n- data = evt.args && (evt.args.data || evt.args.beginData || evt.args.counters);\n- frame = (evt.args && evt.args.frame) || data && (data.frame || data.page);\n-\n- if (!frame) {\n- return;\n- }\n-\n- // Increase occurences count of the frame\n- name = `pid${evt.pid}-tid${evt.tid}-frame${frame}`;\n- counter = countsByThread[name];\n- if (!counter) {\n- counter = {\n- pid: evt.pid,\n- tid: evt.tid,\n- frame: frame,\n- count: 0,\n- };\n- countsByThread[name] = counter;\n- threads.push(counter);\n- }\n- counter.count++;\n- });\n-\n- // find most active thread (and frame)\n- threads.sort((a, b) => b.count - a.count);\n- const mostActiveFrame = threads[0];\n-\n- // Remove all current TracingStartedIn* events, storing\n- // the first events ts.\n- const ts = traceEvents[traceStartEvents[0]] && traceEvents[traceStartEvents[0]].ts;\n-\n- // account for offset after removing items\n- let i = 0;\n- for (const dup of traceStartEvents) {\n- traceEvents.splice(dup - i, 1);\n- i++;\n- }\n-\n- // Add a new TracingStartedInPage event based on most active thread\n- // and using TS of first found TracingStartedIn* event\n- traceEvents.unshift(makeMockEvent(mostActiveFrame, ts));\n-\n- return trace;\n-}\n-\nfunction validatePasses(passes, audits) {\nif (!Array.isArray(passes)) {\nreturn;\n@@ -214,38 +131,6 @@ function assertValidGatherer(gathererInstance, gathererName) {\n}\n}\n-function expandArtifacts(artifacts) {\n- if (!artifacts) {\n- return null;\n- }\n- // currently only trace logs and performance logs should be imported\n- if (artifacts.traces) {\n- Object.keys(artifacts.traces).forEach(key => {\n- log.log('info', 'Normalizng trace contents into expected state...');\n- let trace = require(artifacts.traces[key]);\n- // Before Chrome 54.0.2816 (codereview.chromium.org/2161583004), trace was\n- // an array of trace events. After this point, trace is an object with a\n- // traceEvents property. Normalize to new format.\n- if (Array.isArray(trace)) {\n- trace = {\n- traceEvents: trace,\n- };\n- }\n- trace = cleanTrace(trace);\n-\n- artifacts.traces[key] = trace;\n- });\n- }\n-\n- if (artifacts.devtoolsLogs) {\n- Object.keys(artifacts.devtoolsLogs).forEach(key => {\n- artifacts.devtoolsLogs[key] = require(artifacts.devtoolsLogs[key]);\n- });\n- }\n-\n- return artifacts;\n-}\n-\n/**\n* Creates a settings object from potential flags object by dropping all the properties\n* that don't exist on Config.Settings.\n@@ -367,7 +252,6 @@ class Config {\nthis._passes = Config.requireGatherers(configJSON.passes, this._configDir);\nthis._audits = Config.requireAudits(configJSON.audits, this._configDir);\n- this._artifacts = expandArtifacts(configJSON.artifacts);\nthis._categories = configJSON.categories;\nthis._groups = configJSON.groups;\nthis._settings = configJSON.settings || {};\n@@ -782,11 +666,6 @@ class Config {\nreturn this._audits;\n}\n- /** @type {Array<!Artifacts>} */\n- get artifacts() {\n- return this._artifacts;\n- }\n-\n/** @type {Object<{audits: !Array<{id: string, weight: number}>}>} */\nget categories() {\nreturn this._categories;\n",
"new_path": "lighthouse-core/config/config.js",
"old_path": "lighthouse-core/config/config.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -80,13 +80,16 @@ img {\nasync function loadArtifacts(basePath) {\nlog.log('Reading artifacts from disk:', basePath);\n- if (!fs.existsSync(basePath)) return Promise.reject(new Error('No saved artifacts found'));\n+ if (!fs.existsSync(basePath)) {\n+ throw new Error('No saved artifacts found at ' + basePath);\n+ }\n// load artifacts.json\n- const filenames = fs.readdirSync(basePath);\n/** @type {LH.Artifacts} */\nconst artifacts = JSON.parse(fs.readFileSync(path.join(basePath, artifactsFilename), 'utf8'));\n+ const filenames = fs.readdirSync(basePath);\n+\n// load devtoolsLogs\nartifacts.devtoolsLogs = {};\nfilenames.filter(f => f.endsWith(devtoolsLogSuffix)).map(filename => {\n",
"new_path": "lighthouse-core/lib/asset-saver.js",
"old_path": "lighthouse-core/lib/asset-saver.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -70,18 +70,16 @@ class Runner {\nopts.url = parsedURL.href;\n// User can run -G solo, -A solo, or -GA together\n- // -G and -A will do run partial lighthouse pipelines,\n+ // -G and -A will run partial lighthouse pipelines,\n// and -GA will run everything plus save artifacts to disk\n// Gather phase\n- // Either load saved artifacts off disk, from config, or get from the browser\n+ // Either load saved artifacts off disk or from the browser\nlet artifacts;\nif (settings.auditMode && !settings.gatherMode) {\n// No browser required, just load the artifacts from disk.\nconst path = Runner._getArtifactsPath(settings);\nartifacts = await assetSaver.loadArtifacts(path);\n- } else if (opts.config.artifacts) {\n- artifacts = opts.config.artifacts;\n} else {\nartifacts = await Runner._gatherArtifactsFromBrowser(opts, connection);\n// -G means save these to ./latest-run, etc.\n@@ -115,7 +113,8 @@ class Runner {\nconst resultsById = {};\nfor (const audit of auditResults) resultsById[audit.name] = audit;\n- let reportCategories;\n+ /** @type {Array<LH.Result.Category>} */\n+ let reportCategories = [];\nif (opts.config.categories) {\nreportCategories = ReportScoring.scoreAllCategories(opts.config.categories, resultsById);\n}\n",
"new_path": "lighthouse-core/runner.js",
"old_path": "lighthouse-core/runner.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -12,7 +12,6 @@ const defaultConfig = require('../../config/default-config.js');\nconst log = require('lighthouse-logger');\nconst Gatherer = require('../../gather/gatherers/gatherer');\nconst Audit = require('../../audits/audit');\n-const Runner = require('../../runner');\n/* eslint-env mocha */\n@@ -473,68 +472,6 @@ describe('Config', () => {\nassert.ok(config.settings.disableDeviceEmulation, 'missing setting from flags');\n});\n- describe('artifact loading', () => {\n- it('expands artifacts', () => {\n- const config = new Config({\n- artifacts: {\n- traces: {\n- defaultPass: path.resolve(__dirname, '../fixtures/traces/trace-user-timings.json'),\n- },\n- devtoolsLogs: {\n- defaultPass: path.resolve(__dirname, '../fixtures/perflog.json'),\n- },\n- },\n- });\n- const computed = Runner.instantiateComputedArtifacts();\n-\n- const traceUserTimings = require('../fixtures/traces/trace-user-timings.json');\n- assert.deepStrictEqual(config.artifacts.traces.defaultPass.traceEvents, traceUserTimings);\n- const devtoolsLogs = config.artifacts.devtoolsLogs.defaultPass;\n- assert.equal(devtoolsLogs.length, 555);\n-\n- return computed.requestNetworkRecords(devtoolsLogs).then(records => {\n- assert.equal(records.length, 76);\n- });\n- });\n-\n- it('expands artifacts with multiple named passes', () => {\n- const config = new Config({\n- artifacts: {\n- traces: {\n- defaultPass: path.resolve(__dirname, '../fixtures/traces/trace-user-timings.json'),\n- otherPass: path.resolve(__dirname, '../fixtures/traces/trace-user-timings.json'),\n- },\n- devtoolsLogs: {\n- defaultPass: path.resolve(__dirname, '../fixtures/perflog.json'),\n- otherPass: path.resolve(__dirname, '../fixtures/perflog.json'),\n- },\n- },\n- });\n- const traceUserTimings = require('../fixtures/traces/trace-user-timings.json');\n- assert.deepStrictEqual(config.artifacts.traces.defaultPass.traceEvents, traceUserTimings);\n- assert.deepStrictEqual(config.artifacts.traces.otherPass.traceEvents, traceUserTimings);\n- assert.equal(config.artifacts.devtoolsLogs.defaultPass.length, 555);\n- assert.equal(config.artifacts.devtoolsLogs.otherPass.length, 555);\n- });\n-\n- it('handles traces with no TracingStartedInPage events', () => {\n- const config = new Config({\n- artifacts: {\n- traces: {\n- defaultPass: path.resolve(__dirname,\n- '../fixtures/traces/trace-user-timings-no-tracingstartedinpage.json'),\n- },\n- devtoolsLogs: {\n- defaultPass: path.resolve(__dirname, '../fixtures/perflog.json'),\n- },\n- },\n- });\n-\n- assert.ok(config.artifacts.traces.defaultPass.traceEvents.find(\n- e => e.name === 'TracingStartedInPage' && e.args.data.page === '0xhad00p'));\n- });\n- });\n-\ndescribe('#extendConfigJSON', () => {\nit('should merge passes', () => {\nconst configA = {\n",
"new_path": "lighthouse-core/test/config/config-test.js",
"old_path": "lighthouse-core/test/config/config-test.js"
},
{
"change_type": "ADD",
"diff": "+{}\n",
"new_path": "lighthouse-core/test/fixtures/artifacts/empty-artifacts/artifacts.json",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+{\n+ \"LighthouseRunWarnings\": [\n+ \"I'm a warning!\",\n+ \"Also a warning\"\n+ ],\n+ \"UserAgent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3358.0 Safari/537.36\",\n+ \"fetchedAt\": \"2018-03-13T00:55:45.840Z\",\n+ \"URL\": {\n+ \"initialUrl\": \"https://www.reddit.com/r/nba\",\n+ \"finalUrl\": \"https://www.reddit.com/r/nba\"\n+ },\n+ \"Viewport\": null,\n+ \"ViewportDimensions\": {\n+ \"innerWidth\": 412,\n+ \"innerHeight\": 732,\n+ \"outerWidth\": 412,\n+ \"outerHeight\": 732,\n+ \"devicePixelRatio\": 2.625\n+ }\n+}\n",
"new_path": "lighthouse-core/test/fixtures/artifacts/perflog/artifacts.json",
"old_path": null
},
{
"change_type": "RENAME",
"diff": "",
"new_path": "lighthouse-core/test/fixtures/artifacts/perflog/defaultPass.devtoolslog.json",
"old_path": "lighthouse-core/test/fixtures/perflog.json"
},
{
"change_type": "ADD",
"diff": "+[\n+{\"pid\":41904,\"tid\":1295,\"ts\":1676836141,\"ph\":\"I\",\"cat\":\"disabled-by-default-devtools.timeline\",\"name\":\"TracingStartedInPage\",\"args\":{\"data\":{\"page\":\"0xf5fc2501e08\",\"sessionId\":\"9331.8\"}},\"tts\":314881,\"s\":\"t\"},\n+{\"pid\":41904,\"tid\":1295,\"ts\":506085991145,\"ph\":\"R\",\"cat\":\"blink.user_timing\",\"name\":\"navigationStart\",\"args\":{\"frame\": \"0xf5fc2501e08\"},\"tts\":314882},\n+{\"pid\":41904,\"tid\":1295,\"ts\":506085991146,\"ph\":\"R\",\"cat\":\"blink.user_timing\",\"name\":\"firstPaint\",\"args\":{\"frame\": \"0xf5fc2501e08\"},\"tts\":314883},\n+{\"pid\":41904,\"tid\":1295,\"ts\":506085991146,\"ph\":\"R\",\"cat\":\"blink.user_timing\",\"name\":\"firstContentfulPaint\",\"args\":{\"frame\": \"0xf5fc2501e08\"},\"tts\":314883},\n+{\"pid\":41904,\"tid\":1295,\"ts\":506085991146,\"ph\":\"R\",\"cat\":\"blink.user_timing\",\"name\":\"paintNonDefaultBackgroundColor\",\"args\":{},\"tts\":314883},\n+{\"pid\":41904,\"tid\":1295,\"ts\":506086992099,\"ph\":\"R\",\"cat\":\"blink.user_timing\",\"name\":\"mark_test\",\"args\":{},\"tts\":331149},\n+{\"pid\":41904,\"tid\":1295,\"ts\":506086992100,\"ph\":\"R\",\"cat\":\"blink.user_timing\",\"name\":\"goog_123_3_1_start\",\"args\":{},\"tts\":331150},\n+{\"pid\":41904,\"tid\":1295,\"ts\":506086992101,\"ph\":\"R\",\"cat\":\"blink.user_timing\",\"name\":\"goog_123_3_1_end\",\"args\":{},\"tts\":331151},\n+{\"pid\":41904,\"tid\":1295,\"ts\":506085991147,\"ph\":\"b\",\"cat\":\"blink.user_timing\",\"name\":\"measure_test\",\"args\":{},\"tts\":331184,\"id\":\"0x73b016\"},\n+{\"pid\":41904,\"tid\":1295,\"ts\":506086992112,\"ph\":\"e\",\"cat\":\"blink.user_timing\",\"name\":\"measure_test\",\"args\":{},\"tts\":331186,\"id\":\"0x73b016\"},\n+{\"pid\":41904,\"tid\":1295,\"ts\":506085991148,\"ph\":\"b\",\"cat\":\"blink.user_timing\",\"name\":\"goog_123_3_1\",\"args\":{},\"tts\":331184,\"id\":\"0x73b016\"},\n+{\"pid\":41904,\"tid\":1295,\"ts\":506086992113,\"ph\":\"e\",\"cat\":\"blink.user_timing\",\"name\":\"goog_123_3_1\",\"args\":{},\"tts\":331186,\"id\":\"0x73b016\"}\n+]\n",
"new_path": "lighthouse-core/test/fixtures/artifacts/perflog/defaultPass.trace.json",
"old_path": null
},
{
"change_type": "MODIFY",
"diff": "@@ -60,7 +60,7 @@ module.exports = {\n},\nbeginDevtoolsLog() {},\nendDevtoolsLog() {\n- return require('../fixtures/perflog.json');\n+ return require('../fixtures/artifacts/perflog/defaultPass.devtoolslog.json');\n},\nblockUrlPatterns() {\nreturn Promise.resolve();\n",
"new_path": "lighthouse-core/test/gather/fake-driver.js",
"old_path": "lighthouse-core/test/gather/fake-driver.js"
},
{
"change_type": "MODIFY",
"diff": "const NetworkRecorder = require('../../lib/network-recorder');\nconst assert = require('assert');\n-const devtoolsLogItems = require('../fixtures/perflog.json');\n+const devtoolsLogItems = require('../fixtures/artifacts/perflog/defaultPass.devtoolslog.json');\n/* eslint-env mocha */\ndescribe('network recorder', function() {\n",
"new_path": "lighthouse-core/test/gather/network-recorder-test.js",
"old_path": "lighthouse-core/test/gather/network-recorder-test.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -87,18 +87,17 @@ describe('Module Tests', function() {\n});\n});\n- it.skip('should return formatted audit results when given no categories', function() {\n+ it('should return formatted LHR when given no categories', function() {\nconst exampleUrl = 'https://example.com/';\nreturn lighthouse(exampleUrl, {\noutput: 'json',\n}, {\n- auditResults: [{\n- score: 0,\n- displayValue: '',\n- rawValue: true,\n- name: 'viewport',\n- description: 'HTML has a viewport <meta>',\n- }],\n+ settings: {\n+ auditMode: __dirname + '/fixtures/artifacts/perflog/',\n+ },\n+ audits: [\n+ 'viewport',\n+ ],\n}).then(results => {\nassert.ok(results.lighthouseVersion);\nassert.ok(results.fetchedAt);\n@@ -107,6 +106,8 @@ describe('Module Tests', function() {\nassert.ok(Array.isArray(results.reportCategories));\nassert.equal(results.reportCategories.length, 0);\nassert.ok(results.audits.viewport);\n+ assert.strictEqual(results.audits.viewport.score, 0);\n+ assert.ok(results.audits.viewport.debugString);\nassert.ok(results.timing);\nassert.equal(typeof results.timing.total, 'number');\n});\n",
"new_path": "lighthouse-core/test/index-test.js",
"old_path": "lighthouse-core/test/index-test.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -148,25 +148,6 @@ describe('Runner', () => {\n});\n});\n- it('accepts existing artifacts', () => {\n- const url = 'https://example.com';\n- const config = new Config({\n- audits: [\n- 'content-width',\n- ],\n-\n- artifacts: {\n- ViewportDimensions: {},\n- },\n- });\n-\n- return Runner.run({}, {url, config}).then(results => {\n- // Mostly checking that this did not throw, but check representative values.\n- assert.equal(results.initialUrl, url);\n- assert.strictEqual(results.audits['content-width'].rawValue, true);\n- });\n- });\n-\nit('accepts audit options', () => {\nconst url = 'https://example.com';\n@@ -188,11 +169,13 @@ describe('Runner', () => {\n}\nconst config = new Config({\n+ settings: {\n+ auditMode: __dirname + '/fixtures/artifacts/empty-artifacts/',\n+ },\naudits: [\n{implementation: EavesdropAudit, options: {x: 1}},\n{implementation: EavesdropAudit, options: {x: 2}},\n],\n- artifacts: {},\n});\nreturn Runner.run({}, {url, config}).then(results => {\n@@ -207,15 +190,12 @@ describe('Runner', () => {\nconst url = 'https://example.com';\nconst config = new Config({\n+ settings: {\n+ auditMode: __dirname + '/fixtures/artifacts/perflog/',\n+ },\naudits: [\n'user-timings',\n],\n-\n- artifacts: {\n- traces: {\n- [Audit.DEFAULT_PASS]: path.join(__dirname, '/fixtures/traces/trace-user-timings.json'),\n- },\n- },\n});\nreturn Runner.run({}, {url, config}).then(results => {\n@@ -255,13 +235,13 @@ describe('Runner', () => {\nit('outputs an error audit result when trace required but not provided', () => {\nconst url = 'https://example.com';\nconst config = new Config({\n+ settings: {\n+ auditMode: __dirname + '/fixtures/artifacts/empty-artifacts/',\n+ },\naudits: [\n// requires traces[Audit.DEFAULT_PASS]\n'user-timings',\n],\n- artifacts: {\n- traces: {},\n- },\n});\nreturn Runner.run({}, {url, config}).then(results => {\n@@ -275,12 +255,13 @@ describe('Runner', () => {\nit('outputs an error audit result when missing a required artifact', () => {\nconst url = 'https://example.com';\nconst config = new Config({\n+ settings: {\n+ auditMode: __dirname + '/fixtures/artifacts/empty-artifacts/',\n+ },\naudits: [\n// requires the ViewportDimensions artifact\n'content-width',\n],\n-\n- artifacts: {},\n});\nreturn Runner.run({}, {url, config}).then(results => {\n@@ -291,7 +272,9 @@ describe('Runner', () => {\n});\n});\n- it('outputs an error audit result when required artifact was a non-fatal Error', () => {\n+ // TODO: need to support save/load of artifact errors.\n+ // See https://github.com/GoogleChrome/lighthouse/issues/4984\n+ it.skip('outputs an error audit result when required artifact was a non-fatal Error', () => {\nconst errorMessage = 'blurst of times';\nconst artifactError = new Error(errorMessage);\n@@ -331,6 +314,9 @@ describe('Runner', () => {\nconst errorMessage = 'Audit yourself';\nconst url = 'https://example.com';\nconst config = new Config({\n+ settings: {\n+ auditMode: __dirname + '/fixtures/artifacts/empty-artifacts/',\n+ },\naudits: [\nclass ThrowyAudit extends Audit {\nstatic get meta() {\n@@ -341,8 +327,6 @@ describe('Runner', () => {\n}\n},\n],\n-\n- artifacts: {},\n});\nreturn Runner.run({}, {url, config}).then(results => {\n@@ -357,6 +341,9 @@ describe('Runner', () => {\nconst errorMessage = 'Uh oh';\nconst url = 'https://example.com';\nconst config = new Config({\n+ settings: {\n+ auditMode: __dirname + '/fixtures/artifacts/empty-artifacts/',\n+ },\naudits: [\nclass FatalThrowyAudit extends Audit {\nstatic get meta() {\n@@ -369,8 +356,6 @@ describe('Runner', () => {\n}\n},\n],\n-\n- artifacts: {},\n});\nreturn Runner.run({}, {url, config}).then(\n@@ -379,21 +364,15 @@ describe('Runner', () => {\n});\n});\n- it('accepts performance logs as an artifact', () => {\n+ it('accepts devtoolsLog in artifacts', () => {\nconst url = 'https://example.com';\nconst config = new Config({\n+ settings: {\n+ auditMode: __dirname + '/fixtures/artifacts/perflog/',\n+ },\naudits: [\n'critical-request-chains',\n],\n-\n- artifacts: {\n- URL: {\n- finalUrl: 'https://www.reddit.com/r/nba',\n- },\n- devtoolsLogs: {\n- defaultPass: path.join(__dirname, '/fixtures/perflog.json'),\n- },\n- },\n});\nreturn Runner.run({}, {url, config}).then(results => {\n@@ -509,17 +488,18 @@ describe('Runner', () => {\nit('results include artifacts when given artifacts and audits', () => {\nconst url = 'https://example.com';\n- const ViewportDimensions = {innerHeight: 10, innerWidth: 10};\nconst config = new Config({\n+ settings: {\n+ auditMode: __dirname + '/fixtures/artifacts/perflog/',\n+ },\naudits: [\n'content-width',\n],\n-\n- artifacts: {ViewportDimensions},\n});\nreturn Runner.run({}, {url, config}).then(results => {\n- assert.deepEqual(results.artifacts.ViewportDimensions, ViewportDimensions);\n+ assert.strictEqual(results.artifacts.ViewportDimensions.innerWidth, 412);\n+ assert.strictEqual(results.artifacts.ViewportDimensions.innerHeight, 732);\n});\n});\n@@ -549,19 +529,18 @@ describe('Runner', () => {\nit('includes any LighthouseRunWarnings from artifacts in output', () => {\nconst url = 'https://example.com';\n- const LighthouseRunWarnings = [\n- 'warning0',\n- 'warning1',\n- ];\nconst config = new Config({\n- artifacts: {\n- LighthouseRunWarnings,\n+ settings: {\n+ auditMode: __dirname + '/fixtures/artifacts/perflog/',\n},\naudits: [],\n});\nreturn Runner.run(null, {url, config, driverMock}).then(results => {\n- assert.deepStrictEqual(results.runWarnings, LighthouseRunWarnings);\n+ assert.deepStrictEqual(results.runWarnings, [\n+ 'I\\'m a warning!',\n+ 'Also a warning',\n+ ]);\n});\n});\n});\n",
"new_path": "lighthouse-core/test/runner-test.js",
"old_path": "lighthouse-core/test/runner-test.js"
},
{
"change_type": "MODIFY",
"diff": "import * as Gatherer from '../lighthouse-core/gather/gatherers/gatherer.js';\nimport * as Audit from '../lighthouse-core/audits/audit.js';\n-/** From type T, drop set of properties K */\n-type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>\n-\ndeclare global {\nmodule LH {\n/**\n@@ -21,8 +18,6 @@ declare global {\naudits?: Config.AuditDefn[];\ncategories?: Record<string, Config.Category>;\ngroups?: Record<string, Config.Group>;\n- // TODO(bckenny): should be Partial<> maybe? don't want to fail imported json\n- artifacts?: Artifacts;\n}\nmodule Config {\n@@ -34,7 +29,6 @@ declare global {\npasses?: PassJson[];\ncategories?: Record<string, CategoryJson>;\ngroups?: GroupJson[];\n- artifacts?: ArtifactsJson;\n}\nexport interface SettingsJson extends SharedFlagsSettings {\n@@ -76,17 +70,6 @@ declare global {\ndescription: string;\n}\n- /**\n- * A LH Artifacts object, but the traces and devtoolsLogs are replaced\n- * with file paths of json files to import as those artifacts.\n- * TODO(bckenny): this is to support legacy config.artifacts. Migrate to\n- * -A instead.\n- */\n- export interface ArtifactsJson extends Omit<Artifacts, 'traces'|'devtoolsLogs'> {\n- traces: Record<string, string>;\n- devtoolsLogs: Record<string, string>;\n- }\n-\n/**\n* Reference to an audit member of a category and how its score should be\n* weighted and how its results grouped with other members.\n",
"new_path": "typings/config.d.ts",
"old_path": "typings/config.d.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -21,7 +21,7 @@ declare global {\n/** An object containing the results of the audits, keyed by the audits' `id` identifier. */\naudits: Record<string, Audit.Result>;\n/** The top-level categories, their overall scores, and member audits. */\n- reportCategories?: Result.Category[];\n+ reportCategories: Result.Category[];\n/** Descriptions of the groups referenced by CategoryMembers. */\nreportGroups?: Record<string, Result.Group>;\n",
"new_path": "typings/lhr.d.ts",
"old_path": "typings/lhr.d.ts"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
core(config): remove config.artifacts; always use auditMode (#4986)
| 1
|
core
|
config
|
791,690
|
18.04.2018 09:51:39
| 25,200
|
4b1f2bbe1a90b380ef9acd438bcbb71eb97d7ce2
|
tests(smokehouse): split pwa2, perf batches
|
[
{
"change_type": "MODIFY",
"diff": "@@ -227,109 +227,4 @@ module.exports = [\n},\n},\n},\n-\n- {\n- initialUrl: 'https://pwa.rocks',\n- url: 'https://pwa.rocks/',\n- audits: {\n- 'is-on-https': {\n- score: 1,\n- },\n- 'redirects-http': {\n- score: 1,\n- },\n- 'service-worker': {\n- score: 1,\n- },\n- 'works-offline': {\n- score: 1,\n- },\n- 'viewport': {\n- score: 1,\n- },\n- 'without-javascript': {\n- score: 1,\n- },\n- 'load-fast-enough-for-pwa': {\n- // Ignore speed test; just verify that it ran .\n- },\n- 'webapp-install-banner': {\n- score: 1,\n- extendedInfo: {\n- value: {\n- manifestValues: {\n- allChecks: [\n- {id: 'hasStartUrl', passing: true},\n- {id: 'hasIconsAtLeast192px', passing: true},\n- {id: 'hasIconsAtLeast512px', passing: false},\n- {id: 'hasPWADisplayValue', passing: true},\n- {id: 'hasBackgroundColor', passing: true},\n- {id: 'hasThemeColor', passing: true},\n- {id: 'hasShortName', passing: true},\n- {id: 'shortNameLength', passing: true},\n- {id: 'hasName', passing: true},\n- ],\n- },\n- },\n- },\n- },\n- 'splash-screen': {\n- score: 0,\n- extendedInfo: {\n- value: {\n- manifestValues: {\n- allChecks: [\n- {id: 'hasStartUrl', passing: true},\n- {id: 'hasIconsAtLeast192px', passing: true},\n- {id: 'hasIconsAtLeast512px', passing: false},\n- {id: 'hasPWADisplayValue', passing: true},\n- {id: 'hasBackgroundColor', passing: true},\n- {id: 'hasThemeColor', passing: true},\n- {id: 'hasShortName', passing: true},\n- {id: 'shortNameLength', passing: true},\n- {id: 'hasName', passing: true},\n- ],\n- },\n- },\n- },\n- },\n- 'themed-omnibox': {\n- score: 0,\n- extendedInfo: {\n- value: {\n- manifestValues: {\n- allChecks: [\n- {id: 'hasStartUrl', passing: true},\n- {id: 'hasIconsAtLeast192px', passing: true},\n- {id: 'hasIconsAtLeast512px', passing: false},\n- {id: 'hasPWADisplayValue', passing: true},\n- {id: 'hasBackgroundColor', passing: true},\n- {id: 'hasThemeColor', passing: true},\n- {id: 'hasShortName', passing: true},\n- {id: 'shortNameLength', passing: true},\n- {id: 'hasName', passing: true},\n- ],\n- },\n- },\n- },\n- },\n- 'content-width': {\n- score: 1,\n- },\n-\n- // \"manual\" audits. Just verify in the results.\n- 'pwa-cross-browser': {\n- score: 0,\n- manual: true,\n- },\n- 'pwa-page-transitions': {\n- score: 0,\n- manual: true,\n- },\n- 'pwa-each-page-has-url': {\n- score: 0,\n- manual: true,\n- },\n- },\n- },\n];\n",
"new_path": "lighthouse-cli/test/smokehouse/pwa2-expectations.js",
"old_path": "lighthouse-cli/test/smokehouse/pwa2-expectations.js"
},
{
"change_type": "ADD",
"diff": "+/**\n+ * @license Copyright 2016 Google Inc. All Rights Reserved.\n+ * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n+ */\n+'use strict';\n+\n+/**\n+ * Expected Lighthouse audit values for various sites with stable(ish) PWA\n+ * results.\n+ */\n+module.exports = [\n+ {\n+ initialUrl: 'https://pwa.rocks',\n+ url: 'https://pwa.rocks/',\n+ audits: {\n+ 'is-on-https': {\n+ score: 1,\n+ },\n+ 'redirects-http': {\n+ score: 1,\n+ },\n+ 'service-worker': {\n+ score: 1,\n+ },\n+ 'works-offline': {\n+ score: 1,\n+ },\n+ 'viewport': {\n+ score: 1,\n+ },\n+ 'without-javascript': {\n+ score: 1,\n+ },\n+ 'load-fast-enough-for-pwa': {\n+ // Ignore speed test; just verify that it ran .\n+ },\n+ 'webapp-install-banner': {\n+ score: 1,\n+ extendedInfo: {\n+ value: {\n+ manifestValues: {\n+ allChecks: [\n+ {id: 'hasStartUrl', passing: true},\n+ {id: 'hasIconsAtLeast192px', passing: true},\n+ {id: 'hasIconsAtLeast512px', passing: false},\n+ {id: 'hasPWADisplayValue', passing: true},\n+ {id: 'hasBackgroundColor', passing: true},\n+ {id: 'hasThemeColor', passing: true},\n+ {id: 'hasShortName', passing: true},\n+ {id: 'shortNameLength', passing: true},\n+ {id: 'hasName', passing: true},\n+ ],\n+ },\n+ },\n+ },\n+ },\n+ 'splash-screen': {\n+ score: 0,\n+ extendedInfo: {\n+ value: {\n+ manifestValues: {\n+ allChecks: [\n+ {id: 'hasStartUrl', passing: true},\n+ {id: 'hasIconsAtLeast192px', passing: true},\n+ {id: 'hasIconsAtLeast512px', passing: false},\n+ {id: 'hasPWADisplayValue', passing: true},\n+ {id: 'hasBackgroundColor', passing: true},\n+ {id: 'hasThemeColor', passing: true},\n+ {id: 'hasShortName', passing: true},\n+ {id: 'shortNameLength', passing: true},\n+ {id: 'hasName', passing: true},\n+ ],\n+ },\n+ },\n+ },\n+ },\n+ 'themed-omnibox': {\n+ score: 0,\n+ extendedInfo: {\n+ value: {\n+ manifestValues: {\n+ allChecks: [\n+ {id: 'hasStartUrl', passing: true},\n+ {id: 'hasIconsAtLeast192px', passing: true},\n+ {id: 'hasIconsAtLeast512px', passing: false},\n+ {id: 'hasPWADisplayValue', passing: true},\n+ {id: 'hasBackgroundColor', passing: true},\n+ {id: 'hasThemeColor', passing: true},\n+ {id: 'hasShortName', passing: true},\n+ {id: 'shortNameLength', passing: true},\n+ {id: 'hasName', passing: true},\n+ ],\n+ },\n+ },\n+ },\n+ },\n+ 'content-width': {\n+ score: 1,\n+ },\n+\n+ // \"manual\" audits. Just verify in the results.\n+ 'pwa-cross-browser': {\n+ score: 0,\n+ manual: true,\n+ },\n+ 'pwa-page-transitions': {\n+ score: 0,\n+ manual: true,\n+ },\n+ 'pwa-each-page-has-url': {\n+ score: 0,\n+ manual: true,\n+ },\n+ },\n+ },\n+];\n",
"new_path": "lighthouse-cli/test/smokehouse/pwa3-expectations.js",
"old_path": null
},
{
"change_type": "MODIFY",
"diff": "@@ -36,6 +36,10 @@ const SMOKETESTS = [{\nid: 'pwa2',\nexpectations: smokehouseDir + 'pwa2-expectations.js',\nconfig: smokehouseDir + 'pwa-config.js',\n+}, {\n+ id: 'pwa3',\n+ expectations: smokehouseDir + 'pwa3-expectations.js',\n+ config: smokehouseDir + 'pwa-config.js',\n}, {\nid: 'dbw',\nexpectations: 'dobetterweb/dbw-expectations.js',\n@@ -56,12 +60,12 @@ const SMOKETESTS = [{\nid: 'byte',\nexpectations: 'byte-efficiency/expectations.js',\nconfig: smokehouseDir + 'byte-config.js',\n- batch: 'perf',\n+ batch: 'perf-opportunity',\n}, {\nid: 'perf',\nexpectations: 'perf/expectations.js',\nconfig: 'lighthouse-core/config/perf-config.js',\n- batch: 'perf',\n+ batch: 'perf-metric',\n}, {\nid: 'ttci',\nexpectations: 'tricky-ttci/expectations.js',\n",
"new_path": "lighthouse-cli/test/smokehouse/run-smoke.js",
"old_path": "lighthouse-cli/test/smokehouse/run-smoke.js"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
tests(smokehouse): split pwa2, perf batches (#4988)
| 1
|
tests
|
smokehouse
|
815,745
|
18.04.2018 13:27:10
| -10,800
|
1f85adcfa9e9ced594449701cff1da4be4a53d88
|
fix: use blur event to close dropdown
|
[
{
"change_type": "MODIFY",
"diff": "@@ -108,7 +108,7 @@ map: {\n| ------------- | ------------- | ------------- | ------------- | ------------- |\n| [addTag] | `boolean \\| ((term: string) => any \\| Promise<any>)` | `false` | no | Allows to create custom options. |\n| addTagText | `string` | `Add item` | no | Set custom text when using tagging |\n-| appendTo | `string` | null | no | Append drodown to body or any other element using css selector |\n+| appendTo | `string` | null | no | Append dropdown to body or any other element using css selector |\n| bindValue | `string` | `-` | no | Object property to use for selected model. By default binds to whole object. |\n| bindLabel | `string` | `label` | no | Object property to use for label. Default `label` |\n| closeOnSelect | `boolean` | true | no | Whether to close the menu when a value is selected |\n@@ -128,9 +128,9 @@ map: {\n| notFoundText | `string` | `No items found` | no | Set custom text when filter returns empty result |\n| placeholder | `string` | `-` | no | Placeholder text. |\n| [searchable] | `boolean` | `true` | no | Allow to search for value. Default `true`|\n-| [searchFn] | `(term: string, item: any) => boolean` | `null` | no | Allow to search by custom search function expression |\n+| [searchFn] | `(term: string, item: any) => boolean` | `null` | no | Allow to filter by custom search function |\n| [selectOnTab] | `boolean` | `false` | no | Select marked dropdown item using tab. Default `false`|\n-| [typeahead] | `Subject` | `-` | no | Custom autocomplete or filter. |\n+| [typeahead] | `Subject` | `-` | no | Custom autocomplete or advanced filter. |\n| typeToSearchText | `string` | `Type to search` | no | Set custom text when using Typeahead |\n| [virtualScroll] | `boolean` | false | no | Enable virtual scroll for better performance when rendering a lot of data |\n",
"new_path": "README.md",
"old_path": "README.md"
},
{
"change_type": "MODIFY",
"diff": "@@ -30,15 +30,12 @@ import { delay } from 'rxjs/operators';\n<div class=\"form-group col-md-6\">\n<label for=\"heroId\">Basic select</label>\n<ng-select [searchable]=\"false\" formControlName=\"heroId\">\n- <ng-option value=\"hero1\">\n- <img src=\"{{basePath}}/assets/batman.png\" width=\"20px\" height=\"20px\" /> Batman\n- </ng-option>\n- <ng-option value=\"hero2\">\n- <img src=\"{{basePath}}/assets/spidey.png\" width=\"20px\" height=\"20px\" /> Spider-Man\n- </ng-option>\n- <ng-option value=\"hero3\">\n- <img src=\"{{basePath}}/assets/thor.png\" width=\"20px\" height=\"20px\" /> Thor\n- </ng-option>\n+ <ng-template ng-label-tmp let-item=\"item\" let-label=\"label\">\n+ <img src=\"{{basePath}}/assets/{{item}}.png\" width=\"20px\" height=\"20px\" /> {{label}}\n+ </ng-template>\n+ <ng-option value=\"batman\">Batman</ng-option>\n+ <ng-option value=\"spidey\">Spider-Man</ng-option>\n+ <ng-option value=\"thor\">Thor</ng-option>\n</ng-select>\n</div>\n</div>\n@@ -199,7 +196,7 @@ export class ReactiveFormsComponent {\nthis.loadPhotos();\nthis.heroForm = this.fb.group({\n- heroId: 'hero1',\n+ heroId: 'batman',\nagree: null,\nselectedCitiesIds: [],\nage: [null, Validators.required],\n",
"new_path": "demo/app/examples/reactive-forms.component.ts",
"old_path": "demo/app/examples/reactive-forms.component.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -76,7 +76,6 @@ export class NgDropdownPanelComponent implements OnInit, OnChanges, OnDestroy, A\nprivate _currentPosition: 'bottom' | 'top';\nprivate _disposeScrollListener = () => { };\nprivate _disposeDocumentResizeListener = () => { };\n- private _disposeDocumentClickListener = () => { };\nconstructor(\n@Inject(forwardRef(() => NgSelectComponent)) _ngSelect: NgSelectComponent,\n@@ -92,7 +91,6 @@ export class NgDropdownPanelComponent implements OnInit, OnChanges, OnDestroy, A\nngOnInit() {\nthis._handleScroll();\n- this._handleDocumentClick();\n}\nngOnChanges(changes: SimpleChanges) {\n@@ -104,7 +102,6 @@ export class NgDropdownPanelComponent implements OnInit, OnChanges, OnDestroy, A\nngOnDestroy() {\nthis._disposeDocumentResizeListener();\nthis._disposeScrollListener();\n- this._disposeDocumentClickListener();\nif (this.appendTo) {\nthis._renderer.removeChild(this._elementRef.nativeElement.parentNode, this._elementRef.nativeElement);\n}\n@@ -160,21 +157,6 @@ export class NgDropdownPanelComponent implements OnInit, OnChanges, OnDestroy, A\n});\n}\n- private _handleDocumentClick() {\n- this._disposeDocumentClickListener = this._renderer.listen('document', 'mousedown', ($event: any) => {\n- if (this._selectElement.contains($event.target)) {\n- return;\n- }\n-\n- const dropdown: HTMLElement = this._elementRef.nativeElement;\n- if (dropdown.contains($event.target)) {\n- return;\n- }\n-\n- this.outsideClick.emit();\n- });\n- }\n-\nprivate _handleItemsChange(items: { previousValue: NgOption[], currentValue: NgOption[] }) {\nthis._scrollToEndFired = false;\nthis._previousStart = undefined;\n",
"new_path": "src/ng-select/ng-dropdown-panel.component.ts",
"old_path": "src/ng-select/ng-dropdown-panel.component.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -1124,7 +1124,7 @@ describe('NgSelectComponent', function () {\ndescribe('Outside click', () => {\nlet fixture: ComponentFixture<NgSelectTestCmp>;\n-\n+ let select: NgSelectComponent;\nbeforeEach(() => {\nfixture = createTestingModule(\nNgSelectTestCmp,\n@@ -1136,26 +1136,25 @@ describe('NgSelectComponent', function () {\nappendTo=\"body\"\n[(ngModel)]=\"selectedCity\">\n</ng-select>`);\n+ select = fixture.componentInstance.select;\n});\n- it('close dropdown if opened and clicked outside dropdown container', fakeAsync(() => {\n+ it('should close dropdown on input blur', fakeAsync(() => {\ntriggerKeyDownEvent(getNgSelectElement(fixture), KeyCode.Space);\n- expect(fixture.componentInstance.select.isOpen).toBeTruthy();\n- document.getElementById('outside').click();\n- let event = new MouseEvent('mousedown', {bubbles: true});\n- document.getElementById('outside').dispatchEvent(event);\n+ expect(select.isOpen).toBeTruthy();\n+ select.onInputBlur();\ntickAndDetectChanges(fixture);\n- expect(fixture.componentInstance.select.isOpen).toBeFalsy();\n+ expect(select.isOpen).toBeFalsy();\n}));\n- it('prevent dropdown close if clicked on select', fakeAsync(() => {\n+ it('should prevent dropdown close if clicked on select', fakeAsync(() => {\ntriggerKeyDownEvent(getNgSelectElement(fixture), KeyCode.Space);\n- expect(fixture.componentInstance.select.isOpen).toBeTruthy();\n+ expect(select.isOpen).toBeTruthy();\ndocument.getElementById('select').click();\nlet event = new MouseEvent('mousedown', { bubbles: true });\ndocument.getElementById('select').dispatchEvent(event);\ntickAndDetectChanges(fixture);\n- expect(fixture.componentInstance.select.isOpen).toBeTruthy();\n+ expect(select.isOpen).toBeTruthy();\n}));\n});\n@@ -1801,12 +1800,12 @@ describe('NgSelectComponent', function () {\nconst selectInput = fixture.debugElement.query(By.css('.ng-select-container'));\n// open\n- selectInput.triggerEventHandler('mousedown', { target: {} });\n+ selectInput.triggerEventHandler('mousedown', createEvent({ target: {} }));\ntickAndDetectChanges(fixture);\nexpect(fixture.componentInstance.select.isOpen).toBe(true);\n// close\n- selectInput.triggerEventHandler('mousedown', { target: {} });\n+ selectInput.triggerEventHandler('mousedown', createEvent({ target: {} }));\ntickAndDetectChanges(fixture);\nexpect(fixture.componentInstance.select.isOpen).toBe(false);\n}));\n@@ -2240,7 +2239,7 @@ describe('NgSelectComponent', function () {\ntickAndDetectChanges(fixture);\ntriggerClearClick = () => {\nconst control = fixture.debugElement.query(By.css('.ng-select-container'))\n- control.triggerEventHandler('mousedown', { target: { className: 'ng-clear'} });\n+ control.triggerEventHandler('mousedown', createEvent({ target: { className: 'ng-clear' } }));\n};\n}));\n@@ -2292,7 +2291,7 @@ describe('NgSelectComponent', function () {\ntickAndDetectChanges(fixture);\ntriggerArrowIconClick = () => {\nconst control = fixture.debugElement.query(By.css('.ng-select-container'))\n- control.triggerEventHandler('mousedown', { target: { className: 'ng-arrow'} });\n+ control.triggerEventHandler('mousedown', createEvent({ target: { className: 'ng-arrow' } }));\n};\n}));\n@@ -2490,6 +2489,14 @@ function createTestingModule<T>(cmp: Type<T>, template: string): ComponentFixtur\nreturn fixture;\n}\n+function createEvent(event) {\n+ return {\n+ stopPropagation: () => { },\n+ preventDefault: () => { },\n+ ...event\n+ }\n+}\n+\n@Component({\ntemplate: ``\n})\n",
"new_path": "src/ng-select/ng-select.component.spec.ts",
"old_path": "src/ng-select/ng-select.component.spec.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -232,12 +232,16 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\n}\n}\n- handleMousedown($event) {\n- if ($event.target.className === 'ng-clear') {\n+ handleMousedown($event: MouseEvent) {\n+ $event.stopPropagation();\n+ $event.preventDefault();\n+\n+ const target = $event.target as HTMLElement;\n+ if (target.className === 'ng-clear') {\nthis.handleClearClick();\nreturn;\n}\n- if ($event.target.className === 'ng-arrow') {\n+ if (target.className === 'ng-arrow') {\nthis.handleArrowClick();\nreturn;\n}\n@@ -433,7 +437,8 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\nonInputBlur() {\n(<HTMLElement>this.elementRef.nativeElement).classList.remove('ng-select-focused');\nthis.blurEvent.emit(null);\n- if (!this.isOpen && !this.isDisabled) {\n+ this.close();\n+ if (!this.isDisabled) {\nthis._onTouched();\n}\n}\n",
"new_path": "src/ng-select/ng-select.component.ts",
"old_path": "src/ng-select/ng-select.component.ts"
}
] |
TypeScript
|
MIT License
|
ng-select/ng-select
|
fix: use blur event to close dropdown
| 1
|
fix
| null |
815,745
|
18.04.2018 13:54:56
| -10,800
|
0d1d13cd3b88bb9a1a61435823627af5691492b1
|
fix: increase css specifity
fixes
|
[
{
"change_type": "MODIFY",
"diff": "@@ -39,7 +39,7 @@ $highlight-color: #3f51b5;\n}\n}\n.ng-has-value,\n- &.ng-select-filtered {\n+ &.ng-select-filtered .ng-select-container {\n.ng-placeholder {\ndisplay: initial;\n}\n",
"new_path": "src/themes/material.theme.scss",
"old_path": "src/themes/material.theme.scss"
}
] |
TypeScript
|
MIT License
|
ng-select/ng-select
|
fix: increase css specifity
fixes #468
| 1
|
fix
| null |
815,745
|
18.04.2018 13:55:35
| -10,800
|
61d61a25cdee673d05625be8928763e657bfd6f0
|
fix: use special value mapping for ng-options
fixes:
|
[
{
"change_type": "MODIFY",
"diff": "@@ -215,7 +215,7 @@ export class ItemsList {\nlabel = this.resolveNested(item, this._ngSelect.bindLabel);\nlabel = isDefined(label) ? label.toString() : '';\n}\n- const value = isDefined(item.value) ? item.value : item;\n+ const value = isDefined(item.$ngOptionValue) ? item.$ngOptionValue : item;\nreturn {\nindex: index,\nlabel: label,\n",
"new_path": "src/ng-select/items-list.ts",
"old_path": "src/ng-select/items-list.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -473,7 +473,7 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\nprivate _setItemsFromNgOptions() {\nconst handleNgOptions = (options: QueryList<NgOptionComponent>) => {\nthis.items = options.map(option => ({\n- value: option.value,\n+ $ngOptionValue: option.value,\nlabel: option.elementRef.nativeElement.innerHTML,\ndisabled: option.disabled\n}));\n",
"new_path": "src/ng-select/ng-select.component.ts",
"old_path": "src/ng-select/ng-select.component.ts"
}
] |
TypeScript
|
MIT License
|
ng-select/ng-select
|
fix: use special value mapping for ng-options
fixes: #469
| 1
|
fix
| null |
791,690
|
18.04.2018 14:00:13
| 25,200
|
9771117d08f0d4d64c9bc8f087c218df39c42f16
|
core(load-fast-4-pwa): use computed artifacts
|
[
{
"change_type": "MODIFY",
"diff": "* Afterwards, we report if the TTFI is less than 10 seconds.\n*/\n+const isDeepEqual = require('lodash.isequal');\nconst Audit = require('./audit');\n-const URL = require('../lib/url-shim');\n-const targetLatencyMs = require('../config/constants').throttling.mobile3G.rttMs;\n-const Sentry = require('../lib/sentry');\n+const mobile3GThrottling = require('../config/constants').throttling.mobile3G;\nconst Util = require('../report/v2/renderer/util.js');\n-// Maximum TTFI to be considered \"fast\" for PWA baseline checklist\n+// Maximum TTI to be considered \"fast\" for PWA baseline checklist\n// https://developers.google.com/web/progressive-web-apps/checklist\n-const MAXIMUM_TTFI = 10 * 1000;\n-\n-const WHITELISTED_STATUS_CODES = [307];\n+const MAXIMUM_TTI = 10 * 1000;\nclass LoadFastEnough4Pwa extends Audit {\n/**\n@@ -32,116 +29,47 @@ class LoadFastEnough4Pwa extends Audit {\nname: 'load-fast-enough-for-pwa',\ndescription: 'Page load is fast enough on 3G',\nfailureDescription: 'Page load is not fast enough on 3G',\n- helpText: 'A fast page load over a 3G network ensures a good mobile user experience. ' +\n+ helpText:\n+ 'A fast page load over a 3G network ensures a good mobile user experience. ' +\n'[Learn more](https://developers.google.com/web/tools/lighthouse/audits/fast-3g).',\nrequiredArtifacts: ['traces', 'devtoolsLogs'],\n};\n}\n/**\n- * @param {!Artifacts} artifacts\n- * @return {!AuditResult}\n+ * @param {LH.Artifacts} artifacts\n+ * @param {LH.Audit.Context} context\n+ * @return {LH.AuditResult}\n*/\n- static audit(artifacts) {\n- const devtoolsLogs = artifacts.devtoolsLogs[Audit.DEFAULT_PASS];\n- return artifacts.requestNetworkRecords(devtoolsLogs).then(networkRecords => {\n- const firstRequestLatenciesByOrigin = new Map();\n- networkRecords.forEach(record => {\n- // Ignore requests that don't have valid origin, timing data, came from the cache, were\n- // redirected by Chrome without going to the network, or are not finished.\n- const fromCache = record._fromDiskCache || record._fromMemoryCache;\n- const origin = URL.getOrigin(record._url);\n- if (!origin || !record._timing || fromCache ||\n- WHITELISTED_STATUS_CODES.includes(record.statusCode) || !record.finished) {\n- return;\n- }\n-\n- // Disregard requests with an invalid start time, (H2 request start times are sometimes less\n- // than issue time and even negative which throws off timing)\n- if (record._startTime < record._issueTime) {\n- return;\n- }\n-\n- // Use DevTools' definition of Waiting latency: https://github.com/ChromeDevTools/devtools-frontend/blob/66595b8a73a9c873ea7714205b828866630e9e82/front_end/network/RequestTimingView.js#L164\n- const latency = record._timing.receiveHeadersEnd - record._timing.sendEnd;\n- const latencyInfo = {\n- url: record._url,\n- startTime: record._startTime,\n- origin,\n- latency,\n- };\n-\n- // Only examine the first request per origin to reduce noisiness from cases like H2 push\n- // where individual request latency may not apply.\n- const existing = firstRequestLatenciesByOrigin.get(origin);\n- if (!existing || latencyInfo.startTime < existing.startTime) {\n- firstRequestLatenciesByOrigin.set(origin, latencyInfo);\n- }\n- });\n-\n- let firstRequestLatencies = Array.from(firstRequestLatenciesByOrigin.values());\n- const latency3gMin = targetLatencyMs - 10;\n- const areLatenciesAll3G = firstRequestLatencies.every(val => val.latency > latency3gMin);\n- firstRequestLatencies = firstRequestLatencies.map(item => ({\n- url: item.url,\n- latency: Util.formatNumber(item.latency, 0.01),\n- }));\n-\n+ static async audit(artifacts, context) {\nconst trace = artifacts.traces[Audit.DEFAULT_PASS];\n- return artifacts.requestFirstInteractive(trace).then(firstInteractive => {\n- const timeToFirstInteractive = firstInteractive.timeInMs;\n- const isFast = timeToFirstInteractive < MAXIMUM_TTFI;\n+ const devtoolsLog = artifacts.devtoolsLogs[Audit.DEFAULT_PASS];\n- const extendedInfo = {\n- value: {areLatenciesAll3G, firstRequestLatencies, isFast, timeToFirstInteractive},\n- };\n-\n- const details = Audit.makeTableDetails([\n- {key: 'url', itemType: 'url', text: 'URL'},\n- {key: 'latency', itemType: 'text', text: 'Latency (ms)'},\n- ], firstRequestLatencies);\n-\n- if (!isFast) {\n- return {\n- rawValue: false,\n- // eslint-disable-next-line max-len\n- debugString: `First Interactive was at ${Util.formatMilliseconds(timeToFirstInteractive)}. More details in the \"Performance\" section.`,\n- extendedInfo,\n- };\n- }\n+ // If throttling was default devtools or lantern 3G throttling, then reuse the given settings\n+ // Otherwise, we'll force the usage of lantern 3G.\n+ const settingOverrides = {throttlingMethod: 'simulate', throttling: mobile3GThrottling};\n+ const settings =\n+ context.settings.throttlingMethod !== 'provided' &&\n+ isDeepEqual(context.settings.throttling, mobile3GThrottling)\n+ ? context.settings\n+ : Object.assign({}, context.settings, settingOverrides);\n- if (!areLatenciesAll3G) {\n- const sentryContext = Sentry.getContext();\n- const hadThrottlingEnabled = sentryContext && sentryContext.extra &&\n- sentryContext.extra.networkThrottling;\n+ const metricComputationData = {trace, devtoolsLog, settings};\n+ const tti = await artifacts.requestConsistentlyInteractive(metricComputationData);\n- if (hadThrottlingEnabled) {\n- // Track these instances in Sentry since there should be no requests that are fast when\n- // throttling is enabled, and it's likely a throttling bug we should look into.\n- const violatingLatency = firstRequestLatencies\n- .find(item => Number(item.latency) < latency3gMin);\n- Sentry.captureMessage('Network request latencies were not realistic', {\n- tags: {audit: this.meta.name},\n- extra: {violatingLatency},\n- level: 'warning',\n- });\n- }\n+ const score = Number(tti.timing < MAXIMUM_TTI);\n- return {\n- rawValue: true,\n+ let debugString;\n+ if (!score) {\n// eslint-disable-next-line max-len\n- debugString: `First Interactive was found at ${Util.formatMilliseconds(timeToFirstInteractive)}; however, the network request latencies were not sufficiently realistic, so the performance measurements cannot be trusted.`,\n- extendedInfo,\n- details,\n- };\n+ debugString = `First Interactive was ${Util.formatMilliseconds(tti.timing)}. More details in the \"Performance\" section.`;\n}\nreturn {\n- rawValue: true,\n- extendedInfo,\n+ score,\n+ debugString,\n+ rawValue: tti.timing,\n};\n- });\n- });\n}\n}\n",
"new_path": "lighthouse-core/audits/load-fast-enough-for-pwa.js",
"old_path": "lighthouse-core/audits/load-fast-enough-for-pwa.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -48,6 +48,10 @@ class ComputedMetric extends ComputedArtifact {\n*/\nasync compute_(data, artifacts) {\nconst {trace, devtoolsLog, settings} = data;\n+ if (!trace || !devtoolsLog || !settings) {\n+ throw new Error('Did not provide necessary metric computation data');\n+ }\n+\nconst augmentedData = Object.assign({\nnetworkRecords: await artifacts.requestNetworkRecords(devtoolsLog),\ntraceOfTab: await artifacts.requestTraceOfTab(trace),\n",
"new_path": "lighthouse-core/gather/computed/metrics/metric.js",
"old_path": "lighthouse-core/gather/computed/metrics/metric.js"
},
{
"change_type": "MODIFY",
"diff": "'use strict';\nconst FastPWAAudit = require('../../audits/load-fast-enough-for-pwa');\n+const Runner = require('../../runner.js');\nconst Audit = require('../../audits/audit.js');\n+const mobile3GThrottling = require('../../config/constants').throttling.mobile3G;\nconst assert = require('assert');\n-function generateArtifacts(firstInteractiveValue, networkRecords = []) {\n+const trace = require('../fixtures/traces/progressive-app-m60.json');\n+const devtoolsLog = require('../fixtures/traces/progressive-app-m60.devtools.log.json');\n+\n+function generateArtifacts(ttiValue) {\nreturn {\ndevtoolsLogs: {\n[Audit.DEFAULT_PASS]: [],\n},\n- requestNetworkRecords: () => {\n- return Promise.resolve(networkRecords);\n- },\ntraces: {\n[Audit.DEFAULT_PASS]: {traceEvents: []},\n},\n- requestFirstInteractive: () => Promise.resolve({\n- timeInMs: firstInteractiveValue,\n+ requestConsistentlyInteractive: () => Promise.resolve({\n+ timing: ttiValue,\n}),\n};\n}\n@@ -29,65 +31,41 @@ function generateArtifacts(firstInteractiveValue, networkRecords = []) {\n/* eslint-env mocha */\ndescribe('PWA: load-fast-enough-for-pwa audit', () => {\nit('returns boolean based on TTI value', () => {\n- return FastPWAAudit.audit(generateArtifacts(5000)).then(result => {\n- assert.equal(result.rawValue, true, 'fixture trace is not passing audit');\n+ const settings = {throttlingMethod: 'devtools', throttling: mobile3GThrottling};\n+ return FastPWAAudit.audit(generateArtifacts(5000), {settings}).then(result => {\n+ assert.equal(result.score, true, 'fixture trace is not passing audit');\n+ assert.equal(result.rawValue, 5000);\n});\n});\nit('fails a bad TTI value', () => {\n- return FastPWAAudit.audit(generateArtifacts(15000)).then(result => {\n- assert.equal(result.rawValue, false, 'not failing a long TTI value');\n+ const settings = {throttlingMethod: 'devtools', throttling: mobile3GThrottling};\n+ return FastPWAAudit.audit(generateArtifacts(15000), {settings}).then(result => {\n+ assert.equal(result.score, false, 'not failing a long TTI value');\n+ assert.equal(result.rawValue, 15000);\nassert.ok(result.debugString);\n});\n});\n- it('warns on a good TTI value with no throttling', () => {\n- // latencies are very short\n- const mockNetworkRecords = [\n- {_timing: {sendEnd: 0, receiveHeadersEnd: 50}, finished: true, _url: 'https://google.com/'},\n- {_timing: {sendEnd: 0, receiveHeadersEnd: 75}, finished: true, _url: 'https://google.com/a'},\n- { },\n- {_timing: {sendEnd: 0, receiveHeadersEnd: 50}, finished: true, _url: 'https://google.com/b'},\n- ];\n- return FastPWAAudit.audit(generateArtifacts(5000, mockNetworkRecords)).then(result => {\n- assert.equal(result.rawValue, true);\n- assert.ok(result.debugString.includes('network request latencies'));\n- assert.ok(result.details, 'contains details when latencies were not realistic');\n- });\n- });\n+ it('respects the observed result when throttling is preset', async () => {\n+ const artifacts = Object.assign({\n+ traces: {defaultPass: trace},\n+ devtoolsLogs: {defaultPass: devtoolsLog},\n+ }, Runner.instantiateComputedArtifacts());\n- it('ignores resources coming from cache', () => {\n- const mockNetworkRecords = [\n- {_timing: {sendEnd: 0, receiveHeadersEnd: 50}, _fromDiskCache: true},\n- ];\n- return FastPWAAudit.audit(generateArtifacts(5000, mockNetworkRecords)).then(result => {\n- assert.equal(result.rawValue, true);\n- assert.strictEqual(result.debugString, undefined);\n- });\n+ const settings = {throttlingMethod: 'devtools', throttling: mobile3GThrottling};\n+ const result = await FastPWAAudit.audit(artifacts, {settings});\n+ assert.equal(Math.round(result.rawValue), 1582);\n});\n- it('passes a good TTI value and WITH throttling', () => {\n- // latencies are very long\n- const urlA = 'https://google.com';\n- const urlB = 'https://example.com';\n- const urlC = 'https://example-c.com';\n- const mockNetworkRecords = [\n- {_timing: {sendEnd: 0, receiveHeadersEnd: 250}, finished: true, _url: urlA, _startTime: 0},\n- {_timing: {sendEnd: 0, receiveHeadersEnd: 250}, finished: true, _url: urlB},\n- // ignored for not having timing\n- { },\n- // ignored for not being the first of the origin\n- {_timing: {sendEnd: 0, receiveHeadersEnd: 100}, finished: true, _url: urlA, _startTime: 100},\n- // ignored for being redirected internally\n- {_timing: {sendEnd: 0, receiveHeadersEnd: 100}, finished: true, _url: urlC, _startTime: 0,\n- statusCode: 307},\n- // ignored for not finishing\n- {_timing: {sendEnd: 0, receiveHeadersEnd: -1}, finished: false},\n- ];\n- return FastPWAAudit.audit(generateArtifacts(5000, mockNetworkRecords)).then(result => {\n- assert.equal(result.rawValue, true);\n- assert.strictEqual(result.debugString, undefined);\n- assert.ok(!result.details, 'does not contain details when latencies are realistic');\n- });\n+ it('overrides with simulated result when throttling is modified', async () => {\n+ const artifacts = Object.assign({\n+ traces: {defaultPass: trace},\n+ devtoolsLogs: {defaultPass: devtoolsLog},\n+ }, Runner.instantiateComputedArtifacts());\n+\n+ const settings = {throttlingMethod: 'provided', throttling: {rttMs: 40, throughput: 100000}};\n+ const result = await FastPWAAudit.audit(artifacts, {settings});\n+ assert.equal(Math.round(result.rawValue), 5308);\n});\n});\n",
"new_path": "lighthouse-core/test/audits/load-fast-enough-for-pwa-test.js",
"old_path": "lighthouse-core/test/audits/load-fast-enough-for-pwa-test.js"
},
{
"change_type": "MODIFY",
"diff": "\"load-fast-enough-for-pwa\": {\n\"score\": 1,\n\"displayValue\": \"\",\n- \"rawValue\": true,\n- \"extendedInfo\": {\n- \"value\": {\n- \"areLatenciesAll3G\": true,\n- \"firstRequestLatencies\": [\n- {\n- \"url\": \"http://localhost:10200/dobetterweb/dbw_tester.html\",\n- \"latency\": \"570.56\"\n- },\n- {\n- \"url\": \"http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js\",\n- \"latency\": \"564.12\"\n- }\n- ],\n- \"isFast\": true,\n- \"timeToFirstInteractive\": 4927.278\n- }\n- },\n+ \"rawValue\": 4927.278,\n\"scoreDisplayMode\": \"binary\",\n\"name\": \"load-fast-enough-for-pwa\",\n\"description\": \"Page load is fast enough on 3G\",\n}\n},\n\"timing\": {\n- \"total\": 877\n+ \"total\": 788\n}\n}\n\\ No newline at end of file\n",
"new_path": "lighthouse-core/test/results/sample_v2.json",
"old_path": "lighthouse-core/test/results/sample_v2.json"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
core(load-fast-4-pwa): use computed artifacts (#4981)
| 1
|
core
|
load-fast-4-pwa
|
815,745
|
18.04.2018 14:03:54
| -10,800
|
7651fbf605d6e69ef1d845a00a478aa342016cd4
|
chore(release): 1.0.4
|
[
{
"change_type": "MODIFY",
"diff": "All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.\n+<a name=\"1.0.4\"></a>\n+## [1.0.4](https://github.com/ng-select/ng-select/compare/v1.0.3...v1.0.4) (2018-04-18)\n+\n+\n+### Bug Fixes\n+\n+* increase css specifity ([0d1d13c](https://github.com/ng-select/ng-select/commit/0d1d13c)), closes [#468](https://github.com/ng-select/ng-select/issues/468)\n+* use blur event to close dropdown ([1f85adc](https://github.com/ng-select/ng-select/commit/1f85adc))\n+* use special value mapping for ng-options ([61d61a2](https://github.com/ng-select/ng-select/commit/61d61a2))\n+\n+\n+\n<a name=\"1.0.3\"></a>\n## [1.0.3](https://github.com/ng-select/ng-select/compare/v1.0.2...v1.0.3) (2018-04-17)\n",
"new_path": "CHANGELOG.md",
"old_path": "CHANGELOG.md"
},
{
"change_type": "MODIFY",
"diff": "{\n\"$schema\": \"../node_modules/ng-packagr/package.schema.json\",\n\"name\": \"@ng-select/ng-select\",\n- \"version\": \"1.0.3\",\n+ \"version\": \"1.0.4\",\n\"description\": \"Angular ng-select - All in One UI Select, Multiselect and Autocomplete\",\n\"author\": \"@ng-select/ng-select\",\n\"license\": \"MIT\",\n",
"new_path": "src/package.json",
"old_path": "src/package.json"
}
] |
TypeScript
|
MIT License
|
ng-select/ng-select
|
chore(release): 1.0.4
| 1
|
chore
|
release
|
217,922
|
18.04.2018 14:27:34
| -7,200
|
ea7226a5a75006db7af2ec337752eb3881f7ef49
|
feat: features page has been removed for a new wiki system
|
[
{
"change_type": "MODIFY",
"diff": "\"extract\": \"ngx-translate-extract -i ./src --output ./src/assets/i18n/fr.json --output ./src/assets/i18n/de.json --output ./src/assets/i18n/en.json --output ./src/assets/i18n/ja.json --clean --sort --format namespaced-json\",\n\"commitmsg\": \"validate-commit-msg\",\n\"prerelease\": \"npm test\",\n- \"commit\": \"git-cz\"\n+ \"commit\": \"git-cz\",\n+ \"translations:clean\":\"node tools/translations-cleaner.js\"\n},\n\"private\": true,\n\"dependencies\": {\n",
"new_path": "package.json",
"old_path": "package.json"
},
{
"change_type": "MODIFY",
"diff": "<mat-icon matListIcon>settings</mat-icon>\n<span matLine *ngIf=\"!settings.compactSidebar\">{{'SETTINGS.title' | translate}}</span>\n</mat-list-item>\n- <mat-list-item routerLink=\"/features\" (click)=\"mobile ? sidenav.close() : null\"\n+ <mat-list-item routerLink=\"/wiki\" (click)=\"mobile ? sidenav.close() : null\"\nmatTooltipPosition=\"right\"\n- matTooltip=\"{{'HOME_PAGE.features' | translate}}\"\n+ matTooltip=\"{{'HOME_PAGE.Wiki' | translate}}\"\n[matTooltipDisabled]=\"!settings.compactSidebar\">\n- <mat-icon matListIcon>help_outline</mat-icon>\n- <span matLine *ngIf=\"!settings.compactSidebar\">{{'HOME_PAGE.features' | translate}}</span>\n+ <mat-icon matListIcon>find_in_page</mat-icon>\n+ <span matLine *ngIf=\"!settings.compactSidebar\">{{'HOME_PAGE.Wiki' | translate}}</span>\n</mat-list-item>\n<mat-list-item routerLink=\"/about\" (click)=\"mobile ? sidenav.close() : null\"\nmatTooltipPosition=\"right\"\n",
"new_path": "src/app/app.component.html",
"old_path": "src/app/app.component.html"
},
{
"change_type": "MODIFY",
"diff": "@@ -42,7 +42,6 @@ import {RecipesModule} from './pages/recipes/recipes.module';\nimport {ListsModule} from 'app/pages/lists/lists.module';\nimport {BetaDisclaimerModule} from './modules/beta-disclaimer/beta-disclaimer.module';\nimport {AngularFirestoreModule} from 'angularfire2/firestore';\n-import {FeaturesModule} from './pages/features/features.module';\nimport {AlarmsModule} from './pages/alarms/alarms.module';\nimport {ProfileModule} from './pages/profile/profile.module';\nimport {PublicListsModule} from './pages/public-lists/public-lists.module';\n@@ -124,7 +123,6 @@ export function HttpLoaderFactory(http: HttpClient) {\nProfileModule,\nCustomLinksModule,\nLinkModule,\n- FeaturesModule,\nRecipesModule,\nListsModule,\nPublicListsModule,\n",
"new_path": "src/app/app.module.ts",
"old_path": "src/app/app.module.ts"
},
{
"change_type": "DELETE",
"diff": "-import {NgModule} from '@angular/core';\n-import {CommonModule} from '@angular/common';\n-import {FeaturesComponent} from './features/features.component';\n-import {RouterModule, Routes} from '@angular/router';\n-import {MatExpansionModule} from '@angular/material';\n-import {TranslateModule} from '@ngx-translate/core';\n-import {MaintenanceGuard} from '../maintenance/maintenance.guard';\n-\n-const routes: Routes = [\n- {\n- path: 'features',\n- component: FeaturesComponent,\n- canActivate: [MaintenanceGuard]\n- },\n-];\n-\n-@NgModule({\n- imports: [\n- CommonModule,\n- RouterModule.forChild(routes),\n- TranslateModule,\n-\n- MatExpansionModule,\n- ],\n- declarations: [\n- FeaturesComponent\n- ]\n-})\n-export class FeaturesModule {\n-}\n",
"new_path": null,
"old_path": "src/app/pages/features/features.module.ts"
},
{
"change_type": "DELETE",
"diff": "-<h2>{{\"HOME_PAGE.features\" | translate}}</h2>\n-\n-<mat-expansion-panel class=\"accent\">\n- <mat-expansion-panel-header>\n- <mat-panel-title>{{\"HOME_PAGE.FEATURES.list_creation_title\" | translate}}</mat-panel-title>\n- <mat-panel-description>\n- {{\"HOME_PAGE.FEATURES.list_creation_content\" | translate}}\n- </mat-panel-description>\n- </mat-expansion-panel-header>\n- <img src=\"https://i.imgur.com/Mio1YJ7.gif\" alt=\"add recipe gif\">\n-</mat-expansion-panel>\n-\n-<mat-expansion-panel class=\"accent\">\n- <mat-expansion-panel-header>\n- <mat-panel-title>{{\"HOME_PAGE.FEATURES.realtime_translations_title\" | translate}}</mat-panel-title>\n- <mat-panel-description>\n- {{\"HOME_PAGE.FEATURES.realtime_translations_content\" | translate}}\n- </mat-panel-description>\n- </mat-expansion-panel-header>\n- <img src=\"https://imgur.com/1zNnrgX.gif\" alt=\"realtime translations gif\">\n-</mat-expansion-panel>\n-\n-<mat-expansion-panel class=\"accent\">\n- <mat-expansion-panel-header>\n- <mat-panel-title>{{\"HOME_PAGE.FEATURES.item_details_title\" | translate}}</mat-panel-title>\n- <mat-panel-description>\n- {{\"HOME_PAGE.FEATURES.item_details_content\" | translate}}\n- </mat-panel-description>\n- </mat-expansion-panel-header>\n- <img src=\"https://imgur.com/IMCi8tT.gif\" alt=\"item details gif\">\n-</mat-expansion-panel>\n-\n-<mat-expansion-panel class=\"accent\">\n- <mat-expansion-panel-header>\n- <mat-panel-title>{{\"HOME_PAGE.FEATURES.node_timers_title\" | translate}}</mat-panel-title>\n- <mat-panel-description>\n- {{\"HOME_PAGE.FEATURES.node_timers_content\" | translate}}\n- </mat-panel-description>\n- </mat-expansion-panel-header>\n- <img src=\"https://imgur.com/bGoOqgc.gif\" alt=\"node timers gif\">\n-</mat-expansion-panel>\n-\n-<mat-expansion-panel class=\"accent\">\n- <mat-expansion-panel-header>\n- <mat-panel-title>{{\"HOME_PAGE.FEATURES.search_filters_title\" | translate}}</mat-panel-title>\n- <mat-panel-description>\n- {{\"HOME_PAGE.FEATURES.search_filters_content\" | translate}}\n- </mat-panel-description>\n- </mat-expansion-panel-header>\n- <img src=\"https://imgur.com/4CKQOPS.gif\" alt=\"search filters gif\">\n-</mat-expansion-panel>\n-\n-<mat-expansion-panel class=\"accent\">\n- <mat-expansion-panel-header>\n- <mat-panel-title>{{\"HOME_PAGE.FEATURES.bulk_import_title\" | translate}}</mat-panel-title>\n- <mat-panel-description>\n- {{\"HOME_PAGE.FEATURES.bulk_import_content\" | translate}}\n- </mat-panel-description>\n- </mat-expansion-panel-header>\n- <img src=\"https://imgur.com/aXTVoUk.gif\" alt=\"bulk import gif\">\n-</mat-expansion-panel>\n-\n-<mat-expansion-panel class=\"accent\">\n- <mat-expansion-panel-header>\n- <mat-panel-title>{{\"HOME_PAGE.FEATURES.map_markers_title\" | translate}}</mat-panel-title>\n- <mat-panel-description>\n- {{\"HOME_PAGE.FEATURES.map_markers_content\" | translate}}\n- </mat-panel-description>\n- </mat-expansion-panel-header>\n- <img src=\"https://imgur.com/vynVQEa.gif\" alt=\"map marker gif\">\n-</mat-expansion-panel>\n-\n-<mat-expansion-panel class=\"accent\">\n- <mat-expansion-panel-header>\n- <mat-panel-title>{{\"HOME_PAGE.FEATURES.comments_title\" | translate}}</mat-panel-title>\n- <mat-panel-description>\n- {{\"HOME_PAGE.FEATURES.comments_content\" | translate}}\n- </mat-panel-description>\n- </mat-expansion-panel-header>\n- <img src=\"https://imgur.com/JhwmFkZ.gif\" alt=\"comments gif\">\n-</mat-expansion-panel>\n-\n-<mat-expansion-panel class=\"accent\">\n- <mat-expansion-panel-header>\n- <mat-panel-title>{{\"HOME_PAGE.FEATURES.pricing_title\" | translate}}</mat-panel-title>\n- <mat-panel-description>\n- {{\"HOME_PAGE.FEATURES.pricing_content\" | translate}}\n- </mat-panel-description>\n- </mat-expansion-panel-header>\n- <img src=\"https://imgur.com/bfJE7OI.gif\" alt=\"pricing gif\">\n-</mat-expansion-panel>\n-\n-<mat-expansion-panel class=\"accent\">\n- <mat-expansion-panel-header>\n- <mat-panel-title>{{\"HOME_PAGE.FEATURES.inventory_title\" | translate}}</mat-panel-title>\n- <mat-panel-description>\n- {{\"HOME_PAGE.FEATURES.inventory_content\" | translate}}\n- </mat-panel-description>\n- </mat-expansion-panel-header>\n- <img src=\"https://i.imgur.com/Cy6A8gl.gif\" alt=\"pricing gif\">\n-</mat-expansion-panel>\n-\n-<mat-expansion-panel class=\"accent\">\n- <mat-expansion-panel-header>\n- <mat-panel-title>{{\"HOME_PAGE.FEATURES.alarms_title\" | translate}}</mat-panel-title>\n- <mat-panel-description>\n- {{\"HOME_PAGE.FEATURES.alarms_content\" | translate}}\n- </mat-panel-description>\n- </mat-expansion-panel-header>\n- <img src=\"https://i.imgur.com/MJjCl3O.png\" alt=\"alarms view\">\n-</mat-expansion-panel>\n",
"new_path": null,
"old_path": "src/app/pages/features/features/features.component.html"
},
{
"change_type": "DELETE",
"diff": "-mat-expansion-panel {\n- margin-bottom: 10px;\n- mat-panel-description {\n- white-space: nowrap;\n- text-overflow: ellipsis;\n- overflow: hidden;\n- display: block;\n- font-size: 14px;\n- }\n- mat-expansion-panel-header.mat-expanded mat-panel-description{\n- white-space: normal;\n- }\n- img {\n- height: auto;\n- width: 100%;\n- }\n-}\n-\n",
"new_path": null,
"old_path": "src/app/pages/features/features/features.component.scss"
},
{
"change_type": "DELETE",
"diff": "-import {Component} from '@angular/core';\n-\n-@Component({\n- selector: 'app-features',\n- templateUrl: './features.component.html',\n- styleUrls: ['./features.component.scss']\n-})\n-export class FeaturesComponent {\n-}\n",
"new_path": null,
"old_path": "src/app/pages/features/features/features.component.ts"
},
{
"change_type": "ADD",
"diff": "+const fs = require('fs');\n+\n+\n+/*\n+ WIP\n+ */\n+\n+function cleanTranslation(translation, codeBulk, exclusions = [], parent = '') {\n+ let parentObject = translation;\n+ if (parent.length > 0) {\n+ const objectPath = parent.split('.');\n+ for (const level of objectPath) {\n+ parentObject = parentObject[level];\n+ }\n+ }\n+ for (const key of Object.keys(parentObject)) {\n+ const fullKey = parent.length > 0 ? parent + '.' + key : key;\n+ if (typeof(parentObject[key]) === 'object') {\n+ cleanTranslation(translation, codeBulk, exclusions, fullKey);\n+ } else {\n+ const excluded = exclusions.find(exclusion => fullKey.indexOf(exclusion) > -1) !== undefined;\n+ if (!excluded && codeBulk.indexOf(fullKey) === -1) {\n+ const propertyToDelete = fullKey.split('.').pop();\n+ delete parentObject[propertyToDelete];\n+ }\n+ }\n+ }\n+ return parentObject;\n+}\n+\n+function walkSync(dir, filelist) {\n+ const files = fs.readdirSync(dir);\n+ filelist = filelist || [];\n+ files.forEach(function (file) {\n+ if (fs.statSync(dir + file).isDirectory()) {\n+ filelist = walkSync(dir + file + '/', filelist);\n+ }\n+ else {\n+ filelist.push(dir + file);\n+ }\n+ });\n+ return filelist;\n+}\n+\n+const translations = fs.readdirSync('./src/assets/i18n/')\n+ .map(file => ({\n+ path: './src/assets/i18n/' + file,\n+ content: JSON.parse(fs.readFileSync('./src/assets/i18n/' + file, 'UTF-8'))\n+ }));\n+\n+const sourceFiles = walkSync('./src/app/');\n+\n+const reducer = (currentValue, file) => {\n+ return currentValue + fs.readFileSync(file, 'UTF-8');\n+};\n+\n+const bulkSourceCode = sourceFiles.reduce(reducer, '');\n+\n+\n+translations.forEach(translation => {\n+ const cleaned = cleanTranslation(translation.content, bulkSourceCode, ['LIST_TAGS', 'auth/']);\n+ fs.writeFileSync(translation.path + '.clean.json', JSON.stringify(cleaned));\n+});\n+\n+\n",
"new_path": "tools/translations-cleaner.js",
"old_path": null
}
] |
TypeScript
|
MIT License
|
ffxiv-teamcraft/ffxiv-teamcraft
|
feat: features page has been removed for a new wiki system
| 1
|
feat
| null |
821,196
|
18.04.2018 14:47:56
| 25,200
|
04fc97260750ba144710e243c0404a284141d42d
|
fix: use npm instead of yarn in CI scripts when not using yarn
* fix: use npm instead of yarn in CI scripts when not using yarn
Fixes
* chore: updated deps
* fix: add nyc
|
[
{
"change_type": "MODIFY",
"diff": "\"@oclif/config\": \"^1.6.4\",\n\"@oclif/errors\": \"^1.0.4\",\n\"@oclif/plugin-help\": \"^1.2.4\",\n- \"@oclif/plugin-not-found\": \"^1.0.5\",\n- \"@oclif/plugin-warn-if-update-available\": \"^1.3.0\",\n+ \"@oclif/plugin-not-found\": \"^1.0.6\",\n+ \"@oclif/plugin-warn-if-update-available\": \"^1.3.1\",\n\"debug\": \"^3.1.0\",\n\"fixpack\": \"^2.3.1\",\n\"lodash\": \"^4.17.5\",\n\"yosay\": \"^2.0.2\"\n},\n\"devDependencies\": {\n- \"@oclif/dev-cli\": \"^1.13.0\",\n+ \"@oclif/dev-cli\": \"^1.13.1\",\n\"@oclif/tslint\": \"^1.1.0\",\n\"@types/lodash\": \"^4.14.107\",\n\"@types/read-pkg\": \"^3.0.0\",\n\"eslint\": \"^4.19.1\",\n\"eslint-config-oclif\": \"^1.4.0\",\n\"execa\": \"^0.10.0\",\n- \"fancy-test\": \"^1.0.4\",\n+ \"fancy-test\": \"^1.0.5\",\n\"fs-extra\": \"^5.0.0\",\n\"globby\": \"^8.0.1\",\n- \"mocha\": \"^5.1.0\",\n+ \"mocha\": \"^5.1.1\",\n\"npm-run-path\": \"^2.0.2\",\n\"nps\": \"^5.9.0\",\n\"shelljs\": \"^0.8.1\",\n",
"new_path": "package.json",
"old_path": "package.json"
},
{
"change_type": "MODIFY",
"diff": "@@ -257,7 +257,7 @@ class App extends Generator {\nthis.pjson.scripts.posttest = 'eslint .'\n}\nif (this.mocha) {\n- this.pjson.scripts.test = `mocha --forbid-only \"test/**/*.test.${this._ext}\"`\n+ this.pjson.scripts.test = `nyc mocha --forbid-only \"test/**/*.test.${this._ext}\"`\n} else {\nthis.pjson.scripts.test = 'echo NO TESTS'\n}\n@@ -326,13 +326,14 @@ class App extends Generator {\nthis.fs.copyTpl(this.templatePath('tsconfig.json'), this.destinationPath('tsconfig.json'), this)\nif (this.mocha) {\nthis.fs.copyTpl(this.templatePath('test/tsconfig.json'), this.destinationPath('test/tsconfig.json'), this)\n+ this.fs.copyTpl(this.templatePath('nycrc'), this.destinationPath('.nycrc'), this)\n}\n} else {\nthis.fs.copyTpl(this.templatePath('eslintrc'), this.destinationPath('.eslintrc'), this)\nconst eslintignore = this._eslintignore()\nif (eslintignore.trim()) this.fs.write(this.destinationPath('.eslintignore'), this._eslintignore())\n}\n- if (this.mocha && !this.fs.exists('test')) {\n+ if (this.mocha) {\nthis.fs.copyTpl(this.templatePath('test/helpers/init.js'), this.destinationPath('test/helpers/init.js'), this)\nthis.fs.copyTpl(this.templatePath('test/mocha.opts'), this.destinationPath('test/mocha.opts'), this)\n}\n@@ -413,6 +414,7 @@ class App extends Generator {\nif (this.mocha) {\ndevDependencies.push(\n'mocha@5',\n+ 'nyc@11',\n'chai@4',\n)\nif (this.type !== 'base') devDependencies.push(\n",
"new_path": "src/generators/app.ts",
"old_path": "src/generators/app.ts"
},
{
"change_type": "MODIFY",
"diff": "environment:\nnodejs_version: \"9\"\ncache:\n+<%_ if (yarn) { _%>\n- '%LOCALAPPDATA%\\Yarn -> appveyor.yml'\n- node_modules -> yarn.lock\n+<%_ } else { _%>\n+ - '%AppData%\\npm-cache -> appveyor.yml'\n+ - node_modules -> package-lock.json\n+<%_ } _%>\ninstall:\n- ps: Install-Product node $env:nodejs_version x64\n- - yarn add -D nyc@11 @oclif/nyc-config@1\n+<%_ if (yarn) { _%>\n+ - yarn\n+<%_ } else { _%>\n+ - npm install\n+<%_ } _%>\ntest_script:\n<%_ if (type === 'single' || type === 'multi') { _%>\n- .\\bin\\run --version\n@@ -14,9 +23,9 @@ test_script:\n<%_ } else if (type === 'plugin') { _%>\n- .\\bin\\run --help\n<%_ } _%>\n- - .\\node_modules\\.bin\\nyc --nycrc-path node_modules/@oclif/nyc-config/.nycrc yarn test\n+ - <%- yarn ? 'yarn' : 'npm' %> test\nafter_test:\n- - .\\node_modules\\.bin\\nyc --nycrc-path node_modules/@oclif/nyc-config/.nycrc report --reporter text-lcov > coverage.lcov\n+ - .\\node_modules\\.bin\\nyc report --reporter text-lcov > coverage.lcov\n- ps: |\n$env:PATH = 'C:\\msys64\\usr\\bin;' + $env:PATH\nInvoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh\n",
"new_path": "templates/appveyor.yml.ejs",
"old_path": "templates/appveyor.yml.ejs"
},
{
"change_type": "MODIFY",
"diff": "@@ -5,38 +5,43 @@ jobs:\ndocker:\n- image: node:latest\nworking_directory: ~/cli\n- environment:\n- <%_ if (mocha) { _%>\n- NYC: \"yarn exec nyc -- --nycrc-path node_modules/@oclif/nyc-config/.nycrc\"\n- <%_ } _%>\nsteps:\n- checkout\n- restore_cache: &restore_cache\nkeys:\n- - v1-yarn-{{checksum \".circleci/config.yml\"}}-{{ checksum \"yarn.lock\"}}\n- - v1-yarn-{{checksum \".circleci/config.yml\"}}\n+ - v1-npm-{{checksum \".circleci/config.yml\"}}-{{ checksum \"<%- yarn ? 'yarn.lock' : 'package-lock.json' %>\"}}\n+ - v1-npm-{{checksum \".circleci/config.yml\"}}\n- run:\nname: Install dependencies\n- command: |\n- .circleci/greenkeeper\n- yarn add -D nyc@11 @oclif/nyc-config@1\n+ command: .circleci/greenkeeper\n<%_ if (['single', 'multi'].includes(type)) { _%>\n- run: ./bin/run --version\n<%_ } _%>\n<%_ if (['single', 'multi', 'plugin'].includes(type)) { _%>\n- run: ./bin/run --help\n<%_ } _%>\n- <%_ if (mocha) { _%>\n- run:\nname: Testing\n- command: $NYC yarn test\n+ command: <%- yarn ? 'yarn' : 'npm' %> test\n+ <%_ if (mocha) { _%>\n- run:\nname: Submitting code coverage to codecov\ncommand: |\n- $NYC report --reporter text-lcov > coverage.lcov\n+ ./node_modules/.bin/nyc report --reporter text-lcov > coverage.lcov\ncurl -s https://codecov.io/bash | bash\n+ <%_ } _%>\n+ <%_ if (!semantic_release) { _%>\n+ - save_cache:\n+ key: v1-yarn-{{checksum \".circleci/config.yml\"}}-{{checksum \"yarn.lock\"}}\n+ paths:\n+ - ~/cli/node_modules\n+ <%_ if (yarn) { _%>\n+ - /usr/local/share/.cache/yarn\n+ - /usr/local/share/.config/yarn\n<%_ } else { _%>\n- - run: yarn test\n+ - ~/.npm\n+ - /usr/local/lib/node_modules\n+ <%_ } _%>\n<%_ } _%>\nnode-8:\n<<: *test\n@@ -52,22 +57,26 @@ jobs:\n- run:\nname: Install dependencies\ncommand: |\n- yarn global add @oclif/semantic-release@3 semantic-release@15\n- yarn --frozen-lockfile\n+ <%- yarn ? 'yarn global add' : 'npm install -g' %> @oclif/semantic-release@3 semantic-release@15\n+ <%- yarn ? 'yarn --frozen-lockfile' : 'npm install' %>\n- run:\nname: Cutting release\ncommand: |\n+ <%_ if (yarn) { _%>\nexport PATH=/usr/local/share/.config/yarn/global/node_modules/.bin:$PATH\n+ <%_ } _%>\nsemantic-release -e @oclif/semantic-release\n- - run:\n- name: Add dev packages to cache\n- command: yarn add -D nyc@11 @oclif/nyc-config@1\n- save_cache:\nkey: v1-yarn-{{checksum \".circleci/config.yml\"}}-{{checksum \"yarn.lock\"}}\npaths:\n- ~/cli/node_modules\n+ <%_ if (yarn) { _%>\n- /usr/local/share/.cache/yarn\n- /usr/local/share/.config/yarn\n+ <%_ } else { _%>\n+ - ~/.npm\n+ - /usr/local/lib/node_modules\n+ <%_ } _%>\n<%_ } _%>\nworkflows:\n",
"new_path": "templates/circle.yml.ejs",
"old_path": "templates/circle.yml.ejs"
},
{
"change_type": "ADD",
"diff": "+{\n+ \"extension\": [\n+ \".ts\"\n+ ],\n+ \"include\": [\n+ \"src/**/*.ts\"\n+ ],\n+ \"exclude\": [\n+ \"**/*.d.ts\"\n+ ],\n+ \"all\": true\n+}\n",
"new_path": "templates/nycrc",
"old_path": null
},
{
"change_type": "MODIFY",
"diff": "strip-ansi \"^4.0.0\"\nsupports-color \"^5.1.0\"\n-\"@heroku/linewrap@^1.0.0\":\n- version \"1.0.0\"\n- resolved \"https://registry.yarnpkg.com/@heroku/linewrap/-/linewrap-1.0.0.tgz#a9d4e99f0a3e423a899b775f5f3d6747a1ff15c6\"\n-\n\"@mrmlnc/readdir-enhanced@^2.2.1\":\nversion \"2.2.1\"\nresolved \"https://registry.yarnpkg.com/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde\"\ncall-me-maybe \"^1.0.1\"\nglob-to-regexp \"^0.3.0\"\n-\"@oclif/command@^1.4.13\", \"@oclif/command@^1.4.7\":\n+\"@oclif/command@^1.4.13\":\nversion \"1.4.13\"\nresolved \"https://registry.yarnpkg.com/@oclif/command/-/command-1.4.13.tgz#2ed3c42142307d20337ec04eabd1be410dfa2a5e\"\ndependencies:\ndebug \"^3.1.0\"\nsemver \"^5.5.0\"\n-\"@oclif/command@^1.4.4\":\n- version \"1.4.6\"\n- resolved \"https://registry.yarnpkg.com/@oclif/command/-/command-1.4.6.tgz#6de7789cfc6ae6cdf177566fbfbb742d5cb8f320\"\n- dependencies:\n- \"@oclif/errors\" \"^1.0.3\"\n- \"@oclif/parser\" \"^3.2.9\"\n- debug \"^3.1.0\"\n- semver \"^5.5.0\"\n-\n-\"@oclif/config@^1.4.0\", \"@oclif/config@^1.6.1\", \"@oclif/config@^1.6.4\":\n+\"@oclif/config@^1.6.4\":\nversion \"1.6.4\"\nresolved \"https://registry.yarnpkg.com/@oclif/config/-/config-1.6.4.tgz#4bcb51fa40646794031437d7904f0fbb56e5c072\"\ndependencies:\ndebug \"^3.1.0\"\n-\"@oclif/dev-cli@^1.13.0\":\n- version \"1.13.0\"\n- resolved \"https://registry.yarnpkg.com/@oclif/dev-cli/-/dev-cli-1.13.0.tgz#b46bf7e8cf247a1aa2acdd46be38819a2fd4febd\"\n+\"@oclif/dev-cli@^1.13.1\":\n+ version \"1.13.1\"\n+ resolved \"https://registry.yarnpkg.com/@oclif/dev-cli/-/dev-cli-1.13.1.tgz#3a40b2c5890c86413ef3a2fcf232178cff7e897c\"\ndependencies:\n\"@oclif/command\" \"^1.4.13\"\n- \"@oclif/config\" \"^1.6.1\"\n+ \"@oclif/config\" \"^1.6.4\"\n\"@oclif/errors\" \"^1.0.4\"\n- \"@oclif/plugin-help\" \"^1.2.3\"\n- cli-ux \"^3.3.28\"\n+ \"@oclif/plugin-help\" \"^1.2.4\"\n+ cli-ux \"^3.3.30\"\ndebug \"^3.1.0\"\nfs-extra \"^5.0.0\"\nlodash \"^4.17.5\"\nrequire-resolve \"^0.0.2\"\ntslib \"^1.9.0\"\n-\"@oclif/errors@^1.0.3\":\n- version \"1.0.3\"\n- resolved \"https://registry.yarnpkg.com/@oclif/errors/-/errors-1.0.3.tgz#f23c024075855c7d116d041ee158f99bd51175af\"\n- dependencies:\n- clean-stack \"^1.3.0\"\n- fs-extra \"^5.0.0\"\n- indent-string \"^3.2.0\"\n- strip-ansi \"^4.0.0\"\n- wrap-ansi \"^3.0.1\"\n-\n\"@oclif/errors@^1.0.4\":\nversion \"1.0.4\"\nresolved \"https://registry.yarnpkg.com/@oclif/errors/-/errors-1.0.4.tgz#8e34386ede530484ae3c98bc21d818c416214c66\"\nversion \"1.0.0\"\nresolved \"https://registry.yarnpkg.com/@oclif/linewrap/-/linewrap-1.0.0.tgz#aedcb64b479d4db7be24196384897b5000901d91\"\n-\"@oclif/parser@^3.2.9\":\n- version \"3.2.9\"\n- resolved \"https://registry.yarnpkg.com/@oclif/parser/-/parser-3.2.9.tgz#76d01106971e20dfcfec5be276c4e6e9edfee9ec\"\n- dependencies:\n- \"@heroku/linewrap\" \"^1.0.0\"\n-\n\"@oclif/parser@^3.3.2\":\nversion \"3.3.2\"\nresolved \"https://registry.yarnpkg.com/@oclif/parser/-/parser-3.3.2.tgz#81af56d4f97beae376abb59e461005489abd9e19\"\n\"@oclif/linewrap\" \"^1.0.0\"\nchalk \"^2.3.2\"\n-\"@oclif/plugin-help@^1.2.3\", \"@oclif/plugin-help@^1.2.4\":\n+\"@oclif/plugin-help@^1.2.4\":\nversion \"1.2.4\"\nresolved \"https://registry.yarnpkg.com/@oclif/plugin-help/-/plugin-help-1.2.4.tgz#1b4349f7d570445ad5cfe4f925bfd832d4552aa2\"\ndependencies:\nwidest-line \"^2.0.0\"\nwrap-ansi \"^3.0.1\"\n-\"@oclif/plugin-not-found@^1.0.5\":\n- version \"1.0.5\"\n- resolved \"https://registry.yarnpkg.com/@oclif/plugin-not-found/-/plugin-not-found-1.0.5.tgz#45ed23895cb19564ca14df9b75c570670ad31a44\"\n+\"@oclif/plugin-not-found@^1.0.6\":\n+ version \"1.0.6\"\n+ resolved \"https://registry.yarnpkg.com/@oclif/plugin-not-found/-/plugin-not-found-1.0.6.tgz#471bf3410a3d656d8d7fa482ca9afc4f909be981\"\ndependencies:\n\"@heroku-cli/color\" \"^1.1.3\"\n- \"@oclif/command\" \"^1.4.4\"\n+ \"@oclif/command\" \"^1.4.13\"\nstring-similarity \"^1.2.0\"\n-\"@oclif/plugin-warn-if-update-available@^1.3.0\":\n- version \"1.3.0\"\n- resolved \"https://registry.yarnpkg.com/@oclif/plugin-warn-if-update-available/-/plugin-warn-if-update-available-1.3.0.tgz#f332eee1560cdeed1b4f4857cb54260fe1ca2582\"\n+\"@oclif/plugin-warn-if-update-available@^1.3.1\":\n+ version \"1.3.1\"\n+ resolved \"https://registry.yarnpkg.com/@oclif/plugin-warn-if-update-available/-/plugin-warn-if-update-available-1.3.1.tgz#f0df2532daaa0a937750385445edea9a76f9e7ab\"\ndependencies:\n- \"@oclif/command\" \"^1.4.7\"\n- \"@oclif/config\" \"^1.4.0\"\n+ \"@oclif/command\" \"^1.4.13\"\n+ \"@oclif/config\" \"^1.6.4\"\n\"@oclif/errors\" \"^1.0.4\"\n- chalk \"^2.3.2\"\n+ chalk \"^2.4.0\"\ndebug \"^3.1.0\"\nfs-extra \"^5.0.0\"\nhttp-call \"^5.1.0\"\n@@ -613,6 +584,14 @@ chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.3.2:\nescape-string-regexp \"^1.0.5\"\nsupports-color \"^5.3.0\"\n+chalk@^2.4.0:\n+ version \"2.4.0\"\n+ resolved \"https://registry.yarnpkg.com/chalk/-/chalk-2.4.0.tgz#a060a297a6b57e15b61ca63ce84995daa0fe6e52\"\n+ dependencies:\n+ ansi-styles \"^3.2.1\"\n+ escape-string-regexp \"^1.0.5\"\n+ supports-color \"^5.3.0\"\n+\nchardet@^0.4.0:\nversion \"0.4.2\"\nresolved \"https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2\"\n@@ -664,15 +643,15 @@ cli-table@^0.3.1:\ndependencies:\ncolors \"1.0.3\"\n-cli-ux@^3.3.28:\n- version \"3.3.30\"\n- resolved \"https://registry.yarnpkg.com/cli-ux/-/cli-ux-3.3.30.tgz#525e65bda07a04e913673dfd614519373053d003\"\n+cli-ux@^3.3.30:\n+ version \"3.3.31\"\n+ resolved \"https://registry.yarnpkg.com/cli-ux/-/cli-ux-3.3.31.tgz#e4f2a380df00ebf298189b83a77ae92cdfc7355f\"\ndependencies:\n\"@oclif/linewrap\" \"^1.0.0\"\n\"@oclif/screen\" \"^1.0.2\"\nansi-styles \"^3.2.1\"\ncardinal \"^1.0.0\"\n- chalk \"^2.3.2\"\n+ chalk \"^2.4.0\"\nclean-stack \"^1.3.0\"\nextract-stack \"^1.0.0\"\nfs-extra \"^5.0.0\"\n@@ -681,7 +660,7 @@ cli-ux@^3.3.28:\npassword-prompt \"^1.0.4\"\nsemver \"^5.5.0\"\nstrip-ansi \"^4.0.0\"\n- supports-color \"^5.3.0\"\n+ supports-color \"^5.4.0\"\ncli-width@^2.0.0:\nversion \"2.2.0\"\n@@ -1288,12 +1267,12 @@ extract-stack@^1.0.0:\nversion \"1.0.0\"\nresolved \"https://registry.yarnpkg.com/extract-stack/-/extract-stack-1.0.0.tgz#b97acaf9441eea2332529624b732fc5a1c8165fa\"\n-fancy-test@^1.0.4:\n- version \"1.0.4\"\n- resolved \"https://registry.yarnpkg.com/fancy-test/-/fancy-test-1.0.4.tgz#fa689cfc98abec74a0b2f4386d92c58f1ef20f11\"\n+fancy-test@^1.0.5:\n+ version \"1.0.5\"\n+ resolved \"https://registry.yarnpkg.com/fancy-test/-/fancy-test-1.0.5.tgz#323970de576f7dc0938402c3a731ee4d59896a11\"\ndependencies:\nlodash \"^4.17.5\"\n- stdout-stderr \"^0.1.8\"\n+ stdout-stderr \"^0.1.9\"\nfast-deep-equal@^1.0.0:\nversion \"1.1.0\"\n@@ -2224,9 +2203,9 @@ mkdirp@0.5.1, mkdirp@^0.5.0, mkdirp@^0.5.1:\ndependencies:\nminimist \"0.0.8\"\n-mocha@^5.1.0:\n- version \"5.1.0\"\n- resolved \"https://registry.yarnpkg.com/mocha/-/mocha-5.1.0.tgz#5ff11cc39c0bb65330ac6c41f9086634e3e3f686\"\n+mocha@^5.1.1:\n+ version \"5.1.1\"\n+ resolved \"https://registry.yarnpkg.com/mocha/-/mocha-5.1.1.tgz#b774c75609dac05eb48f4d9ba1d827b97fde8a7b\"\ndependencies:\nbrowser-stdout \"1.3.1\"\ncommander \"2.11.0\"\n@@ -3063,7 +3042,7 @@ static-extend@^0.1.1:\ndefine-property \"^0.2.5\"\nobject-copy \"^0.1.0\"\n-stdout-stderr@^0.1.8:\n+stdout-stderr@^0.1.9:\nversion \"0.1.9\"\nresolved \"https://registry.yarnpkg.com/stdout-stderr/-/stdout-stderr-0.1.9.tgz#9b48ee04eff955ee07776e27125d5524d9d02f57\"\ndependencies:\n@@ -3192,6 +3171,12 @@ supports-color@^5.1.0, supports-color@^5.3.0:\ndependencies:\nhas-flag \"^3.0.0\"\n+supports-color@^5.4.0:\n+ version \"5.4.0\"\n+ resolved \"https://registry.yarnpkg.com/supports-color/-/supports-color-5.4.0.tgz#1c6b337402c2137605efe19f10fec390f6faab54\"\n+ dependencies:\n+ has-flag \"^3.0.0\"\n+\ntable@4.0.2:\nversion \"4.0.2\"\nresolved \"https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36\"\n",
"new_path": "yarn.lock",
"old_path": "yarn.lock"
}
] |
TypeScript
|
MIT License
|
oclif/oclif
|
fix: use npm instead of yarn in CI scripts when not using yarn (#108)
* fix: use npm instead of yarn in CI scripts when not using yarn
Fixes https://github.com/oclif/oclif/issues/104
* chore: updated deps
* fix: add nyc
| 1
|
fix
| null |
815,746
|
18.04.2018 16:48:54
| -10,800
|
d28bd4c7bb8546e80a524581da97b4fec59cbee6
|
fix: prevent default dropdown click event
Prevent default mousedown event on dropdown to keep header and footer templates working properly and do not close dropdown.
|
[
{
"change_type": "MODIFY",
"diff": "@@ -16,7 +16,8 @@ import {\nChangeDetectionStrategy,\nAfterContentInit,\nOnInit,\n- OnChanges\n+ OnChanges,\n+ HostListener\n} from '@angular/core';\nimport { NgOption } from './ng-select.types';\n@@ -33,7 +34,7 @@ const BOTTOM_CSS_CLASS = 'ng-select-bottom';\nencapsulation: ViewEncapsulation.None,\nselector: 'ng-dropdown-panel',\ntemplate: `\n- <div *ngIf=\"headerTemplate\" class=\"ng-dropdown-header\" ngProjectAs=\"header\" header>\n+ <div *ngIf=\"headerTemplate\" class=\"ng-dropdown-header\">\n<ng-container [ngTemplateOutlet]=\"headerTemplate\"></ng-container>\n</div>\n<div #scroll class=\"ng-dropdown-panel-items scroll-host\">\n@@ -42,7 +43,7 @@ const BOTTOM_CSS_CLASS = 'ng-select-bottom';\n<ng-content></ng-content>\n</div>\n</div>\n- <div *ngIf=\"footerTemplate\" class=\"ng-dropdown-footer\" ngProjectAs=\"footer\" footer>\n+ <div *ngIf=\"footerTemplate\" class=\"ng-dropdown-footer\">\n<ng-container [ngTemplateOutlet]=\"footerTemplate\"></ng-container>\n</div>\n`,\n@@ -150,6 +151,11 @@ export class NgDropdownPanelComponent implements OnInit, OnChanges, OnDestroy, A\nel.scrollTop = d.childHeight * (d.itemsLength + 1);\n}\n+ @HostListener('mousedown', ['$event'])\n+ handleMousedown($event: MouseEvent) {\n+ $event.preventDefault();\n+ }\n+\nprivate _handleScroll() {\nthis._disposeScrollListener = this._renderer.listen(this.scrollElementRef.nativeElement, 'scroll', () => {\nthis.refresh();\n",
"new_path": "src/ng-select/ng-dropdown-panel.component.ts",
"old_path": "src/ng-select/ng-dropdown-panel.component.ts"
}
] |
TypeScript
|
MIT License
|
ng-select/ng-select
|
fix: prevent default dropdown click event (#474)
Prevent default mousedown event on dropdown to keep header and footer templates working properly and do not close dropdown.
| 1
|
fix
| null |
791,813
|
18.04.2018 19:28:15
| -7,200
|
fff50f2bfe59baa5b0083424600b5c4e9a6028c3
|
core(canonical-audit): allow multiple identical canonical links
|
[
{
"change_type": "MODIFY",
"diff": "@@ -23,13 +23,18 @@ const failureHeaders = headersParam([[\n'<https://example.com>; rel=\"canonical\"',\n]]);\n+const passHeaders = headersParam([[\n+ 'link',\n+ '<http://localhost:10200/seo/>; rel=\"canonical\"',\n+]]);\n+\n/**\n* Expected Lighthouse audit values for seo tests\n*/\nmodule.exports = [\n{\n- initialUrl: BASE_URL + 'seo-tester.html',\n- url: BASE_URL + 'seo-tester.html',\n+ initialUrl: BASE_URL + 'seo-tester.html?' + passHeaders,\n+ url: BASE_URL + 'seo-tester.html?' + passHeaders,\naudits: {\n'viewport': {\nscore: 1,\n@@ -133,7 +138,7 @@ module.exports = [\n},\n'canonical': {\nscore: 0,\n- debugString: 'Multiple URLs (https://example.com, https://example.com/)',\n+ debugString: 'Multiple conflicting URLs (https://example.com, https://example.com/)',\n},\n},\n},\n",
"new_path": "lighthouse-cli/test/smokehouse/seo/expectations.js",
"old_path": "lighthouse-cli/test/smokehouse/seo/expectations.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -90,6 +90,9 @@ class Canonical extends Audit {\n});\ncanonicals = canonicals.concat(artifacts.Canonical);\n+ // we should only fail if there are multiple conflicting URLs\n+ // see: https://github.com/GoogleChrome/lighthouse/issues/3178#issuecomment-381181762\n+ canonicals = Array.from(new Set(canonicals));\nartifacts.Hreflang.forEach(({href}) => hreflangs.push(href));\n@@ -107,7 +110,7 @@ class Canonical extends Audit {\nif (canonicals.length > 1) {\nreturn {\nrawValue: false,\n- debugString: `Multiple URLs (${canonicals.join(', ')})`,\n+ debugString: `Multiple conflicting URLs (${canonicals.join(', ')})`,\n};\n}\n",
"new_path": "lighthouse-core/audits/seo/canonical.js",
"old_path": "lighthouse-core/audits/seo/canonical.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -142,6 +142,26 @@ describe('SEO: Document has valid canonical link', () => {\n});\n});\n+ it('succeeds when there are multiple identical canonical links', () => {\n+ const mainResource = {\n+ url: 'http://www.example.com/',\n+ responseHeaders: [{\n+ name: 'Link',\n+ value: '<https://www.example.com>; rel=\"canonical\"',\n+ }],\n+ };\n+ const artifacts = {\n+ devtoolsLogs: {[CanonicalAudit.DEFAULT_PASS]: []},\n+ requestMainResource: () => Promise.resolve(mainResource),\n+ Canonical: ['https://www.example.com'],\n+ Hreflang: [],\n+ };\n+\n+ return CanonicalAudit.audit(artifacts).then(auditResult => {\n+ assert.equal(auditResult.rawValue, true);\n+ });\n+ });\n+\nit('succeeds when valid canonical is provided via meta tag', () => {\nconst mainResource = {\nurl: 'http://example.com/articles/cats-and-you?utm_source=twitter',\n",
"new_path": "lighthouse-core/test/audits/seo/canonical-test.js",
"old_path": "lighthouse-core/test/audits/seo/canonical-test.js"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
core(canonical-audit): allow multiple identical canonical links (#4973)
| 1
|
core
|
canonical-audit
|
217,922
|
18.04.2018 19:56:26
| -7,200
|
fa56ea4338b5d7a6cfa196c9baeccc7e5f6c66e2
|
feat: portuguese translation
Thanks to absense (/u/Reyvateil)
|
[
{
"change_type": "MODIFY",
"diff": "<h1>FFXIV Teamcraft</h1>\n<mat-menu #langMenu=\"matMenu\" yPosition=\"above\">\n- <button mat-menu-item (click)=\"use('fr')\">FR</button>\n- <button mat-menu-item (click)=\"use('en')\">EN</button>\n- <button mat-menu-item (click)=\"use('de')\">DE</button>\n- <button mat-menu-item (click)=\"use('ja')\">JA</button>\n+ <button mat-menu-item *ngFor=\"let locale of locales\" (click)=\"use(locale)\">{{locale.toUpperCase()}}</button>\n</mat-menu>\n<button mat-button [matMenuTriggerFor]=\"langMenu\" fxHide fxShow.gt-sm>\n",
"new_path": "src/app/app.component.html",
"old_path": "src/app/app.component.html"
},
{
"change_type": "MODIFY",
"diff": "@@ -67,6 +67,8 @@ export class AppComponent implements OnInit {\ncustomLinksEnabled = false;\n+ public locales: string[] = ['en', 'de', 'fr', 'ja', 'pt'];\n+\nconstructor(private auth: AngularFireAuth,\nprivate router: Router,\nprivate translate: TranslateService,\n@@ -275,7 +277,7 @@ export class AppComponent implements OnInit {\n}\nuse(lang: string): void {\n- if (['en', 'de', 'fr', 'ja'].indexOf(lang) === -1) {\n+ if (this.locales.indexOf(lang) === -1) {\nlang = 'en';\n}\nthis.locale = lang;\n",
"new_path": "src/app/app.component.ts",
"old_path": "src/app/app.component.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -13,7 +13,7 @@ export class I18nToolsService {\nif (i18nName === undefined) {\nreturn 'missing name';\n}\n- return i18nName[this.translator.currentLang] || 'missing name';\n+ return i18nName[this.translator.currentLang] || i18nName.en || 'missing name';\n}\npublic createI18nName(item: I18nData): I18nName {\n",
"new_path": "src/app/core/tools/i18n-tools.service.ts",
"old_path": "src/app/core/tools/i18n-tools.service.ts"
}
] |
TypeScript
|
MIT License
|
ffxiv-teamcraft/ffxiv-teamcraft
|
feat: portuguese translation
Thanks to absense (/u/Reyvateil)
| 1
|
feat
| null |
679,913
|
18.04.2018 22:31:23
| -3,600
|
3b7c9d9741c65faa67bb0a645667c50a5f342f09
|
fix(transducers): add generics for compR(), fix types in mapNth()
|
[
{
"change_type": "MODIFY",
"diff": "@@ -638,7 +638,7 @@ itself. Returns nothing.\n#### `mapKeys(keys: IObjectOf<(x: any) => any>, copy?: boolean): Transducer<any, any>`\n-#### `mapNth<A, B>(n: number, offset: number, fn: (x: A) => B): Transducer<A, B>`\n+#### `mapNth<A, B>(n: number, offset?: number, fn: (x: A) => B): Transducer<A, A | B>`\n#### `mapVals<A, B>(fn: (v: A) => B, copy = true): Transducer<IObjectOf<A>, IObjectOf<B>>`\n",
"new_path": "packages/transducers/README.md",
"old_path": "packages/transducers/README.md"
},
{
"change_type": "MODIFY",
"diff": "import { Reducer } from \"../api\";\n+import { Reduced } from \"../reduced\";\n-export function compR(rfn: Reducer<any, any>, fn: (acc: any, x: any) => any) {\n- return <Reducer<any, any>>[rfn[0], rfn[1], fn];\n+/**\n+ * Reducer composition helper. Takes existing reducer `rfn` (a 3-tuple)\n+ * and a reducing function `fn`. Returns a new reducer tuple of this\n+ * form:\n+ *\n+ * ```\n+ * [rfn[0], rfn[1], fn]\n+ * ```\n+ *\n+ * `rfn[2]` reduces values of type `B` into an accumulator of type `A`.\n+ * `fn` accepts values of type `C` and produces interim results of type\n+ * `B`, which are then (possibly) passed to the \"inner\" `rfn[2]`\n+ * function. Therefore the resulting reducer takes inputs of `C` and an\n+ * accumulator of type `A`.\n+ *\n+ * It is assumed that `fn` internally calls `rfn[2]` to pass its own\n+ * results for further processing by the nested reducer `rfn`.\n+ *\n+ * @param rfn\n+ * @param fn\n+ */\n+export function compR<A, B, C>(rfn: Reducer<A, B>, fn: (acc: A, x: C) => A | Reduced<A>) {\n+ return <Reducer<A, C>>[rfn[0], rfn[1], fn];\n}\n",
"new_path": "packages/transducers/src/func/compr.ts",
"old_path": "packages/transducers/src/func/compr.ts"
},
{
"change_type": "MODIFY",
"diff": "import { Reducer, Transducer } from \"../api\";\nimport { compR } from \"../func/compr\";\n-export function mapNth<A, B>(n: number, fn: (x: A) => B): Transducer<A, B>;\n-export function mapNth<A, B>(n: number, offset: number, fn: (x: A) => B): Transducer<A, B>;\n-export function mapNth<A, B>(...args: any[]): Transducer<A, B> {\n+export function mapNth<A, B>(n: number, fn: (x: A) => B): Transducer<A, A | B>;\n+export function mapNth<A, B>(n: number, offset: number, fn: (x: A) => B): Transducer<A, A | B>;\n+export function mapNth<A, B>(...args: any[]): Transducer<A, A | B> {\nlet n = args[0] - 1, offset, fn;\nif (typeof args[1] === \"number\") {\noffset = args[1];\n@@ -12,7 +12,7 @@ export function mapNth<A, B>(...args: any[]): Transducer<A, B> {\nfn = args[1];\noffset = 0;\n}\n- return (rfn: Reducer<any, B>) => {\n+ return (rfn: Reducer<any, A | B>) => {\nconst r = rfn[2];\nlet skip = 0, off = offset;\nreturn compR(rfn,\n",
"new_path": "packages/transducers/src/xform/map-nth.ts",
"old_path": "packages/transducers/src/xform/map-nth.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
fix(transducers): add generics for compR(), fix types in mapNth()
| 1
|
fix
|
transducers
|
679,913
|
18.04.2018 22:38:14
| -3,600
|
b7dff0ea18891908281116b756b6547928586d4e
|
fix(rstream-graph): import path
|
[
{
"change_type": "MODIFY",
"diff": "@@ -7,10 +7,10 @@ import { ISubscribable } from \"@thi.ng/rstream/api\";\nimport { fromIterableSync } from \"@thi.ng/rstream/from/iterable\";\nimport { fromView } from \"@thi.ng/rstream/from/view\";\nimport { sync, StreamSync } from \"@thi.ng/rstream/stream-sync\";\n+import { Subscription } from \"@thi.ng/rstream/subscription\";\nimport { Transducer } from \"@thi.ng/transducers/api\";\nimport { NodeSpec } from \"./api\";\n-import { Subscription } from \"../../rstream/subscription\";\n/**\n* Dataflow graph initialization function. Takes an object of\n",
"new_path": "packages/rstream-graph/src/graph.ts",
"old_path": "packages/rstream-graph/src/graph.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
fix(rstream-graph): import path
| 1
|
fix
|
rstream-graph
|
679,913
|
18.04.2018 23:29:15
| -3,600
|
a2320ff23482de187d370a1a9fce2208963a8b0a
|
docs(paths): update readme
|
[
{
"change_type": "MODIFY",
"diff": "@@ -7,8 +7,8 @@ This project is part of the\n## About\n-This library provides immutable, optimized path-based accessors for\n-vanilla JS objects.\n+This library provides immutable and mutable, optimized path-based\n+accessors for vanilla JS objects.\n## Installation\n@@ -97,6 +97,30 @@ a.x.y === b.x.y // true\na.u === b.u; // true\n```\n+### Mutable setter\n+\n+`mutator()` is the mutable alternative to `setter()`. It returns a\n+function, which when called, mutates given object / array at given path\n+location and bails if any intermediate path values are non-indexable\n+(only the very last path element can be missing in the actual object\n+structure). If successful, returns original (mutated) object, else\n+`undefined`. This function too provides optimized versions for path\n+lengths <= 4.\n+\n+As with `setIn`, `mutIn` is the immediate use mutator, i.e. the same as:\n+`mutator(path)(state, val)`.\n+\n+```ts\n+mutIn({ a: { b: [10, 20] } }, \"a.b.1\", 23);\n+// or\n+mutIn({ a: { b: [10, 20] } }, [\"a\", \"b\", 1], 23);\n+// { a: { b: [ 10, 23 ] } }\n+\n+// fails (because of missing path structure in target object)\n+mutIn({}, \"a.b.c\", 23);\n+// undefined\n+```\n+\n## Authors\n- Karsten Schmidt\n",
"new_path": "packages/paths/README.md",
"old_path": "packages/paths/README.md"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
docs(paths): update readme
| 1
|
docs
|
paths
|
724,174
|
19.04.2018 01:43:53
| -32,400
|
9960f7c57e5f600418ae83e2e16f4f9b8829f45b
|
feat: allow mocks and methods to be set in config object
|
[
{
"change_type": "MODIFY",
"diff": "},\n\"rules\": {\n\"no-unused-vars\": 0,\n- \"no-undef\": 0\n+ \"no-undef\": 0,\n+ \"no-labels\": 0\n}\n}\n",
"new_path": "docs/.eslintrc",
"old_path": "docs/.eslintrc"
},
{
"change_type": "MODIFY",
"diff": "@@ -24,3 +24,39 @@ import VueTestUtils from '@vue/test-utils'\nVueTestUtils.config.stubs['my-component'] = '<div />'\n```\n+\n+### `mocks`\n+\n+- type: `Object`\n+- default: `{}`\n+\n+Like `stubs`, the values passed to `config.mocks` are used by default. Any values passed to the mounting options `mocks` object will take priority over the ones declared in `config.mocks`.\n+\n+Example:\n+\n+```js\n+import VueTestUtils from '@vue/test-utils'\n+\n+VueTestUtils.config.mocks['$store'] = {\n+ state: {\n+ id: 1\n+ }\n+}\n+```\n+\n+### `methods`\n+\n+- type: `Object`\n+- default: `{}`\n+\n+You can configure default methods using the `config` object. This can be useful for plugins that inject methods to components, like [VeeValidate](https://vee-validate.logaretm.com/). You can override methods set in `config` by passing `methods` in the mounting options.\n+\n+Example:\n+\n+```js\n+import VueTestUtils from '@vue/test-utils'\n+\n+VueTestUtils.config.methods['errors'] = () => {\n+ any: () => false\n+}\n+```\n",
"new_path": "docs/en/api/config.md",
"old_path": "docs/en/api/config.md"
},
{
"change_type": "MODIFY",
"diff": "declare type Options = { // eslint-disable-line no-undef\nattachToDocument?: boolean,\nmocks?: Object,\n+ methods?: Object,\nslots?: Object,\nscopedSlots?: Object,\nlocalVue?: Component,\n",
"new_path": "flow/options.flow.js",
"old_path": "flow/options.flow.js"
},
{
"change_type": "MODIFY",
"diff": "// @flow\n-function getStubs (optionStubs, config) {\n- if (optionStubs ||\n- (config.stubs && Object.keys(config.stubs).length > 0)) {\n- if (Array.isArray(optionStubs)) {\n+function getOptions (key, options, config) {\n+ if (options ||\n+ (config[key] && Object.keys(config[key]).length > 0)) {\n+ if (Array.isArray(options)) {\nreturn [\n- ...optionStubs,\n- ...Object.keys(config.stubs || {})]\n+ ...options,\n+ ...Object.keys(config[key] || {})]\n} else {\nreturn {\n- ...config.stubs,\n- ...optionStubs\n+ ...config[key],\n+ ...options\n}\n}\n}\n@@ -22,6 +22,9 @@ export function mergeOptions (\n): Options {\nreturn {\n...options,\n- stubs: getStubs(options.stubs, config)\n+ stubs: getOptions('stubs', options.stubs, config),\n+ mocks: getOptions('mocks', options.mocks, config),\n+ methods: getOptions('methods', options.methods, config)\n}\n}\n+\n",
"new_path": "packages/shared/merge-options.js",
"old_path": "packages/shared/merge-options.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -5,5 +5,7 @@ export default {\nstubs: {\ntransition: TransitionStub,\n'transition-group': TransitionGroupStub\n- }\n+ },\n+ mocks: {},\n+ methods: {}\n}\n",
"new_path": "packages/test-utils/src/config.js",
"old_path": "packages/test-utils/src/config.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -2,7 +2,8 @@ import {\nmount,\nconfig,\nTransitionStub,\n- TransitionGroupStub\n+ TransitionGroupStub,\n+ createLocalVue\n} from '~vue/test-utils'\ndescribe('config', () => {\n@@ -33,6 +34,44 @@ describe('config', () => {\nexpect(wrapper.contains(TransitionGroupStub)).to.equal(true)\n})\n+ it('mocks a global variable', () => {\n+ const localVue = createLocalVue()\n+ const t = 'real value'\n+ localVue.prototype.$t = t\n+\n+ const testComponent = {\n+ template: `\n+ <div>{{ $t }}</div>\n+ `\n+ }\n+\n+ config.mocks['$t'] = 'mock value'\n+\n+ const wrapper = mount(testComponent, {\n+ localVue, t\n+ })\n+\n+ expect(wrapper.vm.$t).to.equal('mock value')\n+ expect(wrapper.text()).to.equal('mock value')\n+\n+ localVue.prototype.$t = undefined\n+ })\n+\n+ it('overrides a method', () => {\n+ const testComponent = {\n+ template: `\n+ <div>{{ val() }}</div>\n+ `\n+ }\n+\n+ config.methods['val'] = () => 'method'\n+\n+ const wrapper = mount(testComponent)\n+\n+ expect(wrapper.vm.val()).to.equal('method')\n+ expect(wrapper.text()).to.equal('method')\n+ })\n+\nit('doesn\\'t stub transition when config.stubs.transition is set to false', () => {\nconst testComponent = {\ntemplate: `\n",
"new_path": "test/specs/config.spec.js",
"old_path": "test/specs/config.spec.js"
},
{
"change_type": "ADD",
"diff": "+import { config } from '~vue/test-utils'\n+import {\n+ describeWithMountingMethods\n+} from '~resources/utils'\n+\n+describeWithMountingMethods('options.methods', (mountingMethod) => {\n+ it('prioritize mounting options over config', () => {\n+ config.methods['val'] = () => 'methodFromConfig'\n+\n+ const TestComponent = {\n+ template: `\n+ <div>{{ val() }}</div>\n+ `\n+ }\n+\n+ const wrapper = mountingMethod(TestComponent, {\n+ methods: {\n+ val () {\n+ return 'methodFromOptions'\n+ }\n+ }\n+ })\n+ const HTML = mountingMethod.name === 'renderToString'\n+ ? wrapper\n+ : wrapper.html()\n+ console.log(wrapper)\n+ expect(HTML).to.contain('methodFromOptions')\n+ })\n+})\n",
"new_path": "test/specs/mounting-options/methods.spec.js",
"old_path": null
},
{
"change_type": "MODIFY",
"diff": "-import { createLocalVue } from '~vue/test-utils'\n+import { createLocalVue, config } from '~vue/test-utils'\nimport Component from '~resources/components/component.vue'\nimport ComponentWithVuex from '~resources/components/component-with-vuex.vue'\nimport {\n@@ -7,6 +7,17 @@ import {\n} from '~resources/utils'\ndescribeWithMountingMethods('options.mocks', (mountingMethod) => {\n+ let configMocksSave\n+\n+ beforeEach(() => {\n+ configMocksSave = config.mocks\n+ config.mocks = {}\n+ })\n+\n+ afterEach(() => {\n+ config.mocks = configMocksSave\n+ })\n+\nit('adds variables to vm when passed', () => {\nconst TestComponent = {\ntemplate: `\n@@ -127,6 +138,27 @@ describeWithMountingMethods('options.mocks', (mountingMethod) => {\nerror.restore()\n})\n+ it('prioritize mounting options over config', () => {\n+ config.mocks['$global'] = 'globallyMockedValue'\n+\n+ const TestComponent = {\n+ template: `\n+ <div>{{ $global }}</div>\n+ `\n+ }\n+\n+ const wrapper = mountingMethod(TestComponent, {\n+ mocks: {\n+ '$global': 'locallyMockedValue'\n+ }\n+ })\n+ const HTML = mountingMethod.name === 'renderToString'\n+ ? wrapper\n+ : wrapper.html()\n+ console.log(wrapper)\n+ expect(HTML).to.contain('locallyMockedValue')\n+ })\n+\nit('logs that a property cannot be overwritten if there are problems writing', () => {\nconst error = sinon.stub(console, 'error')\nconst localVue = createLocalVue()\n",
"new_path": "test/specs/mounting-options/mocks.spec.js",
"old_path": "test/specs/mounting-options/mocks.spec.js"
}
] |
JavaScript
|
MIT License
|
vuejs/vue-test-utils
|
feat: allow mocks and methods to be set in config object (#531)
| 1
|
feat
| null |
791,690
|
19.04.2018 09:12:39
| 25,200
|
06a0a45b478565e6fa90636a41d440a41a40b74c
|
core(image-usage): use min of resourceSize/transferSize
|
[
{
"change_type": "MODIFY",
"diff": "@@ -79,14 +79,15 @@ class OptimizedImages extends Gatherer {\nconst isSameOrigin = URL.originsMatch(pageUrl, record._url);\nconst isBase64DataUri = /^data:.{2,40}base64\\s*,/.test(record._url);\n- if (isOptimizableImage && record._resourceSize > MINIMUM_IMAGE_SIZE) {\n+ const actualResourceSize = Math.min(record._resourceSize, record._transferSize);\n+ if (isOptimizableImage && actualResourceSize > MINIMUM_IMAGE_SIZE) {\nprev.push({\nisSameOrigin,\nisBase64DataUri,\nrequestId: record._requestId,\nurl: record._url,\nmimeType: record._mimeType,\n- resourceSize: record._resourceSize,\n+ resourceSize: actualResourceSize,\n});\n}\n",
"new_path": "lighthouse-core/gather/gatherers/dobetterweb/optimized-images.js",
"old_path": "lighthouse-core/gather/gatherers/dobetterweb/optimized-images.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -130,7 +130,7 @@ class ImageUsage extends Gatherer {\nif (/^image/.test(record._mimeType) && record.finished) {\nmap[record._url] = {\nurl: record.url,\n- resourceSize: record.resourceSize,\n+ resourceSize: Math.min(record.resourceSize, record.transferSize),\nstartTime: record.startTime,\nendTime: record.endTime,\nresponseReceivedTime: record.responseReceivedTime,\n",
"new_path": "lighthouse-core/gather/gatherers/image-usage.js",
"old_path": "lighthouse-core/gather/gatherers/image-usage.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -23,6 +23,7 @@ const traceData = {\n_url: 'http://google.com/image.jpg',\n_mimeType: 'image/jpeg',\n_resourceSize: 10000,\n+ _transferSize: 20000,\n_resourceType: {_name: 'image'},\nfinished: true,\n},\n@@ -30,6 +31,7 @@ const traceData = {\n_url: 'http://google.com/transparent.png',\n_mimeType: 'image/png',\n_resourceSize: 11000,\n+ _transferSize: 20000,\n_resourceType: {_name: 'image'},\nfinished: true,\n},\n@@ -37,6 +39,7 @@ const traceData = {\n_url: 'http://google.com/image.bmp',\n_mimeType: 'image/bmp',\n_resourceSize: 12000,\n+ _transferSize: 9000, // bitmap was compressed another way\n_resourceType: {_name: 'image'},\nfinished: true,\n},\n@@ -44,6 +47,7 @@ const traceData = {\n_url: 'http://google.com/image.bmp',\n_mimeType: 'image/bmp',\n_resourceSize: 12000,\n+ _transferSize: 20000,\n_resourceType: {_name: 'image'},\nfinished: true,\n},\n@@ -51,6 +55,7 @@ const traceData = {\n_url: 'http://google.com/vector.svg',\n_mimeType: 'image/svg+xml',\n_resourceSize: 13000,\n+ _transferSize: 20000,\n_resourceType: {_name: 'image'},\nfinished: true,\n},\n@@ -58,6 +63,7 @@ const traceData = {\n_url: 'http://gmail.com/image.jpg',\n_mimeType: 'image/jpeg',\n_resourceSize: 15000,\n+ _transferSize: 20000,\n_resourceType: {_name: 'image'},\nfinished: true,\n},\n@@ -66,6 +72,7 @@ const traceData = {\n_mimeType: 'image/jpeg',\n_resourceType: {_name: 'image'},\n_resourceSize: 14000,\n+ _transferSize: 20000,\nfinished: true,\n},\n{\n@@ -73,6 +80,7 @@ const traceData = {\n_mimeType: 'image/bmp',\n_resourceType: {_name: 'image'},\n_resourceSize: 12000,\n+ _transferSize: 20000,\nfinished: false, // ignore for not finishing\n},\n{\n@@ -80,6 +88,7 @@ const traceData = {\n_mimeType: 'image/bmp',\n_resourceType: {_name: 'document'}, // ignore for not really being an image\n_resourceSize: 12000,\n+ _transferSize: 20000,\nfinished: true,\n},\n],\n@@ -125,7 +134,7 @@ describe('Optimized images', () => {\nassert.equal(artifact.length, 4);\ncheckSizes(artifact[0], 10000, 60, 80);\ncheckSizes(artifact[1], 11000, 60, 80);\n- checkSizes(artifact[2], 12000, 60, 80);\n+ checkSizes(artifact[2], 9000, 60, 80);\n// skip cross-origin for now\n// checkSizes(artifact[3], 15000, 60, 80);\ncheckSizes(artifact[3], 20, 80, 100); // uses base64 data\n",
"new_path": "lighthouse-core/test/gather/gatherers/dobetterweb/optimized-images-test.js",
"old_path": "lighthouse-core/test/gather/gatherers/dobetterweb/optimized-images-test.js"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
core(image-usage): use min of resourceSize/transferSize (#4968)
| 1
|
core
|
image-usage
|
791,834
|
19.04.2018 12:49:13
| 25,200
|
d9450d5c63f7a1768fd4f0f2a1c6b7de11b21b18
|
core(tsc): add type checking to seo gatherers
|
[
{
"change_type": "MODIFY",
"diff": "@@ -9,11 +9,11 @@ const Gatherer = require('../gatherer');\nclass Canonical extends Gatherer {\n/**\n- * @param {{driver: !Object}} options Run options\n- * @return {!Promise<!Array<string>>} Href value of link[rel=canonical] node found in HEAD, or null\n+ * @param {LH.Gatherer.PassContext} passContext\n+ * @return {Promise<LH.Artifacts['Canonical']>}\n*/\n- afterPass(options) {\n- const driver = options.driver;\n+ afterPass(passContext) {\n+ const driver = passContext.driver;\nreturn driver.querySelectorAll('head link[rel=\"canonical\" i]')\n.then(nodes => Promise.all(nodes.map(node => node.getAttribute('href'))));\n",
"new_path": "lighthouse-core/gather/gatherers/seo/canonical.js",
"old_path": "lighthouse-core/gather/gatherers/seo/canonical.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -10,10 +10,10 @@ const DOMHelpers = require('../../../lib/dom-helpers.js');\nclass CrawlableLinks extends Gatherer {\n/**\n- * @param {{driver: !Object}} options Run options\n- * @return {!Promise<!Array<{href: string, text: string}>>}\n+ * @param {LH.Gatherer.PassContext} passContext\n+ * @return {Promise<LH.Artifacts['CrawlableLinks']>}\n*/\n- afterPass(options) {\n+ afterPass(passContext) {\nconst expression = `(function() {\n${DOMHelpers.getElementsInDocumentFnString}; // define function on page\nconst selector = 'a[href]:not([rel~=\"nofollow\"])';\n@@ -25,7 +25,7 @@ class CrawlableLinks extends Gatherer {\n}));\n})()`;\n- return options.driver.evaluateAsync(expression);\n+ return passContext.driver.evaluateAsync(expression);\n}\n}\n",
"new_path": "lighthouse-core/gather/gatherers/seo/crawlable-links.js",
"old_path": "lighthouse-core/gather/gatherers/seo/crawlable-links.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -10,10 +10,10 @@ const DOMHelpers = require('../../../lib/dom-helpers.js');\nclass EmbeddedContent extends Gatherer {\n/**\n- * @param {{driver: !Driver}} options Run options\n- * @return {!Promise<Array<{tagName: string, type: ?string, src: ?string, data: ?string, code: ?string, params: Array<{name: string, value: string}>}>>} All <object>s, <embed>s and <applet>s with list of relevant attributes and child properties\n+ * @param {LH.Gatherer.PassContext} passContext\n+ * @return {Promise<LH.Artifacts['EmbeddedContent']>}\n*/\n- afterPass(options) {\n+ afterPass(passContext) {\nconst expression = `(function() {\n${DOMHelpers.getElementsInDocumentFnString}; // define function on page\nconst selector = 'object, embed, applet';\n@@ -34,7 +34,7 @@ class EmbeddedContent extends Gatherer {\n}));\n})()`;\n- return options.driver.evaluateAsync(expression);\n+ return passContext.driver.evaluateAsync(expression);\n}\n}\n",
"new_path": "lighthouse-core/gather/gatherers/seo/embedded-content.js",
"old_path": "lighthouse-core/gather/gatherers/seo/embedded-content.js"
},
{
"change_type": "MODIFY",
"diff": "* Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n*/\n+// @ts-nocheck\n'use strict';\n/**\n@@ -23,8 +24,10 @@ const MINIMAL_LEGIBLE_FONT_SIZE_PX = 12;\nconst MAX_NODES_VISITED = 500;\nconst MAX_NODES_ANALYZED = 50;\n+const Driver = require('../../driver.js'); // eslint-disable-line no-unused-vars\n+\n/**\n- * @param {!Node} node\n+ * @param {LH.Artifacts.FontSize.DomNodeWithParent} node\n* @returns {boolean}\n*/\nfunction nodeInBody(node) {\n@@ -40,8 +43,8 @@ function nodeInBody(node) {\n/**\n* Get list of all nodes from the document body.\n*\n- * @param {!Object} driver\n- * @returns {!Array<!Node>}\n+ * @param {Driver} driver\n+ * @returns {Array<LH.Artifacts.FontSize.DomNodeWithParent>}\n*/\nfunction getAllNodesFromBody(driver) {\nreturn driver.getNodesInDocument()\n@@ -56,9 +59,9 @@ function getAllNodesFromBody(driver) {\n/**\n* Returns effective CSS rule for given CSS property\n*\n- * @param {!string} property CSS property name\n- * @param {!Node} node\n- * @param {!Object} matched CSS rules\n+ * @param {string} property CSS property name\n+ * @param {LH.Crdp.DOM.Node} node\n+ * @param {LH.Crdp.CSS.GetMatchedStylesForNodeResponse} matched CSS rules\n* @returns {WebInspector.CSSStyleDeclaration}\n*/\nfunction getEffectiveRule(property, node, {\n@@ -96,16 +99,16 @@ function getEffectiveRule(property, node, {\n}\n/**\n- * @param {!Node} node\n- * @returns {!number}\n+ * @param {LH.Crdp.DOM.Node} node\n+ * @returns {number}\n*/\nfunction getNodeTextLength(node) {\nreturn !node.nodeValue ? 0 : node.nodeValue.trim().length;\n}\n/**\n- * @param {!Object} driver\n- * @param {!Node} node text node\n+ * @param {Driver} driver\n+ * @param {LH.Crdp.DOM.Node} node text node\n* @returns {WebInspector.CSSStyleDeclaration}\n*/\nfunction getFontSizeSourceRule(driver, node) {\n@@ -114,9 +117,9 @@ function getFontSizeSourceRule(driver, node) {\n}\n/**\n- * @param {!Object} driver\n- * @param {!Node} node text node\n- * @returns {!{fontSize: number, textLength: number, node: Node}}\n+ * @param {Driver} driver\n+ * @param {LH.Artifacts.FontSize.DomNodeWithParent} node text node\n+ * @returns {Promise<?{fontSize: number, textLength: number, node: LH.Artifacts.FontSize.DomNodeWithParent}>}\n*/\nfunction getFontSizeInformation(driver, node) {\nreturn driver.sendCommand('CSS.getComputedStyleForNode', {nodeId: node.parentId})\n@@ -137,7 +140,7 @@ function getFontSizeInformation(driver, node) {\n}\n/**\n- * @param {Node} node\n+ * @param {LH.Artifacts.FontSize.DomNodeWithParent} node\n* @returns {boolean}\n*/\nfunction isNonEmptyTextNode(node) {\n@@ -148,23 +151,25 @@ function isNonEmptyTextNode(node) {\nclass FontSize extends Gatherer {\n/**\n- * @param {{driver: !Object}} options Run options\n+ * @param {LH.Gatherer.PassContext} passContext\n* @return {!Promise<{totalTextLength: number, failingTextLength: number, visitedTextLength: number, analyzedFailingTextLength: number, analyzedFailingNodesData: Array<{fontSize: number, textLength: number, node: Node, cssRule: SimplifiedStyleDeclaration}>}>} font-size analysis\n*/\n- afterPass(options) {\n+ afterPass(passContext) {\n+ /** @type {Map<string, LH.Crdp.CSS.CSSStyleSheetHeader>} */\nconst stylesheets = new Map();\n+ /** @param {LH.Crdp.CSS.StyleSheetAddedEvent} sheet */\nconst onStylesheetAdd = sheet => stylesheets.set(sheet.header.styleSheetId, sheet.header);\n- options.driver.on('CSS.styleSheetAdded', onStylesheetAdd);\n+ passContext.driver.on('CSS.styleSheetAdded', onStylesheetAdd);\n- const enableDOM = options.driver.sendCommand('DOM.enable');\n- const enableCSS = options.driver.sendCommand('CSS.enable');\n+ const enableDOM = passContext.driver.sendCommand('DOM.enable');\n+ const enableCSS = passContext.driver.sendCommand('CSS.enable');\nlet failingTextLength = 0;\nlet visitedTextLength = 0;\nlet totalTextLength = 0;\nreturn Promise.all([enableDOM, enableCSS])\n- .then(() => getAllNodesFromBody(options.driver))\n+ .then(() => getAllNodesFromBody(passContext.driver))\n.then(nodes => {\nconst textNodes = nodes.filter(isNonEmptyTextNode);\ntotalTextLength = textNodes.reduce((sum, node) => sum += getNodeTextLength(node), 0);\n@@ -175,7 +180,7 @@ class FontSize extends Gatherer {\nreturn nodesToVisit;\n})\n.then(textNodes =>\n- Promise.all(textNodes.map(node => getFontSizeInformation(options.driver, node))))\n+ Promise.all(textNodes.map(node => getFontSizeInformation(passContext.driver, node))))\n.then(fontSizeInfo => {\nconst visitedNodes = fontSizeInfo.filter(Boolean);\nvisitedTextLength = visitedNodes.reduce((sum, {textLength}) => sum += textLength, 0);\n@@ -187,7 +192,7 @@ class FontSize extends Gatherer {\n.sort((a, b) => b.textLength - a.textLength)\n.slice(0, MAX_NODES_ANALYZED)\n.map(info =>\n- getFontSizeSourceRule(options.driver, info.node)\n+ getFontSizeSourceRule(passContext.driver, info.node)\n.then(sourceRule => {\nif (sourceRule) {\ninfo.cssRule = {\n@@ -209,7 +214,7 @@ class FontSize extends Gatherer {\n);\n})\n.then(analyzedFailingNodesData => {\n- options.driver.off('CSS.styleSheetAdded', onStylesheetAdd);\n+ passContext.driver.off('CSS.styleSheetAdded', onStylesheetAdd);\nconst analyzedFailingTextLength = analyzedFailingNodesData\n.reduce((sum, {textLength}) => sum += textLength, 0);\n@@ -219,8 +224,8 @@ class FontSize extends Gatherer {\n.forEach(data => data.cssRule.stylesheet = stylesheets.get(data.cssRule.styleSheetId));\nreturn Promise.all([\n- options.driver.sendCommand('DOM.disable'),\n- options.driver.sendCommand('CSS.disable'),\n+ passContext.driver.sendCommand('DOM.disable'),\n+ passContext.driver.sendCommand('CSS.disable'),\n]).then(_ => ({\nanalyzedFailingNodesData,\nanalyzedFailingTextLength,\n",
"new_path": "lighthouse-core/gather/gatherers/seo/font-size.js",
"old_path": "lighthouse-core/gather/gatherers/seo/font-size.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -9,11 +9,11 @@ const Gatherer = require('../gatherer');\nclass Hreflang extends Gatherer {\n/**\n- * @param {{driver: !Object}} options Run options\n- * @return {!Promise<!Array<{href: string, hreflang: string}>>} Array with hreflang and href values of all link[rel=alternate] nodes found in HEAD\n+ * @param {LH.Gatherer.PassContext} passContext\n+ * @return {Promise<LH.Artifacts['Hreflang']>}\n*/\n- afterPass(options) {\n- const driver = options.driver;\n+ afterPass(passContext) {\n+ const driver = passContext.driver;\nreturn driver.querySelectorAll('head link[rel=\"alternate\" i][hreflang]')\n.then(nodes => Promise.all(nodes.map(node =>\n@@ -22,7 +22,10 @@ class Hreflang extends Gatherer {\n).then(attributeValues => attributeValues &&\nattributeValues.map(values => {\nconst [href, hreflang] = values;\n- return {href, hreflang};\n+ return {\n+ href: href || '',\n+ hreflang: hreflang || '',\n+ };\n})\n);\n}\n",
"new_path": "lighthouse-core/gather/gatherers/seo/hreflang.js",
"old_path": "lighthouse-core/gather/gatherers/seo/hreflang.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -9,11 +9,11 @@ const Gatherer = require('../gatherer');\nclass MetaDescription extends Gatherer {\n/**\n- * @param {{driver: !Object}} options Run options\n- * @return {!Promise<?string>} The value of the description meta's content attribute, or null\n+ * @param {LH.Gatherer.PassContext} passContext\n+ * @return {Promise<LH.Artifacts['MetaDescription']>}\n*/\n- afterPass(options) {\n- const driver = options.driver;\n+ afterPass(passContext) {\n+ const driver = passContext.driver;\nreturn driver.querySelector('head meta[name=\"description\" i]')\n.then(node => node && node.getAttribute('content'));\n",
"new_path": "lighthouse-core/gather/gatherers/seo/meta-description.js",
"old_path": "lighthouse-core/gather/gatherers/seo/meta-description.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -9,11 +9,11 @@ const Gatherer = require('../gatherer');\nclass MetaRobots extends Gatherer {\n/**\n- * @param {{driver: !Driver}} options Run options\n- * @return {!Promise<?string>} The value of the description meta's content attribute, or null\n+ * @param {LH.Gatherer.PassContext} passContext\n+ * @return {Promise<LH.Artifacts['MetaRobots']>}\n*/\n- afterPass(options) {\n- const driver = options.driver;\n+ afterPass(passContext) {\n+ const driver = passContext.driver;\nreturn driver.querySelector('head meta[name=\"robots\" i]')\n.then(node => node && node.getAttribute('content'));\n",
"new_path": "lighthouse-core/gather/gatherers/seo/meta-robots.js",
"old_path": "lighthouse-core/gather/gatherers/seo/meta-robots.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -9,28 +9,30 @@ const Gatherer = require('../gatherer');\n/* global fetch, URL, location */\n+/** @return {Promise<LH.Artifacts['RobotsTxt']>} */\n/* istanbul ignore next */\n-function getRobotsTxtContent() {\n- return fetch(new URL('/robots.txt', location.href))\n- .then(response => {\n+async function getRobotsTxtContent() {\n+ try {\n+ const response = await fetch(new URL('/robots.txt', location.href).href);\nif (!response.ok) {\nreturn {status: response.status, content: null};\n}\n- return response.text()\n- .then(content => ({status: response.status, content}));\n- })\n- .catch(_ => ({status: null, content: null}));\n+ const content = await response.text();\n+ return {status: response.status, content};\n+ } catch (_) {\n+ return {status: null, content: null};\n+ }\n}\nclass RobotsTxt extends Gatherer {\n/**\n- * @param {{driver: !Driver}} options Run options\n- * @return {!Promise<!{code: number, content: string}>}\n+ * @param {LH.Gatherer.PassContext} passContext\n+ * @return {Promise<LH.Artifacts['RobotsTxt']>}\n*/\n- afterPass(options) {\n- return options.driver.evaluateAsync(`(${getRobotsTxtContent.toString()}())`);\n+ afterPass(passContext) {\n+ return passContext.driver.evaluateAsync(`(${getRobotsTxtContent.toString()}())`);\n}\n}\n",
"new_path": "lighthouse-core/gather/gatherers/seo/robots-txt.js",
"old_path": "lighthouse-core/gather/gatherers/seo/robots-txt.js"
},
{
"change_type": "MODIFY",
"diff": "\"lighthouse-core/gather/computed/metrics/*.js\",\n\"lighthouse-core/gather/connections/**/*.js\",\n\"lighthouse-core/gather/gatherers/*.js\",\n+ \"lighthouse-core/gather/gatherers/seo/*.js\",\n\"lighthouse-core/scripts/*.js\",\n\"lighthouse-core/audits/seo/robots-txt.js\",\n\"./typings/*.d.ts\"\n",
"new_path": "tsconfig.json",
"old_path": "tsconfig.json"
},
{
"change_type": "MODIFY",
"diff": "@@ -20,13 +20,27 @@ declare global {\n// Remaining are provided by gatherers\nAccessibility: Artifacts.Accessibility;\nCacheContents: string[];\n+ /** Href values of link[rel=canonical] nodes found in HEAD (or null, if no href attribute). */\n+ Canonical: (string | null)[];\nChromeConsoleMessages: Crdp.Log.EntryAddedEvent[];\n+ /** The href and innerText of all non-nofollow anchors in the page. */\n+ CrawlableLinks: {href: string, text: string}[];\nCSSUsage: {rules: Crdp.CSS.RuleUsage[], stylesheets: Artifacts.CSSStyleSheetInfo[]};\n+ /** Relevant attributes and child properties of all <object>s, <embed>s and <applet>s in the page. */\n+ EmbeddedContent: Artifacts.EmbeddedContentInfo[];\n+ FontSize: Artifacts.FontSize;\n+ /** The hreflang and href values of all link[rel=alternate] nodes found in HEAD. */\n+ Hreflang: {href: string, hreflang: string}[];\nHTMLWithoutJavaScript: {value: string};\nHTTPRedirect: {value: boolean};\nJsUsageArtifact: Crdp.Profiler.ScriptCoverage[];\nManifest: ReturnType<typeof parseManifest> | null;\n+ /** The value of the <meta name=\"description\">'s content attribute, or null. */\n+ MetaDescription: string|null;\n+ /** The value of the <meta name=\"robots\">'s content attribute, or null. */\n+ MetaRobots: string|null;\nOffline: number;\n+ /** Information on fetching and the content of the /robots.txt file. */\nRobotsTxt: {status: number|null, content: string|null};\nRuntimeExceptions: Crdp.Runtime.ExceptionThrownEvent[];\nScripts: Record<string, string>;\n@@ -60,6 +74,41 @@ declare global {\ncontent: string;\n}\n+ export interface EmbeddedContentInfo {\n+ tagName: string;\n+ type: string | null;\n+ src: string | null;\n+ data: string | null;\n+ code: string | null;\n+ params: {name: string; value: string}[];\n+ }\n+\n+ export interface FontSize {\n+ totalTextLength: number;\n+ failingTextLength: number;\n+ visitedTextLength: number;\n+ analyzedFailingTextLength: number;\n+ analyzedFailingNodesData: {\n+ fontSize: number;\n+ textLength: number;\n+ node: FontSize.DomNodeWithParent;\n+ cssRule: {\n+ type: string;\n+ range: {startLine: number, startColumn: number};\n+ parentRule: {origin: string, selectors: {text: string}[]};\n+ styleSheetId: string;\n+ stylesheet: Crdp.CSS.CSSStyleSheetHeader;\n+ }\n+ }\n+ }\n+\n+ export module FontSize {\n+ export interface DomNodeWithParent extends Crdp.DOM.Node {\n+ parentId: number;\n+ parentNode: DomNodeWithParent;\n+ }\n+ }\n+\nexport interface ViewportDimensions {\ninnerWidth: number;\ninnerHeight: number;\n",
"new_path": "typings/artifacts.d.ts",
"old_path": "typings/artifacts.d.ts"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
core(tsc): add type checking to seo gatherers (#4991)
| 1
|
core
|
tsc
|
791,690
|
19.04.2018 12:51:28
| 25,200
|
9b7b690d6caf62f27e36a8ad905492457e816de4
|
tests(smokehouse): increase timeout
|
[
{
"change_type": "MODIFY",
"diff": "@@ -108,7 +108,7 @@ async function runSmokehouse(smokes) {\n].join(' ');\n// The promise ensures we output immediately, even if the process errors\n- const p = execAsync(cmd, {timeout: 3 * 60 * 1000, encoding: 'utf8'})\n+ const p = execAsync(cmd, {timeout: 6 * 60 * 1000, encoding: 'utf8'})\n.then(cp => ({id: id, process: cp}))\n.catch(err => ({id: id, error: err}))\n.then(result => displaySmokehouseOutput(result));\n",
"new_path": "lighthouse-cli/test/smokehouse/run-smoke.js",
"old_path": "lighthouse-cli/test/smokehouse/run-smoke.js"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
tests(smokehouse): increase timeout (#4990)
| 1
|
tests
|
smokehouse
|
815,745
|
19.04.2018 13:21:25
| -10,800
|
d248545ef326fdf3ff6ecf6c3948177a3a40cb74
|
fix: rework outside click
|
[
{
"change_type": "MODIFY",
"diff": "@@ -125,7 +125,7 @@ import { distinctUntilChanged, debounceTime, switchMap } from 'rxjs/operators'\n<label>Custom search</label>\n---html,true\n- <ng-select #api [items]=\"cities\" [(ngModel)]=\"selectedCity\" bindLabel=\"name\" bindValue=\"name\">\n+ <ng-select #api [items]=\"cities\" [searchable]=\"false\" [(ngModel)]=\"selectedCity\" bindLabel=\"name\" bindValue=\"name\">\n<ng-template ng-header-tmp>\n<input style=\"width: 100%\" type=\"text\" (input)=\"api.filter($event.target.value)\" />\n</ng-template>\n",
"new_path": "demo/app/examples/custom-templates.component.ts",
"old_path": "demo/app/examples/custom-templates.component.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -16,8 +16,7 @@ import {\nChangeDetectionStrategy,\nAfterContentInit,\nOnInit,\n- OnChanges,\n- HostListener\n+ OnChanges\n} from '@angular/core';\nimport { NgOption } from './ng-select.types';\n@@ -25,6 +24,10 @@ import { NgSelectComponent, DropdownPosition } from './ng-select.component';\nimport { ItemsList } from './items-list';\nimport { WindowService } from './window.service';\nimport { VirtualScrollService } from './virtual-scroll.service';\n+import { fromEventPattern } from 'rxjs/observable/fromEventPattern';\n+import { DOCUMENT } from '@angular/platform-browser';\n+import { takeUntil } from 'rxjs/operators';\n+import { Subject } from 'rxjs/Subject';\nconst TOP_CSS_CLASS = 'ng-select-top';\nconst BOTTOM_CSS_CLASS = 'ng-select-bottom';\n@@ -67,7 +70,9 @@ export class NgDropdownPanelComponent implements OnInit, OnChanges, OnDestroy, A\n@ViewChild('scroll', { read: ElementRef }) scrollElementRef: ElementRef;\n@ViewChild('padding', { read: ElementRef }) paddingElementRef: ElementRef;\n+ private readonly _destroy$ = new Subject<void>();\nprivate _selectElement: HTMLElement;\n+ private _document: Document;\nprivate _previousStart: number;\nprivate _previousEnd: number;\nprivate _startupLoop = true;\n@@ -80,6 +85,7 @@ export class NgDropdownPanelComponent implements OnInit, OnChanges, OnDestroy, A\nconstructor(\n@Inject(forwardRef(() => NgSelectComponent)) _ngSelect: NgSelectComponent,\n+ @Inject(DOCUMENT) document: Document,\nprivate _renderer: Renderer2,\nprivate _elementRef: ElementRef,\nprivate _zone: NgZone,\n@@ -88,10 +94,14 @@ export class NgDropdownPanelComponent implements OnInit, OnChanges, OnDestroy, A\n) {\nthis._selectElement = _ngSelect.elementRef.nativeElement;\nthis._itemsList = _ngSelect.itemsList;\n+ this._document = document;\n}\nngOnInit() {\nthis._handleScroll();\n+ fromEventPattern((handler: any) => this._document.addEventListener('mousedown', handler, true))\n+ .pipe(takeUntil(this._destroy$))\n+ .subscribe(($event) => this._handleOutsideClick($event))\n}\nngOnChanges(changes: SimpleChanges) {\n@@ -103,6 +113,8 @@ export class NgDropdownPanelComponent implements OnInit, OnChanges, OnDestroy, A\nngOnDestroy() {\nthis._disposeDocumentResizeListener();\nthis._disposeScrollListener();\n+ this._destroy$.next();\n+ this._destroy$.complete();\nif (this.appendTo) {\nthis._renderer.removeChild(this._elementRef.nativeElement.parentNode, this._elementRef.nativeElement);\n}\n@@ -151,9 +163,17 @@ export class NgDropdownPanelComponent implements OnInit, OnChanges, OnDestroy, A\nel.scrollTop = d.childHeight * (d.itemsLength + 1);\n}\n- @HostListener('mousedown', ['$event'])\n- handleMousedown($event: MouseEvent) {\n- $event.preventDefault();\n+ private _handleOutsideClick($event: any) {\n+ if (this._selectElement.contains($event.target)) {\n+ return;\n+ }\n+\n+ const dropdown: HTMLElement = this._elementRef.nativeElement;\n+ if (dropdown.contains($event.target)) {\n+ return;\n+ }\n+\n+ this.outsideClick.emit();\n}\nprivate _handleScroll() {\n",
"new_path": "src/ng-select/ng-dropdown-panel.component.ts",
"old_path": "src/ng-select/ng-dropdown-panel.component.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -1139,12 +1139,14 @@ describe('NgSelectComponent', function () {\nselect = fixture.componentInstance.select;\n});\n- it('should close dropdown on input blur', fakeAsync(() => {\n+ it('should close dropdown if opened and clicked outside dropdown container', fakeAsync(() => {\ntriggerKeyDownEvent(getNgSelectElement(fixture), KeyCode.Space);\n- expect(select.isOpen).toBeTruthy();\n- select.onInputBlur();\n+ expect(fixture.componentInstance.select.isOpen).toBeTruthy();\n+ document.getElementById('outside').click();\n+ let event = new MouseEvent('mousedown', {bubbles: true});\n+ document.getElementById('outside').dispatchEvent(event);\ntickAndDetectChanges(fixture);\n- expect(select.isOpen).toBeFalsy();\n+ expect(fixture.componentInstance.select.isOpen).toBeFalsy();\n}));\nit('should prevent dropdown close if clicked on select', fakeAsync(() => {\n",
"new_path": "src/ng-select/ng-select.component.spec.ts",
"old_path": "src/ng-select/ng-select.component.spec.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -140,7 +140,7 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\n@HostBinding('class.ng-select-opened') isOpen = false;\n@HostBinding('class.ng-select-disabled') isDisabled = false;\n- @HostBinding('class.ng-select-filtered') get filtered() { return !!this.filterValue };\n+ @HostBinding('class.ng-select-filtered') get filtered() { return !!this.filterValue && this.searchable };\nitemsList = new ItemsList(this);\nviewPortItems: NgOption[] = [];\n@@ -365,7 +365,7 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\nthis._zone.runOutsideAngular(() => {\nthis._window.setTimeout(() => {\nthis.filterInput.nativeElement.focus();\n- }, 0);\n+ }, 5);\n});\n}\n@@ -415,9 +415,6 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\n}\nfilter(term: string) {\n- if (!this.searchable) {\n- return;\n- }\nthis.filterValue = term;\nthis.open();\n@@ -437,8 +434,7 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\nonInputBlur() {\n(<HTMLElement>this.elementRef.nativeElement).classList.remove('ng-select-focused');\nthis.blurEvent.emit(null);\n- this.close();\n- if (!this.isDisabled) {\n+ if (!this.isOpen && !this.isDisabled) {\nthis._onTouched();\n}\n}\n",
"new_path": "src/ng-select/ng-select.component.ts",
"old_path": "src/ng-select/ng-select.component.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -152,14 +152,6 @@ $color-selected: #f5faff;\n}\n}\n}\n- .ng-dropdown-header {\n- border-bottom: 1px solid #ccc;\n- padding: 5px 7px;\n- }\n- .ng-dropdown-footer {\n- border-top: 1px solid #ccc;\n- padding: 5px 7px;\n- }\n}\n.ng-dropdown-panel {\n@@ -196,6 +188,14 @@ $color-selected: #f5faff;\n}\n}\n}\n+ .ng-dropdown-header {\n+ border-bottom: 1px solid #ccc;\n+ padding: 5px 7px;\n+ }\n+ .ng-dropdown-footer {\n+ border-top: 1px solid #ccc;\n+ padding: 5px 7px;\n+ }\n.ng-dropdown-panel-items {\nmargin-bottom: 1px;\n.ng-optgroup {\n",
"new_path": "src/themes/default.theme.scss",
"old_path": "src/themes/default.theme.scss"
},
{
"change_type": "MODIFY",
"diff": "@@ -119,7 +119,6 @@ $highlight-color: #3f51b5;\nline-height: 1.375em;\n}\n}\n-\n&.ng-has-value {\nalign-items: center;\n.ng-value-container {\n@@ -152,18 +151,6 @@ $highlight-color: #3f51b5;\n.ng-spinner-zone {\ntop: 3px;\n}\n- .ng-dropdown-header {\n- border-bottom: 1px solid rgba(0, 0, 0, .12);\n- padding: 0 16px;\n- line-height: 3em;\n- height: 3em;\n- }\n- .ng-dropdown-footer {\n- border-top: 1px solid rgba(0, 0, 0, .12);\n- padding: 0 16px;\n- line-height: 3em;\n- height: 3em;\n- }\n}\n.ng-dropdown-panel {\n@@ -186,7 +173,18 @@ $highlight-color: #3f51b5;\n}\n}\n}\n-\n+ .ng-dropdown-header {\n+ border-bottom: 1px solid rgba(0, 0, 0, .12);\n+ padding: 0 16px;\n+ line-height: 3em;\n+ height: 3em;\n+ }\n+ .ng-dropdown-footer {\n+ border-top: 1px solid rgba(0, 0, 0, .12);\n+ padding: 0 16px;\n+ line-height: 3em;\n+ height: 3em;\n+ }\n.ng-dropdown-panel-items {\n.ng-optgroup {\nuser-select: none;\n@@ -194,7 +192,6 @@ $highlight-color: #3f51b5;\nline-height: 3em;\nheight: 3em;\npadding: 0 16px;\n-\n&.ng-option-marked {\nbackground: rgba(0, 0, 0, .04);\ncolor: rgba(0, 0, 0, .87);\n@@ -207,7 +204,6 @@ $highlight-color: #3f51b5;\ncolor: $highlight-color;\n}\n}\n-\n.ng-option {\nline-height: 3em;\nheight: 3em;\n@@ -219,7 +215,6 @@ $highlight-color: #3f51b5;\ntext-decoration: none;\nposition: relative;\ncolor: rgba(0, 0, 0, .87);\n-\n&.ng-option-marked {\nbackground: rgba(0, 0, 0, .04);\ncolor: rgba(0, 0, 0, .87);\n@@ -234,7 +229,6 @@ $highlight-color: #3f51b5;\n&.ng-option-child {\npadding-left: 32px;\n}\n-\n.ng-tag-label {\npadding-right: 5px;\nfont-size: 80%;\n@@ -243,5 +237,4 @@ $highlight-color: #3f51b5;\n}\n}\n}\n-\n}\n",
"new_path": "src/themes/material.theme.scss",
"old_path": "src/themes/material.theme.scss"
}
] |
TypeScript
|
MIT License
|
ng-select/ng-select
|
fix: rework outside click
| 1
|
fix
| null |
815,745
|
19.04.2018 14:13:30
| -10,800
|
13907e691b6da1fe22d1c047a37139fa1d017b45
|
chore(release): 1.0.6
|
[
{
"change_type": "MODIFY",
"diff": "All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.\n+<a name=\"1.0.6\"></a>\n+## [1.0.6](https://github.com/ng-select/ng-select/compare/v1.0.5...v1.0.6) (2018-04-19)\n+\n+\n+### Bug Fixes\n+\n+* rework outside click ([d248545](https://github.com/ng-select/ng-select/commit/d248545))\n+\n+\n+\n<a name=\"1.0.5\"></a>\n## [1.0.5](https://github.com/ng-select/ng-select/compare/v1.0.4...v1.0.5) (2018-04-18)\n",
"new_path": "CHANGELOG.md",
"old_path": "CHANGELOG.md"
},
{
"change_type": "MODIFY",
"diff": "{\n\"$schema\": \"../node_modules/ng-packagr/package.schema.json\",\n\"name\": \"@ng-select/ng-select\",\n- \"version\": \"1.0.5\",\n+ \"version\": \"1.0.6\",\n\"description\": \"Angular ng-select - All in One UI Select, Multiselect and Autocomplete\",\n\"author\": \"@ng-select/ng-select\",\n\"license\": \"MIT\",\n",
"new_path": "src/package.json",
"old_path": "src/package.json"
}
] |
TypeScript
|
MIT License
|
ng-select/ng-select
|
chore(release): 1.0.6
| 1
|
chore
|
release
|
791,723
|
19.04.2018 17:20:45
| 25,200
|
8ae7e4812a4748a1654ed5a9e599fca02eb7712a
|
tests: split up parallel smoketests into 2 batches
|
[
{
"change_type": "MODIFY",
"diff": "@@ -28,34 +28,42 @@ const SMOKETESTS = [{\nid: 'ally',\nconfig: smokehouseDir + 'a11y/a11y-config.js',\nexpectations: 'a11y/expectations.js',\n+ batch: 'parallel-first',\n}, {\nid: 'pwa',\nexpectations: smokehouseDir + 'pwa-expectations.js',\nconfig: smokehouseDir + 'pwa-config.js',\n+ batch: 'parallel-second',\n}, {\nid: 'pwa2',\nexpectations: smokehouseDir + 'pwa2-expectations.js',\nconfig: smokehouseDir + 'pwa-config.js',\n+ batch: 'parallel-second',\n}, {\nid: 'pwa3',\nexpectations: smokehouseDir + 'pwa3-expectations.js',\nconfig: smokehouseDir + 'pwa-config.js',\n+ batch: 'parallel-first',\n}, {\nid: 'dbw',\nexpectations: 'dobetterweb/dbw-expectations.js',\nconfig: smokehouseDir + 'dbw-config.js',\n+ batch: 'parallel-second',\n}, {\nid: 'redirects',\nexpectations: 'redirects/expectations.js',\nconfig: smokehouseDir + 'redirects-config.js',\n+ batch: 'parallel-first',\n}, {\nid: 'seo',\nexpectations: 'seo/expectations.js',\nconfig: smokehouseDir + 'seo-config.js',\n+ batch: 'parallel-first',\n}, {\nid: 'offline',\nexpectations: 'offline-local/offline-expectations.js',\nconfig: smokehouseDir + 'offline-config.js',\n+ batch: 'parallel-second',\n}, {\nid: 'byte',\nexpectations: 'byte-efficiency/expectations.js',\n@@ -70,6 +78,7 @@ const SMOKETESTS = [{\nid: 'ttci',\nexpectations: 'tricky-ttci/expectations.js',\nconfig: 'lighthouse-core/config/default-config.js',\n+ batch: 'parallel-second',\n}];\n/**\n",
"new_path": "lighthouse-cli/test/smokehouse/run-smoke.js",
"old_path": "lighthouse-cli/test/smokehouse/run-smoke.js"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
tests: split up parallel smoketests into 2 batches (#4996)
| 1
|
tests
| null |
815,745
|
19.04.2018 17:40:20
| -10,800
|
8f14eba2596b93cdf830a081cd3c49e86a40e58b
|
feat: transfer classes to dropdown-panel
* feat: transfer classes to dropdown-panel
closes closes
|
[
{
"change_type": "MODIFY",
"diff": "(update)=\"viewPortItems = $event\"\n(scrollToEnd)=\"scrollToEnd.emit($event)\"\n(outsideClick)=\"close()\"\n- [ngClass]=\"{'multiple': multiple}\"\n+ [class.ng-select-multiple]=\"multiple\"\n+ [ngClass]=\"classes\"\n[id]=\"dropdownId\">\n<ng-container>\n",
"new_path": "src/ng-select/ng-select.component.html",
"old_path": "src/ng-select/ng-select.component.html"
},
{
"change_type": "MODIFY",
"diff": "@@ -26,6 +26,7 @@ import {\nQueryList,\nInjectionToken,\nNgZone,\n+ Attribute\n} from '@angular/core';\nimport {\n@@ -161,7 +162,9 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C\nthis.unselect(option);\n};\n- constructor(@Inject(NG_SELECT_DEFAULT_CONFIG) config: NgSelectConfig,\n+ constructor(\n+ @Inject(NG_SELECT_DEFAULT_CONFIG) config: NgSelectConfig,\n+ @Attribute('class') public classes: string,\nprivate _cd: ChangeDetectorRef,\nprivate _console: ConsoleService,\nprivate _zone: NgZone,\n",
"new_path": "src/ng-select/ng-select.component.ts",
"old_path": "src/ng-select/ng-select.component.ts"
}
] |
TypeScript
|
MIT License
|
ng-select/ng-select
|
feat: transfer classes to dropdown-panel (#486)
* feat: transfer classes to dropdown-panel
closes #434, closes #476
| 1
|
feat
| null |
217,922
|
19.04.2018 18:39:47
| -7,200
|
b7eb02c67a592b847defc873a6d25bdbe3ed0c46
|
style: nicer scrollbars (smaller and darker)
closes
|
[
{
"change_type": "MODIFY",
"diff": "@@ -6,6 +6,22 @@ body {\nmargin: 0;\nfont-family: Roboto, \"Helvetica Neue\", sans-serif;\n}\n+\n+// Let's have nicer scrollbars ! credits to angular/aio: https://github.com/angular/angular/blob/3a30f5d937e64289ad9a89a1cbc4bd66d8a8867a/aio/src/styles/2-modules/_scrollbar.scss\n+body::-webkit-scrollbar, mat-sidenav::-webkit-scrollbar, .mat-sidenav-content::-webkit-scrollbar {\n+ height: 6px;\n+ width: 6px;\n+}\n+\n+body::-webkit-scrollbar-track, mat-sidenav::-webkit-scrollbar-trac, .mat-sidenav-content::-webkit-scrollbar-trac {\n+ -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);\n+}\n+\n+body::-webkit-scrollbar-thumb, mat-sidenav::-webkit-scrollbar-thumb, .mat-sidenav-content::-webkit-scrollbar-thumb {\n+ background-color: #6e6e6e;\n+ outline: 1px solid #333;\n+}\n+\n//Dialog background darker opacity\n.cdk-overlay-dark-backdrop {\nbackground: rgba(0, 0, 0, 0.81);\n",
"new_path": "src/styles.scss",
"old_path": "src/styles.scss"
}
] |
TypeScript
|
MIT License
|
ffxiv-teamcraft/ffxiv-teamcraft
|
style: nicer scrollbars (smaller and darker)
closes #295
| 1
|
style
| null |
679,913
|
19.04.2018 22:30:46
| -3,600
|
87e3b48810181dfb78d10126c0e363819825b898
|
feat(interceptors): add EV_TOGGLE_VALUE handler, update EV_UNDO/REDO
add EV_TOGGLE_VALUE handler for boolean switches
extend EV_UNDO/REDO to trigger success/fail events post action
extract undoHelper() as shared impl
|
[
{
"change_type": "MODIFY",
"diff": "@@ -13,6 +13,7 @@ export type EffectPriority = [string, number];\nexport const EV_SET_VALUE = \"--set-value\";\nexport const EV_UPDATE_VALUE = \"--update-value\";\n+export const EV_TOGGLE_VALUE = \"--toggle-value\";\n// Built-in side effect ID constants\n",
"new_path": "packages/interceptors/src/api.ts",
"old_path": "packages/interceptors/src/api.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -568,25 +568,44 @@ export class EventBus extends StatelessEventBus implements\n* [EV_UPDATE_VALUE, [\"path.to.value\", (x, y) => x + y, 1]]\n* ```\n*\n+ * #### `EV_TOGGLE_VALUE`\n+ *\n+ * Negates a boolean state value at given path.\n+ *\n+ * Example event definition:\n+ * ```\n+ * [EV_TOGGLE_VALUE, \"path.to.value\"]\n+ * ```\n+ *\n* #### `EV_UNDO`\n*\n* Calls `ctx[id].undo()` and uses return value as new state.\n* Assumes `ctx[id]` is a @thi.ng/atom `History` instance, provided\n* via e.g. `processQueue({ history })`. The event can be triggered\n* with or without ID. By default `\"history\"` is used as default key\n- * to lookup the `History` instance.\n+ * to lookup the `History` instance. Furthermore, an additional\n+ * event can be triggered based on if a previous state has been\n+ * restored or not (basically, if the undo was successful). This is\n+ * useful for resetting/re-initializing stateful resources after a\n+ * successful undo action or to notify the user that no more undo's\n+ * are possible. The new event will be processed in the same frame\n+ * and has access to the (possibly) restored state. The event\n+ * structure for these options is shown below:\n*\n* ```\n* // using default ID\n* bus.dispatch([EV_UNDO]);\n*\n- * // using custom ID\n- * bus.dispatch([EV_UNDO, \"custom\"]);\n+ * // using custom history ID\n+ * bus.dispatch([EV_UNDO, [\"custom\"]]);\n+ *\n+ * // using custom ID and dispatch another event after undo\n+ * bus.dispatch([EV_UNDO, [\"custom\", [\"ev-undo-success\"], [\"ev-undo-fail\"]]]);\n* ```\n*\n* #### `EV_REDO`\n*\n- * Similar to `EV_UNDO`, but causes state redo.\n+ * Similar to `EV_UNDO`, but for redo actions.\n*\n* ### Side effects\n*\n@@ -603,22 +622,10 @@ export class EventBus extends StatelessEventBus implements\n({ [FX_STATE]: setIn(state, path, val) }),\n[api.EV_UPDATE_VALUE]: (state, [_, [path, fn, ...args]]) =>\n({ [FX_STATE]: updateIn(state, path, fn, ...args) }),\n- [api.EV_UNDO]: (_, [__, id = \"history\"], bus, ctx) => {\n- if (implementsFunction(ctx[id], \"undo\")) {\n- ctx[id].undo();\n- return { [FX_STATE]: bus.state.deref() };\n- } else {\n- console.warn(\"no history in context\");\n- }\n- },\n- [api.EV_REDO]: (_, [__, id = \"history\"], bus, ctx) => {\n- if (implementsFunction(ctx[id], \"redo\")) {\n- ctx[id].redo();\n- return { [FX_STATE]: bus.state.deref() };\n- } else {\n- console.warn(\"no history in context\");\n- }\n- }\n+ [api.EV_TOGGLE_VALUE]: (state, [_, [path]]) =>\n+ ({ [FX_STATE]: updateIn(state, path, (x) => !x) }),\n+ [api.EV_UNDO]: undoHandler(\"undo\"),\n+ [api.EV_REDO]: undoHandler(\"redo\"),\n});\n// effects\n@@ -665,6 +672,22 @@ export class EventBus extends StatelessEventBus implements\n}\n}\n-function asInterceptor(i: api.Interceptor | api.InterceptorFn) {\n- return isFunction(i) ? { pre: i } : i;\n+const asInterceptor = (i: api.Interceptor | api.InterceptorFn) =>\n+ isFunction(i) ? { pre: i } : i;\n+\n+const undoHandler = (action: string) =>\n+ (_, [__, ev], bus, ctx) => {\n+ let id = ev ? ev[0] : \"history\";\n+ if (implementsFunction(ctx[id], action)) {\n+ const ok = ctx[id][action]();\n+ return {\n+ [FX_STATE]: bus.state.deref(),\n+ [FX_DISPATCH_NOW]: ev ?\n+ ok !== undefined ? ev[1] : ev[2] :\n+ undefined,\n+ };\n+ } else {\n+ console.warn(\"no history in context\");\n}\n+ };\n+\n",
"new_path": "packages/interceptors/src/event-bus.ts",
"old_path": "packages/interceptors/src/event-bus.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
feat(interceptors): add EV_TOGGLE_VALUE handler, update EV_UNDO/REDO
- add EV_TOGGLE_VALUE handler for boolean switches
- extend EV_UNDO/REDO to trigger success/fail events post action
- extract undoHelper() as shared impl
| 1
|
feat
|
interceptors
|
217,922
|
19.04.2018 23:12:56
| -7,200
|
91077ac69395ca9ed90a51f9b9e2fb3aec29ef3c
|
chore: first wiki pass with scrollspy activated
Still needs some tweak for visual and functional aspect but it's almost done ;)
|
[
{
"change_type": "MODIFY",
"diff": "\"styles.scss\"\n],\n\"scripts\": [\n+ \"../node_modules/marked/lib/marked.js\"\n],\n\"environmentSource\": \"environments/environment.ts\",\n\"environments\": {\n",
"new_path": ".angular-cli.json",
"old_path": ".angular-cli.json"
},
{
"change_type": "MODIFY",
"diff": "\"resolved\": \"https://registry.npmjs.org/@types/jwt-decode/-/jwt-decode-1.4.30.tgz\",\n\"integrity\": \"sha512-vmBy38tpxTDimkD+YP5i6gyvjD/sIVj8CNuTKjbDJ28LOkAisv0NDoKbfnSwRq+SYWza6bpie0C4lI7pkCbDIg==\"\n},\n+ \"@types/marked\": {\n+ \"version\": \"0.3.0\",\n+ \"resolved\": \"https://registry.npmjs.org/@types/marked/-/marked-0.3.0.tgz\",\n+ \"integrity\": \"sha512-CSf9YWJdX1DkTNu9zcNtdCcn6hkRtB5ILjbhRId4ZOQqx30fXmdecuaXhugQL6eyrhuXtaHJ7PHI+Vm7k9ZJjg==\"\n+ },\n\"@types/node\": {\n\"version\": \"6.0.101\",\n\"resolved\": \"https://registry.npmjs.org/@types/node/-/node-6.0.101.tgz\",\n\"integrity\": \"sha512-IQ7V3D6+kK1DArTqTBrnl3M+YgJZLw8ta8w3Q9xjR79HaJzMAoTbZ8TNzUTztrkCKPTqIstE2exdbs1FzsYLUw==\",\n\"dev\": true\n},\n+ \"@types/prismjs\": {\n+ \"version\": \"1.9.0\",\n+ \"resolved\": \"https://registry.npmjs.org/@types/prismjs/-/prismjs-1.9.0.tgz\",\n+ \"integrity\": \"sha512-zeh+xd2pcCvWm1XtWLR4v5pzZMybKeq6X8Q4cIZMMx8GmyKDUfJaOtw+JaONHUQt5ncKFXezl8QGIDQsSF5YfA==\"\n+ },\n\"@types/q\": {\n\"version\": \"0.0.32\",\n\"resolved\": \"https://registry.npmjs.org/@types/q/-/q-0.0.32.tgz\",\n\"integrity\": \"sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=\",\n\"dev\": true\n},\n+ \"clipboard\": {\n+ \"version\": \"2.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/clipboard/-/clipboard-2.0.0.tgz\",\n+ \"integrity\": \"sha512-gXzHBlzEVqCk2b8Wpkil89S0WSMAX7eZho2zANX+EEEa9LMutGe9ICU+wHRzsH7cCHaCbUzj900P+AXOM0FE3A==\",\n+ \"optional\": true,\n+ \"requires\": {\n+ \"good-listener\": \"1.2.2\",\n+ \"select\": \"1.1.2\",\n+ \"tiny-emitter\": \"2.0.2\"\n+ }\n+ },\n\"cliui\": {\n\"version\": \"3.2.0\",\n\"resolved\": \"https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz\",\n\"integrity\": \"sha1-3zrhmayt+31ECqrgsp4icrJOxhk=\",\n\"dev\": true\n},\n+ \"delegate\": {\n+ \"version\": \"3.2.0\",\n+ \"resolved\": \"https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz\",\n+ \"integrity\": \"sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw==\",\n+ \"optional\": true\n+ },\n\"delegates\": {\n\"version\": \"1.0.0\",\n\"resolved\": \"https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz\",\n\"minimatch\": \"3.0.4\"\n}\n},\n+ \"good-listener\": {\n+ \"version\": \"1.2.2\",\n+ \"resolved\": \"https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz\",\n+ \"integrity\": \"sha1-1TswzfkxPf+33JoNR3CWqm0UXFA=\",\n+ \"optional\": true,\n+ \"requires\": {\n+ \"delegate\": \"3.2.0\"\n+ }\n+ },\n\"graceful-fs\": {\n\"version\": \"4.1.11\",\n\"resolved\": \"https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz\",\n\"object-visit\": \"1.0.1\"\n}\n},\n+ \"marked\": {\n+ \"version\": \"0.3.19\",\n+ \"resolved\": \"https://registry.npmjs.org/marked/-/marked-0.3.19.tgz\",\n+ \"integrity\": \"sha512-ea2eGWOqNxPcXv8dyERdSr/6FmzvWwzjMxpfGB/sbMccXoct+xY+YukPD+QTUZwyvK7BZwcr4m21WBOW41pAkg==\"\n+ },\n\"md5.js\": {\n\"version\": \"1.3.4\",\n\"resolved\": \"https://registry.npmjs.org/md5.js/-/md5.js-1.3.4.tgz\",\n\"ngx-window-token\": \"0.0.4\"\n}\n},\n+ \"ngx-markdown\": {\n+ \"version\": \"1.5.2\",\n+ \"resolved\": \"https://registry.npmjs.org/ngx-markdown/-/ngx-markdown-1.5.2.tgz\",\n+ \"integrity\": \"sha1-nk+t/F+bNvpB2aAgB5Z2JvT06c0=\",\n+ \"requires\": {\n+ \"@types/marked\": \"0.3.0\",\n+ \"@types/prismjs\": \"1.9.0\",\n+ \"marked\": \"0.3.19\",\n+ \"prismjs\": \"1.14.0\"\n+ }\n+ },\n\"ngx-window-token\": {\n\"version\": \"0.0.4\",\n\"resolved\": \"https://registry.npmjs.org/ngx-window-token/-/ngx-window-token-0.0.4.tgz\",\n\"utila\": \"0.4.0\"\n}\n},\n+ \"prismjs\": {\n+ \"version\": \"1.14.0\",\n+ \"resolved\": \"https://registry.npmjs.org/prismjs/-/prismjs-1.14.0.tgz\",\n+ \"integrity\": \"sha512-sa2s4m60bXs+kU3jcuUwx3ZCrUH7o0kuqnOOINbODqlRrDB7KY8SRx+xR/D7nHLlgfDdG7zXbRO8wJ+su5Ls0A==\",\n+ \"requires\": {\n+ \"clipboard\": \"2.0.0\"\n+ }\n+ },\n\"process\": {\n\"version\": \"0.11.10\",\n\"resolved\": \"https://registry.npmjs.org/process/-/process-0.11.10.tgz\",\n}\n}\n},\n+ \"select\": {\n+ \"version\": \"1.1.2\",\n+ \"resolved\": \"https://registry.npmjs.org/select/-/select-1.1.2.tgz\",\n+ \"integrity\": \"sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0=\",\n+ \"optional\": true\n+ },\n\"select-hose\": {\n\"version\": \"2.0.0\",\n\"resolved\": \"https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz\",\n\"setimmediate\": \"1.0.5\"\n}\n},\n+ \"tiny-emitter\": {\n+ \"version\": \"2.0.2\",\n+ \"resolved\": \"https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.0.2.tgz\",\n+ \"integrity\": \"sha512-2NM0auVBGft5tee/OxP4PI3d8WItkDM+fPnaRAVo6xTDI2knbz9eC5ArWGqtGlYqiH3RU5yMpdyTTO7MguC4ow==\",\n+ \"optional\": true\n+ },\n\"tmp\": {\n\"version\": \"0.0.29\",\n\"resolved\": \"https://registry.npmjs.org/tmp/-/tmp-0.0.29.tgz\",\n",
"new_path": "package-lock.json",
"old_path": "package-lock.json"
},
{
"change_type": "MODIFY",
"diff": "\"jwt-decode\": \"^2.2.0\",\n\"ng-push\": \"^0.2.1\",\n\"ngx-clipboard\": \"10.0.0\",\n+ \"ngx-markdown\": \"^1.5.2\",\n\"rxjs\": \"^5.4.3\",\n\"semver\": \"^5.4.1\",\n\"web-animations-js\": \"^2.3.1\",\n",
"new_path": "package.json",
"old_path": "package.json"
},
{
"change_type": "MODIFY",
"diff": "matTooltip=\"{{'HOME_PAGE.Wiki' | translate}}\"\n[matTooltipDisabled]=\"!settings.compactSidebar\">\n<mat-icon matListIcon>find_in_page</mat-icon>\n- <span matLine *ngIf=\"!settings.compactSidebar\">{{'HOME_PAGE.Wiki' | translate}}</span>\n+ <span matLine *ngIf=\"!settings.compactSidebar\">{{'WIKI.Title' | translate}}</span>\n</mat-list-item>\n<mat-list-item routerLink=\"/about\" (click)=\"mobile ? sidenav.close() : null\"\nmatTooltipPosition=\"right\"\n",
"new_path": "src/app/app.component.html",
"old_path": "src/app/app.component.html"
},
{
"change_type": "MODIFY",
"diff": "@@ -26,6 +26,7 @@ import {OverlayContainer} from '@angular/cdk/overlay';\nimport {AnnouncementPopupComponent} from './modules/common-components/announcement-popup/announcement-popup.component';\nimport {Announcement} from './modules/common-components/announcement-popup/announcement';\nimport {PendingChangesService} from './core/database/pending-changes/pending-changes.service';\n+import {ScrollSpyService} from './pages/wiki/services/scroll-spy.service';\ndeclare const ga: Function;\n@@ -81,7 +82,8 @@ export class AppComponent implements OnInit {\nprivate push: PushNotificationsService,\noverlayContainer: OverlayContainer,\npublic cd: ChangeDetectorRef,\n- private pendingChangesService: PendingChangesService) {\n+ private pendingChangesService: PendingChangesService,\n+ private scrollSpy: ScrollSpyService) {\nsettings.themeChange$.subscribe(change => {\noverlayContainer.getContainerElement().classList.remove(`${change.previous}-theme`);\n",
"new_path": "src/app/app.component.ts",
"old_path": "src/app/app.component.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -56,6 +56,8 @@ import {CustomLinksModule} from './pages/custom-links/custom-links.module';\nimport {LinkModule} from './pages/link/link.module';\nimport {TemplateModule} from './pages/template/template.module';\nimport {AlarmsSidebarModule} from './modules/alarms-sidebar/alarms-sidebar.module';\n+import {MarkdownModule} from 'ngx-markdown';\n+import {WikiModule} from './pages/wiki/wiki.module';\nexport function HttpLoaderFactory(http: HttpClient) {\nreturn new TranslateHttpLoader(http);\n@@ -68,6 +70,8 @@ export function HttpLoaderFactory(http: HttpClient) {\nimports: [\nFlexLayoutModule,\n+ MarkdownModule.forRoot(),\n+\nTranslateModule.forRoot({\nloader: {\nprovide: TranslateLoader,\n@@ -123,6 +127,7 @@ export function HttpLoaderFactory(http: HttpClient) {\nProfileModule,\nCustomLinksModule,\nLinkModule,\n+ WikiModule,\nRecipesModule,\nListsModule,\nPublicListsModule,\n",
"new_path": "src/app/app.module.ts",
"old_path": "src/app/app.module.ts"
},
{
"change_type": "ADD",
"diff": "+export interface MarkdownSection {\n+ title: string;\n+ element: Element;\n+ active?: boolean;\n+}\n",
"new_path": "src/app/pages/wiki/markdown-section.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+import {Inject, Injectable} from '@angular/core';\n+import {DOCUMENT} from '@angular/common';\n+import {auditTime, distinctUntilChanged, takeUntil, tap} from 'rxjs/operators';\n+\n+import {ScrollService} from './scroll.service';\n+import {Observable} from 'rxjs/Observable';\n+import {ReplaySubject} from 'rxjs/ReplaySubject';\n+import {Subject} from 'rxjs/Subject';\n+import {fromEvent} from 'rxjs/observable/fromEvent';\n+import {CdkScrollable, ScrollDispatcher} from '@angular/cdk/scrolling';\n+\n+// https://github.com/angular/angular/blob/3a30f5d937e64289ad9a89a1cbc4bd66d8a8867a/aio/src/app/shared/scroll-spy.service.ts\n+\n+\n+export interface ScrollItem {\n+ element: Element;\n+ index: number;\n+}\n+\n+export interface ScrollSpyInfo {\n+ active: Observable<ScrollItem | null>;\n+ unspy: () => void;\n+}\n+\n+/*\n+ * Represents a \"scroll-spied\" element. Contains info and methods for determining whether this\n+ * element is the active one (i.e. whether it has been scrolled passed), based on the window's\n+ * scroll position.\n+ *\n+ * @prop {Element} element - The element whose position relative to the viewport is tracked.\n+ * @prop {number} index - The index of the element in the original list of element (group).\n+ * @prop {number} top - The `scrollTop` value at which this element becomes active.\n+ */\n+export class ScrollSpiedElement implements ScrollItem {\n+ top = 0;\n+\n+ /*\n+ * @constructor\n+ * @param {Element} element - The element whose position relative to the viewport is tracked.\n+ * @param {number} index - The index of the element in the original list of element (group).\n+ */\n+ constructor(public readonly element: Element, public readonly index: number) {\n+ }\n+\n+ /*\n+ * @method\n+ * Caclulate the `top` value, i.e. the value of the `scrollTop` property at which this element\n+ * becomes active. The current implementation assumes that window is the scroll-container.\n+ *\n+ * @param {number} scrollTop - How much is window currently scrolled (vertically).\n+ * @param {number} topOffset - The distance from the top at which the element becomes active.\n+ */\n+ calculateTop(scrollTop: number, topOffset: number) {\n+ this.top = scrollTop + this.element.getBoundingClientRect().top - topOffset;\n+ }\n+}\n+\n+/*\n+ * Represents a group of \"scroll-spied\" elements. Contains info and methods for efficiently\n+ * determining which element should be considered \"active\", i.e. which element has been scrolled\n+ * passed the top of the viewport.\n+ *\n+ * @prop {Observable<ScrollItem | null>} activeScrollItem - An observable that emits ScrollItem\n+ * elements (containing the HTML element and its original index) identifying the latest \"active\"\n+ * element from a list of elements.\n+ */\n+export class ScrollSpiedElementGroup {\n+ activeScrollItem: ReplaySubject<ScrollItem | null> = new ReplaySubject(1);\n+ private readonly spiedElements: ScrollSpiedElement[];\n+\n+ /*\n+ * @constructor\n+ * @param {Element[]} elements - A list of elements whose position relative to the viewport will\n+ * be tracked, in order to determine which one is \"active\" at any given moment.\n+ */\n+ constructor(elements: Element[]) {\n+ this.spiedElements = elements.map((elem, i) => new ScrollSpiedElement(elem, i));\n+ }\n+\n+ /*\n+ * @method\n+ * Caclulate the `top` value of each ScrollSpiedElement of this group (based on te current\n+ * `scrollTop` and `topOffset` values), so that the active element can be later determined just by\n+ * comparing its `top` property with the then current `scrollTop`.\n+ *\n+ * @param {number} scrollTop - How much is window currently scrolled (vertically).\n+ * @param {number} topOffset - The distance from the top at which the element becomes active.\n+ */\n+ calibrate(scrollTop: number, topOffset: number) {\n+ this.spiedElements.forEach(spiedElem => spiedElem.calculateTop(scrollTop, topOffset));\n+ this.spiedElements.sort((a, b) => b.top - a.top); // Sort in descending `top` order.\n+ }\n+\n+ /*\n+ * @method\n+ * Determine which element is the currently active one, i.e. the lower-most element that is\n+ * scrolled passed the top of the viewport (taking offsets into account) and emit it on\n+ * `activeScrollItem`.\n+ * If no element can be considered active, `null` is emitted instead.\n+ * If window is scrolled all the way to the bottom, then the lower-most element is considered\n+ * active even if it not scrolled passed the top of the viewport.\n+ *\n+ * @param {number} scrollTop - How much is window currently scrolled (vertically).\n+ * @param {number} maxScrollTop - The maximum possible `scrollTop` (based on the viewport size).\n+ */\n+ onScroll(scrollTop: number, maxScrollTop: number) {\n+ let activeItem: ScrollItem | undefined;\n+ if (scrollTop + 1 >= maxScrollTop) {\n+ activeItem = this.spiedElements[0];\n+ } else {\n+ this.spiedElements.some(spiedElem => {\n+ if (spiedElem.top <= scrollTop) {\n+ activeItem = spiedElem;\n+ return true;\n+ }\n+ return false;\n+ });\n+ }\n+\n+ this.activeScrollItem.next(activeItem || null);\n+ }\n+}\n+\n+@Injectable()\n+export class ScrollSpyService {\n+\n+ private spiedElementGroups: ScrollSpiedElementGroup[] = [];\n+ private onStopListening = new Subject();\n+ private resizeEvents = fromEvent(window, 'resize').pipe(auditTime(300), takeUntil(this.onStopListening));\n+ private scrollEvents: Observable<CdkScrollable>;\n+ private lastContentHeight: number;\n+ private lastMaxScrollTop: number;\n+\n+ private scrollTop: number;\n+\n+ constructor(@Inject(DOCUMENT) private doc: any, private scrollService: ScrollService, cdkScroll: ScrollDispatcher) {\n+ this.scrollEvents = cdkScroll.scrolled()\n+ .filter(scroll => scroll !== null)\n+ .map(scroll => <CdkScrollable>scroll)\n+ .filter(scroll => scroll.getElementRef().nativeElement.localName === 'mat-sidenav-content')\n+ .pipe(auditTime(10), takeUntil(this.onStopListening))\n+ .pipe(tap(scroll => this.scrollTop = scroll.getElementRef().nativeElement.scrollTop));\n+ }\n+\n+ /*\n+ * @method\n+ * Start tracking a group of elements and emitting active elements; i.e. elements that are\n+ * currently visible in the viewport. If there was no other group being spied, start listening for\n+ * `resize` and `scroll` events.\n+ *\n+ * @param {Element[]} elements - A list of elements to track.\n+ *\n+ * @return {ScrollSpyInfo} - An object containing the following properties:\n+ * - `active`: An observable of distinct ScrollItems.\n+ * - `unspy`: A method to stop tracking this group of elements.\n+ */\n+ spyOn(elements: Element[]): ScrollSpyInfo {\n+ if (!this.spiedElementGroups.length) {\n+ this.resizeEvents.subscribe(() => this.onResize());\n+ this.scrollEvents.subscribe((scroll) => this.onScroll(scroll));\n+ this.onResize();\n+ }\n+\n+ const scrollTop = this.getScrollTop();\n+ const topOffset = this.getTopOffset();\n+ const maxScrollTop = this.lastMaxScrollTop;\n+\n+ const spiedGroup = new ScrollSpiedElementGroup(elements);\n+ spiedGroup.calibrate(scrollTop, topOffset);\n+ spiedGroup.onScroll(scrollTop, maxScrollTop);\n+\n+ this.spiedElementGroups.push(spiedGroup);\n+\n+ return {\n+ active: spiedGroup.activeScrollItem.asObservable().pipe(distinctUntilChanged()),\n+ unspy: () => this.unspy(spiedGroup)\n+ };\n+ }\n+\n+ private getContentHeight() {\n+ return this.doc.body.scrollHeight || Number.MAX_SAFE_INTEGER;\n+ }\n+\n+ private getScrollTop() {\n+ return this.scrollTop || 0;\n+ }\n+\n+ private getTopOffset() {\n+ return this.scrollService.topOffset + 50;\n+ }\n+\n+ private getViewportHeight() {\n+ return this.doc.body.clientHeight || 0;\n+ }\n+\n+ /*\n+ * @method\n+ * The size of the window has changed. Re-calculate all affected values,\n+ * so that active elements can be determined efficiently on scroll.\n+ */\n+ private onResize() {\n+ const contentHeight = this.getContentHeight();\n+ const viewportHeight = this.getViewportHeight();\n+ const scrollTop = this.getScrollTop();\n+ const topOffset = this.getTopOffset();\n+\n+ this.lastContentHeight = contentHeight;\n+ this.lastMaxScrollTop = contentHeight - viewportHeight;\n+\n+ this.spiedElementGroups.forEach(group => group.calibrate(scrollTop, topOffset));\n+ }\n+\n+ /*\n+ * @method\n+ * Determine which element for each ScrollSpiedElementGroup is active. If the content height has\n+ * changed since last check, re-calculate all affected values first.\n+ */\n+ private onScroll(event: CdkScrollable) {\n+ if (this.lastContentHeight !== this.getContentHeight()) {\n+ // Something has caused the scroll height to change.\n+ // (E.g. image downloaded, accordion expanded/collapsed etc.)\n+ this.onResize();\n+ }\n+\n+ const scrollTop = event.getElementRef().nativeElement.scrollTop;\n+ const maxScrollTop = event.getElementRef().nativeElement.scrollHeight + event.getElementRef().nativeElement.offsetHeight;\n+ this.spiedElementGroups.forEach(group => group.onScroll(scrollTop, maxScrollTop));\n+ }\n+\n+ /*\n+ * @method\n+ * Stop tracking this group of elements and emitting active elements. If there is no other group\n+ * being spied, stop listening for `resize` or `scroll` events.\n+ *\n+ * @param {ScrollSpiedElementGroup} spiedGroup - The group to stop tracking.\n+ */\n+ private unspy(spiedGroup: ScrollSpiedElementGroup) {\n+ spiedGroup.activeScrollItem.complete();\n+ this.spiedElementGroups = this.spiedElementGroups.filter(group => group !== spiedGroup);\n+\n+ if (!this.spiedElementGroups.length) {\n+ this.onStopListening.next();\n+ }\n+ }\n+}\n",
"new_path": "src/app/pages/wiki/services/scroll-spy.service.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+import {Inject, Injectable} from '@angular/core';\n+import {DOCUMENT, PlatformLocation} from '@angular/common';\n+import {fromEvent} from 'rxjs/observable/fromEvent';\n+\n+// https://github.com/angular/angular/blob/master/aio/src/app/shared/scroll.service.ts\n+\n+export const topMargin = 16;\n+\n+/**\n+ * A service that scrolls document elements into view\n+ */\n+@Injectable()\n+export class ScrollService {\n+\n+ private _topOffset: number | null;\n+ private _topOfPageElement: Element;\n+\n+ // Offset from the top of the document to bottom of any static elements\n+ // at the top (e.g. toolbar) + some margin\n+ get topOffset() {\n+ if (!this._topOffset) {\n+ const toolbar = this.document.querySelector('.app-toolbar');\n+ this._topOffset = (toolbar && toolbar.clientHeight || 0) + topMargin;\n+ }\n+ return this._topOffset!;\n+ }\n+\n+ get topOfPageElement() {\n+ if (!this._topOfPageElement) {\n+ this._topOfPageElement = this.document.getElementById('top-of-page') || this.document.body;\n+ }\n+ return this._topOfPageElement;\n+ }\n+\n+ constructor(\n+ @Inject(DOCUMENT) private document: any,\n+ private location: PlatformLocation) {\n+ // On resize, the toolbar might change height, so \"invalidate\" the top offset.\n+ fromEvent(window, 'resize').subscribe(() => this._topOffset = null);\n+ }\n+\n+ /**\n+ * Scroll to the element with id extracted from the current location hash fragment.\n+ * Scroll to top if no hash.\n+ * Don't scroll if hash not found.\n+ */\n+ scroll() {\n+ const hash = this.getCurrentHash();\n+ const element: HTMLElement = hash\n+ ? this.document.getElementById(hash)\n+ : this.topOfPageElement;\n+ this.scrollToElement(element);\n+ }\n+\n+ /**\n+ * Scroll to the element.\n+ * Don't scroll if no element.\n+ */\n+ scrollToElement(element: Element | null) {\n+ if (element) {\n+ element.scrollIntoView();\n+\n+ if (window && window.scrollBy) {\n+ // Scroll as much as necessary to align the top of `element` at `topOffset`.\n+ // (Usually, `.top` will be 0, except for cases where the element cannot be scrolled all the\n+ // way to the top, because the viewport is larger than the height of the content after the\n+ // element.)\n+ window.scrollBy(0, element.getBoundingClientRect().top - this.topOffset);\n+\n+ // If we are very close to the top (<20px), then scroll all the way up.\n+ // (This can happen if `element` is at the top of the page, but has a small top-margin.)\n+ if (window.pageYOffset < 20) {\n+ window.scrollBy(0, -window.pageYOffset);\n+ }\n+ }\n+ }\n+ }\n+\n+ /** Scroll to the top of the document. */\n+ scrollToTop() {\n+ this.scrollToElement(this.topOfPageElement);\n+ }\n+\n+ /**\n+ * Return the hash fragment from the `PlatformLocation`, minus the leading `#`.\n+ */\n+ private getCurrentHash() {\n+ return decodeURIComponent(this.location.hash.replace(/^#/, ''));\n+ }\n+}\n",
"new_path": "src/app/pages/wiki/services/scroll.service.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+import {NgModule} from '@angular/core';\n+import {CommonModule} from '@angular/common';\n+import {WikiComponent} from './wiki/wiki.component';\n+import {RouterModule, Routes} from '@angular/router';\n+import {TranslateModule} from '@ngx-translate/core';\n+import {MarkdownModule} from 'ngx-markdown';\n+import {MatInputModule} from '@angular/material';\n+import {ScrollService} from './services/scroll.service';\n+import {ScrollSpyService} from 'app/pages/wiki/services/scroll-spy.service';\n+\n+const routes: Routes = [\n+ {\n+ path: 'wiki',\n+ redirectTo: 'wiki/home',\n+ pathMatch: 'full'\n+ },\n+ {\n+ path: 'wiki/:page',\n+ component: WikiComponent\n+ }\n+];\n+\n+@NgModule({\n+ imports: [\n+ CommonModule,\n+ RouterModule.forChild(routes),\n+\n+ MatInputModule,\n+\n+ TranslateModule,\n+ MarkdownModule.forChild(),\n+ ],\n+ declarations: [WikiComponent],\n+ providers: [\n+ ScrollService,\n+ ScrollSpyService,\n+ ]\n+})\n+export class WikiModule {\n+}\n",
"new_path": "src/app/pages/wiki/wiki.module.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+<h2 *ngIf=\"!notFound\">{{'WIKI.Title' | translate}}</h2>\n+<mat-error *ngIf=\"notFoundInCurrentLang && !notFound\">{{'WIKI.Not_found_in_current_lang' | translate}}</mat-error>\n+<h4 class=\"not-found\" *ngIf=\"notFound\">{{\"WIKI.Not_found\" | translate}}</h4>\n+<div class=\"wiki-container\" #markdown>\n+ <div markdown class=\"markdown\" (click)=\"interceptLinks($event)\" [data]=\"markdownContent | async\"></div>\n+ <div class=\"toc\">\n+ <ul>\n+ <li *ngFor=\"let row of tableOfContent | async\"\n+ (click)=\"scrollTo(row.element)\"\n+ [ngClass]=\"{'toc-active': row.active}\">{{row.title}}</li>\n+ </ul>\n+ </div>\n+</div>\n",
"new_path": "src/app/pages/wiki/wiki/wiki.component.html",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+.not-found {\n+ margin-top: 50px;\n+ text-align: center;\n+ font-size: 40px;\n+ opacity: 0.6;\n+}\n+\n+div.wiki-container {\n+ div.markdown {\n+ width: 70%;\n+ img {\n+ max-width: 100%;\n+ }\n+ blockquote {\n+ color: inherit;\n+ opacity: .7;\n+ }\n+ }\n+\n+ div.toc {\n+ width: 18%;\n+ position: fixed;\n+ top: 72px;\n+ right: 0;\n+ li {\n+ cursor: pointer;\n+ &.toc-active {\n+ color: red;\n+ }\n+ }\n+ }\n+}\n",
"new_path": "src/app/pages/wiki/wiki/wiki.component.scss",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+import {Component, ElementRef, OnInit, ViewChild, ViewEncapsulation} from '@angular/core';\n+import {TranslateService} from '@ngx-translate/core';\n+import {ActivatedRoute, Router} from '@angular/router';\n+import {Observable} from 'rxjs/Observable';\n+import {HttpClient} from '@angular/common/http';\n+import {BehaviorSubject} from 'rxjs/BehaviorSubject';\n+import {ScrollService} from '../services/scroll.service';\n+import {MarkdownSection} from '../markdown-section';\n+import {ScrollSpyInfo, ScrollSpyService} from '../services/scroll-spy.service';\n+import {ReplaySubject} from 'rxjs/ReplaySubject';\n+\n+@Component({\n+ selector: 'app-wiki',\n+ templateUrl: './wiki.component.html',\n+ styleUrls: ['./wiki.component.scss'],\n+ encapsulation: ViewEncapsulation.None,\n+})\n+export class WikiComponent implements OnInit {\n+\n+ private static readonly BASE_WIKI_PATH = '/assets/wiki';\n+\n+ @ViewChild('markdown')\n+ public markdownRef: ElementRef;\n+\n+ public notFound = false;\n+\n+ public notFoundInCurrentLang = false;\n+\n+ private readonly reloader$: BehaviorSubject<void> = new BehaviorSubject<void>(null);\n+\n+ private readonly tocReloader$: ReplaySubject<void> = new ReplaySubject<void>(1);\n+\n+ public markdownContent: Observable<string>;\n+\n+ public tableOfContent: Observable<MarkdownSection[]>;\n+\n+ private spyInfo: ScrollSpyInfo;\n+\n+ private activeSectionIndex = new ReplaySubject<number | null>(1);\n+\n+ constructor(private translator: TranslateService, private route: ActivatedRoute, private http: HttpClient, private router: Router,\n+ private scrollService: ScrollService, private scrollSpyService: ScrollSpyService) {\n+ translator.onLangChange.subscribe(() => {\n+ this.reloader$.next(null);\n+ this.tocReloader$.next(null);\n+ });\n+ this.activeSectionIndex.subscribe(console.log);\n+ }\n+\n+ interceptLinks(event: MouseEvent): void {\n+ if (event.srcElement.tagName === 'A' && event.srcElement.baseURI.indexOf('ffxivteamcraft.com') > -1) {\n+ // If that's an anchor, intercept the click and handle it properly with router\n+ event.preventDefault();\n+ this.router.navigateByUrl((<HTMLAnchorElement>event.srcElement).pathname);\n+ }\n+ }\n+\n+ scrollTo(element: Element): void {\n+ this.scrollService.scrollToElement(element);\n+ }\n+\n+ ngOnInit(): void {\n+ this.markdownContent =\n+ this.reloader$\n+ .mergeMap(() => this.route.params)\n+ .do(() => {\n+ this.notFoundInCurrentLang = false;\n+ this.notFound = false;\n+ })\n+ .map(params => params.page)\n+ .map(page => {\n+ return `${WikiComponent.BASE_WIKI_PATH}/${this.translator.currentLang}/${page}.md`\n+ })\n+ .mergeMap(markdownUrl => {\n+ return this.http.get(markdownUrl, {responseType: 'text'})\n+ .catch(() => {\n+ // If page isn't found, return the english one\n+ const englishUrl = markdownUrl.replace(`/${this.translator.currentLang}/`, '/en/');\n+ this.notFoundInCurrentLang = true;\n+ return this.http.get(englishUrl, {responseType: 'text'}).catch(() => {\n+ this.notFound = true;\n+ return Observable.of(null);\n+ });\n+ });\n+ })\n+ .filter(markdown => markdown !== null)\n+ .do(() => {\n+ this.tocReloader$.next(null);\n+ });\n+\n+ this.tableOfContent =\n+ this.tocReloader$\n+ .do(() => {\n+ if (this.spyInfo !== undefined) {\n+ this.spyInfo.unspy();\n+ delete this.spyInfo;\n+ }\n+ })\n+ .map(() => {\n+ const headings: NodeList = this.markdownRef.nativeElement.querySelectorAll('h1,h2,h3');\n+ return Object.keys(headings)\n+ .map(key => headings[key])\n+ .map(node => {\n+ return {\n+ title: node.innerText,\n+ element: node,\n+ active: false\n+ };\n+ });\n+ })\n+ .do((sections) => {\n+ this.spyInfo = this.scrollSpyService.spyOn(sections.map(section => section.element));\n+ this.spyInfo.active.subscribe(item => {\n+ this.activeSectionIndex.next(item && item.index)\n+ });\n+ })\n+ .mergeMap((sections) => {\n+ return this.spyInfo.active\n+ .filter(item => item !== null)\n+ .map((activeItem) => {\n+ sections.forEach((section, index) => {\n+ section.active = index === activeItem.index;\n+ });\n+ return sections;\n+ });\n+ });\n+ }\n+}\n",
"new_path": "src/app/pages/wiki/wiki/wiki.component.ts",
"old_path": null
},
{
"change_type": "MODIFY",
"diff": "4. Hit **Save**\n5. Do this for each class.\n-[Profile]:https://ffxivteamcraft.com/profile\n+[Profile]:/profile\n",
"new_path": "src/assets/wiki/en/books.md",
"old_path": "src/assets/wiki/en/books.md"
},
{
"change_type": "MODIFY",
"diff": "3. Congratulations you have created your list.\n4. Created lists can be found in **[Lists]** on the sidebar.\n-[Recipes]: https://ffxivteamcraft.com/recipes\n-[Lists]: https://ffxivteamcraft.com/lists\n+[Recipes]: /recipes\n+[Lists]: /lists\n",
"new_path": "src/assets/wiki/en/lists.md",
"old_path": "src/assets/wiki/en/lists.md"
}
] |
TypeScript
|
MIT License
|
ffxiv-teamcraft/ffxiv-teamcraft
|
chore: first wiki pass with scrollspy activated
Still needs some tweak for visual and functional aspect but it's almost done ;)
| 1
|
chore
| null |
730,429
|
20.04.2018 08:32:00
| 14,400
|
fa2a6cba9be251c038b5f65044d30dbf9a001462
|
chore(tooling): update github url to webex
|
[
{
"change_type": "MODIFY",
"diff": "@@ -45,7 +45,7 @@ ansiColor('xterm') {\nsshagent(['d8533977-c4c5-4e2b-938d-ae7fcbe27aac']) {\n// return the exit code because we don't care about failures\n- sh script: 'git remote add upstream git@github.com:ciscospark/react-ciscospark.git', returnStatus: true\n+ sh script: 'git remote add upstream git@github.com:webex/react-ciscospark.git', returnStatus: true\n// Make sure local tags don't include failed releases\nsh 'git tag -l | xargs git tag -d'\nsh 'git gc'\n",
"new_path": "Jenkinsfile",
"old_path": "Jenkinsfile"
},
{
"change_type": "MODIFY",
"diff": "@@ -11,7 +11,7 @@ ansiColor('xterm') {\nsshagent(['6c8a75fb-5e5f-4803-9b6d-1933a3111a34']) {\n// return the exit code because we don't care about failures\n- sh script: 'git remote add upstream git@github.com:ciscospark/react-ciscospark.git', returnStatus: true\n+ sh script: 'git remote add upstream git@github.com:webex/react-ciscospark.git', returnStatus: true\nsh 'git fetch upstream'\n}\n",
"new_path": "Jenkinsfile.jssdk",
"old_path": "Jenkinsfile.jssdk"
},
{
"change_type": "MODIFY",
"diff": "@@ -37,7 +37,7 @@ if [ -z $DRY_RUN ]; then\nif [ -z $BETA ]; then\n# Tag and push\ngit tag $VERSION\n- git push --tags git@github.com:ciscospark/react-ciscospark.git $VERSION\n+ git push --tags git@github.com:webex/react-ciscospark.git $VERSION\n# Cleanup\ngit checkout $SOURCE_DIR\n",
"new_path": "scripts/release.sh",
"old_path": "scripts/release.sh"
}
] |
JavaScript
|
MIT License
|
webex/react-widgets
|
chore(tooling): update github url to webex
| 1
|
chore
|
tooling
|
730,429
|
20.04.2018 08:32:25
| 14,400
|
ee4477792f53bb77355337430fe9a56826e5c32c
|
chore(demos): update github url to webex
|
[
{
"change_type": "MODIFY",
"diff": "@@ -207,7 +207,7 @@ class DemoWidget extends Component {\ntitle=\"Cisco Spark Widget Demo\"\n/>\n<CardText expandable>\n- Our widgets are built using <a href=\"https://github.com/facebook/react\">React</a>, <a href=\"https://github.com/reactjs/redux\">Redux</a>, and the <a href=\"https://github.com/ciscospark/spark-js-sdk\">Spark Javascript SDK </a>.\n+ Our widgets are built using <a href=\"https://github.com/facebook/react\">React</a>, <a href=\"https://github.com/reactjs/redux\">Redux</a>, and the <a href=\"https://github.com/webex/spark-js-sdk\">Spark Javascript SDK </a>.\n</CardText>\n</Card>\n<TokenInput onLogin={this.handleAccessTokenChange} token={this.state.accessToken} tokenType={this.state.accessTokenType} />\n",
"new_path": "packages/node_modules/@ciscospark/widget-demo/src/components/demo-widget/index.js",
"old_path": "packages/node_modules/@ciscospark/widget-demo/src/components/demo-widget/index.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -116,7 +116,7 @@ class DemoWidgetRecents extends Component {\nThis widget handles coordination between your application and the Spark APIs, and provides components of the Spark recents list experience without having to build all of the front end UI yourself.\n</p>\n<p>\n- Our widget is built using <a href=\"https://github.com/facebook/react\">React</a>, <a href=\"https://github.com/reactjs/redux\">Redux</a>, and the <a href=\"https://github.com/ciscospark/spark-js-sdk\">Spark Javascript SDK </a>.\n+ Our widget is built using <a href=\"https://github.com/facebook/react\">React</a>, <a href=\"https://github.com/reactjs/redux\">Redux</a>, and the <a href=\"https://github.com/webex/spark-js-sdk\">Spark Javascript SDK </a>.\n</p>\n</CardText>\n<CardActions expandable>\n",
"new_path": "packages/node_modules/@ciscospark/widget-recents-demo/src/components/demo-widget-recents/index.js",
"old_path": "packages/node_modules/@ciscospark/widget-recents-demo/src/components/demo-widget-recents/index.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -183,7 +183,7 @@ class DemoWidgetSpace extends Component {\n<CardText expandable>\nThis widget handles coordination between your application and the Spark APIs, and provides components of the Spark space experience without having to build all of the front end UI yourself.\n<br />\n- Our widget is built using <a href=\"https://github.com/facebook/react\">React</a>, <a href=\"https://github.com/reactjs/redux\">Redux</a>, and the <a href=\"https://github.com/ciscospark/spark-js-sdk\">Spark Javascript SDK </a>.\n+ Our widget is built using <a href=\"https://github.com/facebook/react\">React</a>, <a href=\"https://github.com/reactjs/redux\">Redux</a>, and the <a href=\"https://github.com/webex/spark-js-sdk\">Spark Javascript SDK </a>.\n</CardText>\n</Card>\n<TokenInput onLogin={this.handleAccessTokenChange} token={this.state.accessToken} />\n",
"new_path": "packages/node_modules/@ciscospark/widget-space-demo/src/components/demo-widget-space/index.js",
"old_path": "packages/node_modules/@ciscospark/widget-space-demo/src/components/demo-widget-space/index.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -153,7 +153,7 @@ describe('Widget Recents', () => {\n});\ndescribe('events', () => {\n- // https://github.com/ciscospark/react-ciscospark/blob/master/packages/node_modules/%40ciscospark/widget-recents/events.md\n+ // https://github.com/webex/react-ciscospark/blob/master/packages/node_modules/%40ciscospark/widget-recents/events.md\nit('messages:created', () => {\nclearEventLog(browserLocal);\nconst lorraineText = 'Don\\'t be such a square';\n",
"new_path": "test/journeys/specs/recents/global/basic.js",
"old_path": "test/journeys/specs/recents/global/basic.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -132,7 +132,7 @@ describe('Widget Recents', () => {\n});\ndescribe('events', () => {\n- // https://github.com/ciscospark/react-ciscospark/blob/master/packages/node_modules/%40ciscospark/widget-recents/events.md\n+ // https://github.com/webex/react-ciscospark/blob/master/packages/node_modules/%40ciscospark/widget-recents/events.md\nit('messages:created', () => {\nclearEventLog(browserLocal);\nconst lorraineText = 'Don\\'t be such a square';\n",
"new_path": "test/journeys/specs/tap/widget-recents/index.js",
"old_path": "test/journeys/specs/tap/widget-recents/index.js"
}
] |
JavaScript
|
MIT License
|
webex/react-widgets
|
chore(demos): update github url to webex
| 1
|
chore
|
demos
|
730,429
|
20.04.2018 09:37:45
| 14,400
|
88e19d92b378586974e8a59b7da7eff5c4cdc559
|
feat(widget-recents): remove call.answer and call.reject events
|
[
{
"change_type": "MODIFY",
"diff": "@@ -86,53 +86,9 @@ The user selected a room in the recents list or search results.\n}\n```\n-## rooms:selected (Answer Button)\n-\n-Incoming calls are presented to the end user in the recents widget. THis event fires when the user selects to answer the call.\n-\n-```javascript\n-{\n- resource: 'rooms',\n- event: 'selected',\n- action: 'call.answer',\n- call: [Call Object],\n- data: {\n- id: 'Y2lzY29zcGFyazovL3VzL1JPT00vYmJjZWIxYWQtNDNmMS0zYjU4LTkxNDctZjE0YmIwYzRkMTU0',\n- title: 'Project Unicorn - Sprint 0',\n- type: 'group',\n- isLocked: true,\n- teamId: 'Y2lzY29zcGFyazovL3VzL1JPT00vNjRlNDVhZTAtYzQ2Yi0xMWU1LTlkZjktMGQ0MWUzNDIxOTcz',\n- lastActivity: '2016-04-21T19:12:48.920Z',\n- created: '2016-04-21T19:01:55.966Z'\n- }\n-}\n-```\n-\n-## rooms:selected (Decline Button)\n-\n-Incoming calls are presented to the end user in the recents widget. This event fires when the user selects to decline the call.\n-\n-```javascript\n-{\n- resource: 'rooms',\n- event: 'selected',\n- action: 'call.reject',\n- call: [Call Object],\n- data: {\n- id: 'Y2lzY29zcGFyazovL3VzL1JPT00vYmJjZWIxYWQtNDNmMS0zYjU4LTkxNDctZjE0YmIwYzRkMTU0',\n- title: 'Project Unicorn - Sprint 0',\n- type: 'group',\n- isLocked: true,\n- teamId: 'Y2lzY29zcGFyazovL3VzL1JPT00vNjRlNDVhZTAtYzQ2Yi0xMWU1LTlkZjktMGQ0MWUzNDIxOTcz',\n- lastActivity: '2016-04-21T19:12:48.920Z',\n- created: '2016-04-21T19:01:55.966Z'\n- }\n-}\n-```\n-\n## rooms:selected (Call Button)\n-This event fires when the user selects the green call button next a space.\n+This event fires when the user selects the green call or (join call) button next a space.\n```javascript\n{\n",
"new_path": "packages/node_modules/@ciscospark/widget-recents/events.md",
"old_path": "packages/node_modules/@ciscospark/widget-recents/events.md"
},
{
"change_type": "MODIFY",
"diff": "@@ -6,8 +6,6 @@ export const eventNames = {\nSPACES_SELECTED: 'rooms:selected',\nMESSAGES_CREATED: 'messages:created',\nCALLS_CREATED: 'calls:created',\n- ACTION_CALL_ANSWER: 'call.answer',\n- ACTION_CALL_REJECT: 'call.reject',\nACTION_CALL: 'call',\nMEMBERSHIPS_CREATED: 'memberships:created',\nMEMBERSHIPS_DELETED: 'memberships:deleted'\n",
"new_path": "packages/node_modules/@ciscospark/widget-recents/src/events.js",
"old_path": "packages/node_modules/@ciscospark/widget-recents/src/events.js"
}
] |
JavaScript
|
MIT License
|
webex/react-widgets
|
feat(widget-recents): remove call.answer and call.reject events
| 1
|
feat
|
widget-recents
|
791,690
|
20.04.2018 11:08:08
| 25,200
|
70f9ecc497274e2d8e194030eb396a40f86b118f
|
cli: update documented throttling flags
|
[
{
"change_type": "MODIFY",
"diff": "@@ -76,7 +76,7 @@ instance with an open debugging port.\nLighthouse can run against a real mobile device. You can follow the [Remote Debugging on Android (Legacy Workflow)](https://developer.chrome.com/devtools/docs/remote-debugging-legacy) up through step 3.3, but the TL;DR is install & run adb, enable USB debugging, then port forward 9222 from the device to the machine with Lighthouse.\n-You'll likely want to use the CLI flags `--disable-device-emulation --disable-cpu-throttling` and potentially `--disable-network-throttling`.\n+You'll likely want to use the CLI flags `--disable-device-emulation --throttling.cpuSlowdownMultiplier`.\n```sh\n$ adb kill-server\n@@ -88,7 +88,7 @@ $ adb devices -l\n$ adb forward tcp:9222 localabstract:chrome_devtools_remote\n-$ lighthouse --port=9222 --disable-device-emulation --disable-cpu-throttling https://example.com\n+$ lighthouse --port=9222 --disable-device-emulation --throttling.cpuSlowdownMultiplier=1 https://example.com\n```\n## Lighthouse as trace processor\n",
"new_path": "docs/readme.md",
"old_path": "docs/readme.md"
},
{
"change_type": "MODIFY",
"diff": "@@ -49,8 +49,8 @@ Currently, `comcast` will also throttle the websocket port that Lighthouse uses\n# Enable system traffic throttling\ncomcast --latency=150 --target-bw=1600\n-# Run Lighthouse with it's own throttling disabled\n-lighthouse --disable-network-throttling # ...\n+# Run Lighthouse with its own throttling disabled\n+lighthouse --throttling.requestLatencyMs=0 --throttling.downloadThroughputKbps=0 --throttling.uploadThroughputKbps=0 # ...\n# Disable the traffic throttling once you see \"Retrieving trace\"\ncomcast --stop\n",
"new_path": "docs/throttling.md",
"old_path": "docs/throttling.md"
},
{
"change_type": "MODIFY",
"diff": "@@ -33,8 +33,8 @@ function getFlags(manualArgv) {\n'lighthouse <url> --output=json --output-path=./report.json --save-assets',\n'Save trace, screenshots, and named JSON report.')\n.example(\n- 'lighthouse <url> --disable-device-emulation --disable-network-throttling',\n- 'Disable device emulation')\n+ 'lighthouse <url> --disable-device-emulation --throttling-method=provided',\n+ 'Disable device emulation and all throttling')\n.example(\n'lighthouse <url> --chrome-flags=\"--window-size=412,732\"',\n'Launch Chrome with a specific window size')\n@@ -70,8 +70,13 @@ function getFlags(manualArgv) {\n'disable-storage-reset':\n'Disable clearing the browser cache and other storage APIs before a run',\n'disable-device-emulation': 'Disable Nexus 5X emulation',\n- 'disable-cpu-throttling': 'Disable CPU throttling',\n- 'disable-network-throttling': 'Disable network throttling',\n+ 'throttling-method': 'Controls throttling method',\n+ 'throttling.rttMs': 'Controls simulated network RTT (TCP layer)',\n+ 'throttling.throughputKbps': 'Controls simulated network download throughput',\n+ 'throttling.requestLatencyMs': 'Controls emulated network RTT (HTTP layer)',\n+ 'throttling.downloadThroughputKbps': 'Controls emulated network download throughput',\n+ 'throttling.uploadThroughputKbps': 'Controls emulated network upload throughput',\n+ 'throttling.cpuSlowdownMultiplier': 'Controls simulated + emulated CPU throttling',\n'gather-mode':\n'Collect artifacts from a connected browser and save to disk. (Artifacts folder path may optionally be provided). If audit-mode is not also enabled, the run will quit early.',\n'audit-mode': 'Process saved artifacts from disk. (Artifacts folder path may be provided, otherwise defaults to ./latest-run/)',\n@@ -111,12 +116,12 @@ function getFlags(manualArgv) {\n// boolean values\n.boolean([\n- 'disable-storage-reset', 'disable-device-emulation', 'disable-cpu-throttling',\n- 'disable-network-throttling', 'save-assets', 'list-all-audits',\n+ 'disable-storage-reset', 'disable-device-emulation', 'save-assets', 'list-all-audits',\n'list-trace-categories', 'perf', 'view', 'verbose', 'quiet', 'help',\n'mixed-content',\n])\n.choices('output', printer.getValidOutputOptions())\n+ .choices('throttling-method', ['devtools', 'provided', 'simulate'])\n// force as an array\n// note MUST use camelcase versions or only the kebab-case version will be forced\n.array('blockedUrlPatterns')\n",
"new_path": "lighthouse-cli/cli-flags.js",
"old_path": "lighthouse-cli/cli-flags.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -66,7 +66,7 @@ function runLighthouse(url, configPath, isDebug) {\nif (process.env.APPVEYOR) {\n// Appveyor is hella slow already, disable CPU throttling so we're not 16x slowdown\n// see https://github.com/GoogleChrome/lighthouse/issues/4891\n- args.push('--disable-cpu-throttling');\n+ args.push('--throttling.cpuSlowdownMultiplier=1');\n}\n// Lighthouse sometimes times out waiting to for a connection to Chrome in CI.\n",
"new_path": "lighthouse-cli/test/smokehouse/smokehouse.js",
"old_path": "lighthouse-cli/test/smokehouse/smokehouse.js"
},
{
"change_type": "MODIFY",
"diff": "\"devtools\": \"bash lighthouse-core/scripts/roll-to-devtools.sh\",\n\"compile-devtools\": \"bash lighthouse-core/scripts/compile-against-devtools.sh\",\n\"chrome\": \"node lighthouse-core/scripts/manual-chrome-launcher.js\",\n- \"fast\": \"yarn start --disable-device-emulation --disable-cpu-throttling --disable-network-throttling\",\n+ \"fast\": \"yarn start --disable-device-emulation --throttlingMethod=provided\",\n\"smokehouse\": \"node lighthouse-cli/test/smokehouse/smokehouse.js\",\n\"deploy-viewer\": \"cd lighthouse-viewer && gulp deploy\",\n\"bundlesize\": \"bundlesize\",\n",
"new_path": "package.json",
"old_path": "package.json"
},
{
"change_type": "MODIFY",
"diff": "@@ -43,8 +43,6 @@ node measure.js [options]\nLighthouse settings:\n--disable-device-emulation Disable Nexus 5X emulation [boolean]\n- --disable-cpu-throttling Disable CPU throttling [boolean]\n- --disable-network-throttling Disable network throttling [boolean]\nOptions to specify sites:\n--sites-path Include relative path of a json file with urls to run [default: \"sites.js\"]\n",
"new_path": "plots/README.md",
"old_path": "plots/README.md"
},
{
"change_type": "MODIFY",
"diff": "@@ -84,8 +84,13 @@ Options:\n--blocked-url-patterns Block any network requests to the specified URL patterns [array]\n--disable-storage-reset Disable clearing the browser cache and other storage APIs before a run [boolean]\n--disable-device-emulation Disable Nexus 5X emulation [boolean]\n- --disable-cpu-throttling Disable CPU throttling [boolean] [default: false]\n- --disable-network-throttling Disable network throttling [boolean]\n+ --throttling-method Controls throttling method [choices: \"devtools\", \"provided\", \"simulate\"]\n+ --throttling.rttMs Controls simulated network RTT (TCP layer)\n+ --throttling.throughputKbps Controls simulated network download throughput\n+ --throttling.requestLatencyMs Controls emulated network RTT (HTTP layer)\n+ --throttling.downloadThroughputKbps Controls emulated network download throughput\n+ --throttling.uploadThroughputKbps Controls emulated network upload throughput\n+ --throttling.cpuSlowdownMultiplier Controls simulated + emulated CPU throttling\n--extra-headers Set extra HTTP Headers to pass with request [string]\nExamples:\n@@ -93,7 +98,8 @@ Examples:\nlighthouse <url> --config-path=./myconfig.js Runs Lighthouse with your own configuration: custom audits, report\ngeneration, etc.\nlighthouse <url> --output=json --output-path=./report.json --save-assets Save trace, screenshots, and named JSON report.\n- lighthouse <url> --disable-device-emulation --disable-network-throttling Disable device emulation\n+ lighthouse <url> --disable-device-emulation Disable device emulation and all throttling.\n+ --throttling-method=provided\nlighthouse <url> --chrome-flags=\"--window-size=412,732\" Launch Chrome with a specific window size\nlighthouse <url> --quiet --chrome-flags=\"--headless\" Launch Headless Chrome, turn off logging\nlighthouse <url> --extra-headers \"{\\\"Cookie\\\":\\\"monster=blue\\\"}\" Stringify\\'d JSON HTTP Header key/value pairs to send in requests\n",
"new_path": "readme.md",
"old_path": "readme.md"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
cli: update documented throttling flags (#5000)
| 1
|
cli
| null |
791,690
|
20.04.2018 12:59:32
| 25,200
|
2eaafa0be4040916ad44d3241613f8e824380477
|
core(estimated-input-latency): use a 5s rolling window
|
[
{
"change_type": "MODIFY",
"diff": "@@ -10,6 +10,13 @@ const Util = require('../report/v2/renderer/util');\nconst TracingProcessor = require('../lib/traces/tracing-processor');\nconst LHError = require('../lib/errors');\n+const ROLLING_WINDOW_SIZE = 5000;\n+\n+/**\n+ * @fileOverview This audit determines the largest 90 percentile EQT value of all 5s windows between\n+ * FMP and the end of the trace.\n+ * @see https://docs.google.com/document/d/1b9slyaB9yho91YTOkAQfpCdULFkZM9LqsipcX3t7He8/preview\n+ */\nclass EstimatedInputLatency extends Audit {\n/**\n* @return {!AuditMeta}\n@@ -19,8 +26,7 @@ class EstimatedInputLatency extends Audit {\nname: 'estimated-input-latency',\ndescription: 'Estimated Input Latency',\nhelpText: 'The score above is an estimate of how long your app takes to respond to user ' +\n- 'input, in milliseconds. There is a 90% probability that a user encounters this amount ' +\n- 'of latency, or less. 10% of the time a user can expect additional latency. If your ' +\n+ 'input, in milliseconds, during the busiest 5s window of page load. If your ' +\n'latency is higher than 50 ms, users may perceive your app as laggy. ' +\n'[Learn more](https://developers.google.com/web/tools/lighthouse/audits/estimated-input-latency).',\nscoreDisplayMode: Audit.SCORING_MODES.NUMERIC,\n@@ -45,23 +51,36 @@ class EstimatedInputLatency extends Audit {\nthrow new LHError(LHError.errors.NO_FMP);\n}\n- const latencyPercentiles = TracingProcessor.getRiskToResponsiveness(tabTrace, startTime);\n- const ninetieth = latencyPercentiles.find(result => result.percentile === 0.9);\n- const rawValue = parseFloat(ninetieth.time.toFixed(1));\n+ const events = TracingProcessor.getMainThreadTopLevelEvents(tabTrace, startTime)\n+ .filter(evt => evt.duration >= 1);\n+\n+ const candidateStartEvts = events.filter(evt => evt.duration >= 10);\n+\n+ let worst90thPercentileLatency = 16;\n+ for (const startEvt of candidateStartEvts) {\n+ const latencyPercentiles = TracingProcessor.getRiskToResponsiveness(\n+ events,\n+ startEvt.start,\n+ startEvt.start + ROLLING_WINDOW_SIZE,\n+ [0.9]\n+ );\n+\n+ worst90thPercentileLatency = Math.max(\n+ latencyPercentiles[0].time,\n+ worst90thPercentileLatency\n+ );\n+ }\nconst score = Audit.computeLogNormalScore(\n- ninetieth.time,\n+ worst90thPercentileLatency,\ncontext.options.scorePODR,\ncontext.options.scoreMedian\n);\nreturn {\nscore,\n- rawValue,\n- displayValue: Util.formatMilliseconds(rawValue, 1),\n- extendedInfo: {\n- value: latencyPercentiles,\n- },\n+ rawValue: worst90thPercentileLatency,\n+ displayValue: Util.formatMilliseconds(worst90thPercentileLatency, 1),\n};\n}\n",
"new_path": "lighthouse-core/audits/estimated-input-latency.js",
"old_path": "lighthouse-core/audits/estimated-input-latency.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -84,42 +84,44 @@ class TraceProcessor {\n* Calculates the maximum queueing time (in ms) of high priority tasks for\n* selected percentiles within a window of the main thread.\n* @see https://docs.google.com/document/d/1b9slyaB9yho91YTOkAQfpCdULFkZM9LqsipcX3t7He8/preview\n- * @param {LH.Artifacts.TraceOfTab} tabTrace\n- * @param {number=} startTime Optional start time (in ms relative to navstart) of range of interest. Defaults to navstart.\n- * @param {number=} endTime Optional end time (in ms relative to navstart) of range of interest. Defaults to trace end.\n+ * @param {Array<ToplevelEvent>} events\n+ * @param {number} startTime Start time (in ms relative to navstart) of range of interest.\n+ * @param {number} endTime End time (in ms relative to navstart) of range of interest.\n* @param {!Array<number>=} percentiles Optional array of percentiles to compute. Defaults to [0.5, 0.75, 0.9, 0.99, 1].\n* @return {!Array<{percentile: number, time: number}>}\n*/\nstatic getRiskToResponsiveness(\n- tabTrace,\n- startTime = 0,\n- endTime = tabTrace.timings.traceEnd,\n+ events,\n+ startTime,\n+ endTime,\npercentiles = [0.5, 0.75, 0.9, 0.99, 1]\n) {\nconst totalTime = endTime - startTime;\npercentiles.sort((a, b) => a - b);\n- const ret = TraceProcessor.getMainThreadTopLevelEventDurations(tabTrace, startTime, endTime);\n+ const ret = TraceProcessor.getMainThreadTopLevelEventDurations(events, startTime, endTime);\nreturn TraceProcessor._riskPercentiles(ret.durations, totalTime, percentiles,\nret.clippedLength);\n}\n/**\n* Provides durations in ms of all main thread top-level events\n- * @param {LH.Artifacts.TraceOfTab} tabTrace\n+ * @param {Array<ToplevelEvent>} topLevelEvents\n* @param {number} startTime Optional start time (in ms relative to navstart) of range of interest. Defaults to navstart.\n* @param {number} endTime Optional end time (in ms relative to navstart) of range of interest. Defaults to trace end.\n* @return {{durations: Array<number>, clippedLength: number}}\n*/\n- static getMainThreadTopLevelEventDurations(tabTrace, startTime = 0, endTime = Infinity) {\n- const topLevelEvents = TraceProcessor.getMainThreadTopLevelEvents(tabTrace, startTime, endTime);\n-\n+ static getMainThreadTopLevelEventDurations(topLevelEvents, startTime = 0, endTime = Infinity) {\n// Find durations of all slices in range of interest.\n/** @type {Array<number>} */\nconst durations = [];\nlet clippedLength = 0;\n- topLevelEvents.forEach(event => {\n+ for (const event of topLevelEvents) {\n+ if (event.end < startTime || event.start > endTime) {\n+ continue;\n+ }\n+\nlet duration = event.duration;\nlet eventStart = event.start;\nif (eventStart < startTime) {\n@@ -134,7 +136,7 @@ class TraceProcessor {\n}\ndurations.push(duration);\n- });\n+ }\ndurations.sort((a, b) => a - b);\nreturn {\n@@ -149,7 +151,7 @@ class TraceProcessor {\n* @param {LH.Artifacts.TraceOfTab} tabTrace\n* @param {number=} startTime Optional start time (in ms relative to navstart) of range of interest. Defaults to navstart.\n* @param {number=} endTime Optional end time (in ms relative to navstart) of range of interest. Defaults to trace end.\n- * @return {!Array<{start: number, end: number, duration: number}>}\n+ * @return {Array<ToplevelEvent>}\n*/\nstatic getMainThreadTopLevelEvents(tabTrace, startTime = 0, endTime = Infinity) {\nconst topLevelEvents = [];\n@@ -186,4 +188,11 @@ class TraceProcessor {\n}\n}\n+/**\n+ * @typedef ToplevelEvent\n+ * @prop {number} start\n+ * @prop {number} end\n+ * @prop {number} duration\n+ */\n+\nmodule.exports = TraceProcessor;\n",
"new_path": "lighthouse-core/lib/traces/tracing-processor.js",
"old_path": "lighthouse-core/lib/traces/tracing-processor.js"
},
{
"change_type": "MODIFY",
"diff": "*/\n'use strict';\n-const Audit = require('../../audits/estimated-input-latency.js');\n-const Runner = require('../../runner.js');\n+const Audit = require('../../audits/estimated-input-latency');\n+const Runner = require('../../runner');\nconst assert = require('assert');\nconst options = Audit.defaultOptions;\n-const pwaTrace = require('../fixtures/traces/progressive-app.json');\n+const TracingProcessor = require('../../lib/traces/tracing-processor');\n+const pwaTrace = require('../fixtures/traces/progressive-app-m60.json');\nconst computedArtifacts = Runner.instantiateComputedArtifacts();\n@@ -25,12 +26,75 @@ function generateArtifactsWithTrace(trace) {\ndescribe('Performance: estimated-input-latency audit', () => {\nit('evaluates valid input correctly', () => {\n- const artifacts = generateArtifactsWithTrace({traceEvents: pwaTrace});\n+ const artifacts = generateArtifactsWithTrace(pwaTrace);\nreturn Audit.audit(artifacts, {options}).then(output => {\nassert.equal(output.debugString, undefined);\n- assert.equal(output.rawValue, 16.2);\n- assert.equal(output.displayValue, '16\\xa0ms');\n+ assert.equal(Math.round(output.rawValue * 10) / 10, 17.1);\n+ assert.equal(output.displayValue, '17\\xa0ms');\nassert.equal(output.score, 1);\n});\n});\n+\n+ describe('#audit', () => {\n+ let firstMeaningfulPaint;\n+ let traceEnd;\n+ let artifacts;\n+ let origGetMainThreadEventsFn;\n+ let mainThreadEvtsMock;\n+\n+ beforeEach(() => {\n+ firstMeaningfulPaint = 0.00001;\n+ traceEnd = 1e20;\n+ artifacts = {\n+ traces: {},\n+ requestTraceOfTab() {\n+ const timings = {firstMeaningfulPaint, traceEnd};\n+ return Promise.resolve({timings});\n+ },\n+ };\n+\n+ origGetMainThreadEventsFn = TracingProcessor.getMainThreadTopLevelEvents;\n+ TracingProcessor.getMainThreadTopLevelEvents = () => mainThreadEvtsMock(arguments);\n+ });\n+\n+ afterEach(() => {\n+ TracingProcessor.getMainThreadTopLevelEvents = origGetMainThreadEventsFn;\n+ });\n+\n+ it('uses a 5s rolling window, not traceEnd', async () => {\n+ mainThreadEvtsMock = () => [\n+ {start: 7500, end: 10000, duration: 2500},\n+ {start: 10000, end: 15000, duration: 5000},\n+ ];\n+\n+ const result = await Audit.audit(artifacts, {options});\n+ assert.equal(result.rawValue, 4516);\n+ assert.equal(result.score, 0);\n+ });\n+\n+ it('handles continuous tasks', async () => {\n+ const events = [];\n+ const longTaskDuration = 100;\n+ const longTaskNumber = 1000;\n+ const shortTaskDuration = 1.1;\n+ const shortTaskNumber = 10000;\n+\n+ for (let i = 0; i < longTaskNumber; i++) {\n+ const start = i * longTaskDuration;\n+ events.push({start: start, end: start + longTaskDuration, duration: longTaskDuration});\n+ }\n+\n+ const baseline = events[events.length - 1].end;\n+ for (let i = 0; i < shortTaskNumber; i++) {\n+ const start = i * shortTaskDuration + baseline;\n+ events.push({start: start, end: start + shortTaskDuration, duration: shortTaskDuration});\n+ }\n+\n+ mainThreadEvtsMock = () => events;\n+\n+ const result = await Audit.audit(artifacts, {options});\n+ assert.equal(result.rawValue, 106);\n+ assert.equal(result.score, 0.44);\n+ });\n+ });\n});\n",
"new_path": "lighthouse-core/test/audits/estimated-input-latency-test.js",
"old_path": "lighthouse-core/test/audits/estimated-input-latency-test.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -191,7 +191,8 @@ describe('TracingProcessor lib', () => {\nit('gets durations of top-level tasks', () => {\nconst trace = {traceEvents: pwaTrace};\nconst tabTrace = new TraceOfTab().compute_(trace);\n- const ret = TracingProcessor.getMainThreadTopLevelEventDurations(tabTrace);\n+ const events = TracingProcessor.getMainThreadTopLevelEvents(tabTrace);\n+ const ret = TracingProcessor.getMainThreadTopLevelEventDurations(events);\nconst durations = ret.durations;\nfunction getDurationFromIndex(index) {\n@@ -225,7 +226,8 @@ describe('TracingProcessor lib', () => {\nit('compute correct defaults', () => {\nconst trace = {traceEvents: pwaTrace};\nconst tabTrace = new TraceOfTab().compute_(trace);\n- const ret = TracingProcessor.getRiskToResponsiveness(tabTrace);\n+ const events = TracingProcessor.getMainThreadTopLevelEvents(tabTrace);\n+ const ret = TracingProcessor.getRiskToResponsiveness(events, 0, tabTrace.timings.traceEnd);\nassert.equal(ret.durations.length, 645);\nassert.equal(Math.round(ret.totalTime), 2143);\nassert.equal(ret.clippedLength, 0);\n",
"new_path": "lighthouse-core/test/lib/traces/tracing-processor-test.js",
"old_path": "lighthouse-core/test/lib/traces/tracing-processor-test.js"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
core(estimated-input-latency): use a 5s rolling window (#4989)
| 1
|
core
|
estimated-input-latency
|
821,196
|
20.04.2018 13:24:15
| 25,200
|
e09b530c76ecd1a5cf937b2a92e1730d0c780352
|
fix: only add root manifest
|
[
{
"change_type": "MODIFY",
"diff": "@@ -268,7 +268,7 @@ class App extends Generator {\nthis.pjson.scripts.prepack = nps.series(this.pjson.scripts.prepack, 'oclif-dev manifest', 'oclif-dev readme')\nthis.pjson.scripts.postpack = nps.series(this.pjson.scripts.postpack, 'rm -f .oclif.manifest.json')\nthis.pjson.scripts.version = nps.series('oclif-dev readme', 'git add README.md')\n- this.pjson.files.push('.oclif.manifest.json')\n+ this.pjson.files.push('/.oclif.manifest.json')\n}\nthis.pjson.keywords = defaults.keywords || [this.type === 'plugin' ? 'oclif-plugin' : 'oclif']\nthis.pjson.homepage = defaults.homepage || `https://github.com/${this.pjson.repository}`\n",
"new_path": "src/generators/app.ts",
"old_path": "src/generators/app.ts"
}
] |
TypeScript
|
MIT License
|
oclif/oclif
|
fix: only add root manifest
| 1
|
fix
| null |
791,834
|
20.04.2018 13:28:04
| 25,200
|
1ce15d25fb1fccfa7bc30a38a520967256a954c1
|
tests: drop port number from dbw_tester for golden lhr
|
[
{
"change_type": "MODIFY",
"diff": "<!-- Note: these will only fail when using the static-server.js, which supports the ?delay=true param.\nIf you're using your own server, the resource will load instantly and the\nstylesheets will be ignored for being below the threshold. -->\n-<!-- we use a relative protocol url to test that `new URL(resource)` in the critical-request-chains.js audit can handle it -->\n-<link rel=\"stylesheet\" href=\"//localhost:10200/dobetterweb/dbw_tester.css?delay=100\"> <!-- FAIL, when run under smokehouse -->\n+<link rel=\"stylesheet\" href=\"./dobetterweb/dbw_tester.css?delay=100\"> <!-- FAIL, when run under smokehouse -->\n<link rel=\"stylesheet\" href=\"./unknown404.css?delay=200\"> <!-- FAIL -->\n<link rel=\"stylesheet\" href=\"./dbw_tester.css?delay=2200\"> <!-- FAIL -->\n<link rel=\"stylesheet\" href=\"./dbw_disabled.css?delay=200&isdisabled\" disabled> <!-- PASS -->\n",
"new_path": "lighthouse-cli/test/fixtures/dobetterweb/dbw_tester.html",
"old_path": "lighthouse-cli/test/fixtures/dobetterweb/dbw_tester.html"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
tests: drop port number from dbw_tester for golden lhr (#5006)
| 1
|
tests
| null |
821,196
|
20.04.2018 13:41:34
| 25,200
|
93ce53a719e6fb11f4b5a65a0602502c6c29f85c
|
docs: added issue template
|
[
{
"change_type": "RENAME",
"diff": "",
"new_path": ".github/CODE_OF_CONDUCT.md",
"old_path": "CODE_OF_CONDUCT.md"
},
{
"change_type": "RENAME",
"diff": "",
"new_path": ".github/CONTRIBUTING.md",
"old_path": "CONTRIBUTING.md"
},
{
"change_type": "ADD",
"diff": "+**Do you want to request a *feature* or report a *bug*?**\n+\n+**What is the current behavior?**\n+\n+**If the current behavior is a bug, please provide the steps to reproduce.**\n+\n+**What is the expected behavior?**\n+\n+**Please mention your oclif and OS version.**\n",
"new_path": ".github/ISSUE_TEMPLATE.md",
"old_path": null
}
] |
TypeScript
|
MIT License
|
oclif/oclif
|
docs: added issue template
| 1
|
docs
| null |
730,412
|
20.04.2018 13:46:08
| 0
|
ed58ef859ad6a81932c32290105a04afb2d0e3b9
|
chore(release): 0.1.277
|
[
{
"change_type": "MODIFY",
"diff": "All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.\n+<a name=\"0.1.277\"></a>\n+## [0.1.277](https://github.com/ciscospark/react-ciscospark/compare/v0.1.276...v0.1.277) (2018-04-20)\n+\n+\n+\n<a name=\"0.1.276\"></a>\n## [0.1.276](https://github.com/ciscospark/react-ciscospark/compare/v0.1.275...v0.1.276) (2018-04-17)\n",
"new_path": "CHANGELOG.md",
"old_path": "CHANGELOG.md"
},
{
"change_type": "MODIFY",
"diff": "{\n\"name\": \"@ciscospark/react-ciscospark\",\n- \"version\": \"0.1.276\",\n+ \"version\": \"0.1.277\",\n\"description\": \"The Cisco Spark for React library allows developers to easily incorporate Spark functionality into an application.\",\n\"scripts\": {\n\"build\": \"./scripts/build/index.js\",\n",
"new_path": "package.json",
"old_path": "package.json"
}
] |
JavaScript
|
MIT License
|
webex/react-widgets
|
chore(release): 0.1.277
| 1
|
chore
|
release
|
679,913
|
20.04.2018 14:43:16
| -3,600
|
27a098d75958f5b1614e1bd6404cfcfc1489c2e4
|
feat(rstream): add PubSub, add ISubscribableSubscriber, remove cache()
|
[
{
"change_type": "MODIFY",
"diff": "@@ -29,6 +29,11 @@ export interface ISubscribable<T> extends IID<string> {\ngetState(): State;\n}\n+export interface ISubscribableSubscriber<T> extends\n+ ISubscriber<T>,\n+ ISubscribable<any> {\n+}\n+\nexport interface IStream<T> extends ISubscriber<T> {\ncancel: StreamCancel;\n}\n",
"new_path": "packages/rstream/src/api.ts",
"old_path": "packages/rstream/src/api.ts"
},
{
"change_type": "MODIFY",
"diff": "export * from \"./api\";\n+export * from \"./pubsub\";\nexport * from \"./stream\";\nexport * from \"./stream-merge\";\nexport * from \"./stream-sync\";\n@@ -15,7 +16,6 @@ export * from \"./from/view\";\nexport * from \"./from/worker\";\nexport * from \"./subs/bisect\";\n-export * from \"./subs/cache\";\nexport * from \"./subs/post-worker\";\nexport * from \"./subs/resolve\";\nexport * from \"./subs/sidechain-partition\";\n",
"new_path": "packages/rstream/src/index.ts",
"old_path": "packages/rstream/src/index.ts"
},
{
"change_type": "ADD",
"diff": "+import { IObjectOf } from \"@thi.ng/api/api\";\n+import { Transducer } from \"@thi.ng/transducers/api\";\n+\n+import { DEBUG, ISubscribableSubscriber, ISubscriber } from \"./api\";\n+import { Subscription } from \"./subscription\";\n+import { unsupported } from \"@thi.ng/api/error\";\n+\n+export interface PubSubOpts<A, B> {\n+ topic: (x: B) => PropertyKey;\n+ xform?: Transducer<A, B>;\n+ id?: string;\n+}\n+\n+export class PubSub<A, B> extends Subscription<A, B> {\n+\n+ topicfn: (x: B) => PropertyKey;\n+ topics: IObjectOf<Subscription<B, B>>;\n+\n+ constructor(opts?: PubSubOpts<A, B>) {\n+ opts = opts || <PubSubOpts<A, B>>{};\n+ super(null, opts.xform, null, opts.id || `pubsub-${Subscription.NEXT_ID++}`);\n+ this.topicfn = opts.topic;\n+ this.topics = {};\n+ }\n+\n+ /**\n+ * Unsupported. Use `subscribeTopic()` instead.\n+ *\n+ * @param _\n+ */\n+ subscribe(..._: any[]): Subscription<B, any> {\n+ unsupported(`use subscribeTopic() instead`);\n+ return null;\n+ }\n+\n+ /**\n+ * Unsupported. Use `subscribeTopic()` instead.\n+ *\n+ * @param _\n+ */\n+ transform(..._: any[]): Subscription<B, any> {\n+ unsupported(`use subscribeTopic() instead`);\n+ return null;\n+ }\n+\n+ subscribeTopic(topicID: PropertyKey, sub: Partial<ISubscriber<B>>, id?: string): Subscription<B, B>;\n+ subscribeTopic<C>(topicID: PropertyKey, tx: Transducer<B, C>, id?: string): Subscription<B, C>;\n+ subscribeTopic(topicID: PropertyKey, sub: any, id?: string): Subscription<any, any> {\n+ let t = this.topics[topicID];\n+ if (!t) {\n+ t = this.topics[topicID] = new Subscription<B, B>();\n+ }\n+ return t.subscribe(sub, id);\n+ }\n+\n+ unsubscribeTopic(topicID: string, sub: Subscription<B, any>) {\n+ let t = this.topics[topicID];\n+ if (t) {\n+ return t.unsubscribe(sub);\n+ }\n+ return false;\n+ }\n+\n+ unsubscribe(sub?: Subscription<B, any>) {\n+ if (!sub) {\n+ const topics = this.topics;\n+ for (let id in this.topics) {\n+ topics[id].unsubscribe();\n+ delete this.topics[id];\n+ }\n+ return super.unsubscribe();\n+ }\n+ unsupported();\n+ return false;\n+ }\n+\n+ done() {\n+ super.done();\n+ for (let id in this.topics) {\n+ this.topics[id].done();\n+ }\n+ }\n+\n+ protected dispatch(x: B) {\n+ DEBUG && console.log(this.id, \"dispatch\", x);\n+ const t = this.topicfn(x);\n+ if (t != null) {\n+ const sub = this.topics[t];\n+ if (sub) {\n+ try {\n+ sub.next && sub.next(x);\n+ } catch (e) {\n+ sub.error ? sub.error(e) : this.error(e);\n+ }\n+ }\n+ }\n+ }\n+}\n+\n+export function pubsub<A, B>(opts: PubSubOpts<A, B>) {\n+ return new PubSub(opts);\n+}\n\\ No newline at end of file\n",
"new_path": "packages/rstream/src/pubsub.ts",
"old_path": null
},
{
"change_type": "DELETE",
"diff": "-import { IDeref } from \"@thi.ng/api/api\";\n-import { Transducer } from \"@thi.ng/transducers/api\";\n-\n-import { Subscription } from \"../subscription\";\n-\n-/**\n- * Deprecated since v1.1.0. Subscriptions now store last received value\n- * and new subs will receive the last value stored in parent as their\n- * first value (if there is one).\n- */\n-export class Cache<T> extends Subscription<any, T> implements\n- IDeref<T> {\n-\n- value: T;\n-\n- constructor(xf?: Transducer<any, T>, id?: string) {\n- super(null, xf, null, id || `cache-${Subscription.NEXT_ID++}`);\n- }\n-\n- deref(): T {\n- return this.value;\n- }\n-\n- dispatch(x: T) {\n- this.value = x;\n- super.dispatch(x);\n- }\n-}\n-\n-export function cache<T>(xf?: Transducer<any, T>, id?: string) {\n- return new Cache(xf, id);\n-}\n",
"new_path": null,
"old_path": "packages/rstream/src/subs/cache.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -2,7 +2,6 @@ import * as tx from \"@thi.ng/transducers\";\nimport * as assert from \"assert\";\nimport * as rs from \"../src/index\";\n-import { Subscription } from \"../src/index\";\ndescribe(\"bisect\", () => {\nlet src: rs.Stream<number>;\n@@ -29,11 +28,11 @@ describe(\"bisect\", () => {\nit(\"subs\", (done) => {\nconst odds = [], evens = [];\n- const subo = new Subscription<number, number>(\n+ const subo = new rs.Subscription<number, number>(\n{ next(x) { odds.push(x) }, done() { doneCount++; } },\ntx.map<number, number>(x => x * 10)\n);\n- const sube = new Subscription<number, number>(\n+ const sube = new rs.Subscription<number, number>(\n{ next(x) { evens.push(x) }, done() { doneCount++; } },\ntx.map<number, number>(x => x * 100)\n);\n",
"new_path": "packages/rstream/test/bisect.ts",
"old_path": "packages/rstream/test/bisect.ts"
},
{
"change_type": "ADD",
"diff": "+import * as tx from \"@thi.ng/transducers\";\n+import * as assert from \"assert\";\n+\n+import * as rs from \"../src/index\";\n+\n+describe(\"PubSub\", () => {\n+ let pub: rs.PubSub<any, any>;\n+\n+ it(\"simple\", () => {\n+ const acc = { a: [], b: [] };\n+ const collect = { next: (x) => acc[x].push(x) };\n+ pub = rs.pubsub({ topic: (x) => x });\n+ pub.subscribeTopic(\"a\", collect);\n+ pub.subscribeTopic(\"b\", collect);\n+ rs.fromIterableSync(\"abcbd\").subscribe(pub);\n+ assert.deepEqual(acc, { a: [\"a\"], b: [\"b\", \"b\"] });\n+ assert.equal(pub.getState(), rs.State.DONE);\n+ });\n+\n+ it(\"transducer\", () => {\n+ const acc = { a: [], b: [], c: [], d: [] };\n+ const collect = { next: (x) => acc[x[0]].push(x) };\n+ pub = rs.pubsub({\n+ topic: (x) => x[0],\n+ xform: tx.mapIndexed<string, [string, number]>((i, x) => [x, i])\n+ });\n+ pub.subscribeTopic(\"a\", collect);\n+ pub.subscribeTopic(\"b\", collect);\n+ rs.fromIterableSync(\"abcbd\").subscribe(pub);\n+ assert.deepEqual(acc, { a: [[\"a\", 0]], b: [[\"b\", 1], [\"b\", 3]], c: [], d: [] });\n+ assert.equal(pub.getState(), rs.State.DONE);\n+ });\n+\n+ it(\"unsubTopic\", (done) => {\n+ const acc = { a: [], b: [] };\n+ const collect = { next: (x) => acc[x].push(x) };\n+ pub = rs.pubsub({ topic: (x) => x });\n+ pub.subscribeTopic(\"a\", collect);\n+ const b = pub.subscribeTopic(\"b\", collect);\n+ rs.fromIterable(\"abcbd\", 5).subscribe(pub);\n+ setTimeout(() => pub.unsubscribeTopic(\"b\", b), 15);\n+ setTimeout(() => {\n+ assert.deepEqual(acc, { a: [\"a\"], b: [\"b\"] });\n+ assert.equal(pub.getState(), rs.State.DONE);\n+ done();\n+ }, 40);\n+ });\n+});\n\\ No newline at end of file\n",
"new_path": "packages/rstream/test/pubsub.ts",
"old_path": null
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
feat(rstream): add PubSub, add ISubscribableSubscriber, remove cache()
| 1
|
feat
|
rstream
|
679,913
|
20.04.2018 15:52:19
| -3,600
|
bb11ddfb31f9b475bd52265498f4cd065287c07b
|
fix(associative): allow partial options arg for EquivMap ctor
|
[
{
"change_type": "MODIFY",
"diff": "@@ -43,13 +43,13 @@ export class EquivMap<K, V> extends Map<K, V> implements\n* @param pairs\n* @param opts\n*/\n- constructor(pairs?: Iterable<Pair<K, V>>, opts?: EquivMapOpts<K>) {\n+ constructor(pairs?: Iterable<Pair<K, V>>, opts?: Partial<EquivMapOpts<K>>) {\nsuper();\n- opts = Object.assign(<EquivMapOpts<K>>{ equiv, keys: ArraySet }, opts);\n+ const _opts: EquivMapOpts<K> = Object.assign({ equiv, keys: ArraySet }, opts);\n__private.set(this, {\n- keys: new (opts.keys)(null, { equiv: opts.equiv }),\n+ keys: new (_opts.keys)(null, { equiv: _opts.equiv }),\nmap: new Map<K, V>(),\n- opts\n+ opts: _opts\n});\nif (pairs) {\nthis.into(pairs);\n",
"new_path": "packages/associative/src/equiv-map.ts",
"old_path": "packages/associative/src/equiv-map.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
fix(associative): allow partial options arg for EquivMap ctor
| 1
|
fix
|
associative
|
679,913
|
20.04.2018 15:53:52
| -3,600
|
ba10907caa8e4f40bb9af741c745d5a33f8b22e6
|
feat(rstream): allow arbitrary PubSub topic vals, add dep
use EquivMap for storing topics
add/update tests
add docs
|
[
{
"change_type": "MODIFY",
"diff": "},\n\"dependencies\": {\n\"@thi.ng/api\": \"^2.2.0\",\n+ \"@thi.ng/associative\": \"^0.4.1\",\n\"@thi.ng/atom\": \"^1.3.3\",\n\"@thi.ng/transducers\": \"^1.8.1\"\n},\n",
"new_path": "packages/rstream/package.json",
"old_path": "packages/rstream/package.json"
},
{
"change_type": "MODIFY",
"diff": "-import { IObjectOf } from \"@thi.ng/api/api\";\n+import { Predicate2 } from \"@thi.ng/api/api\";\n+import { unsupported } from \"@thi.ng/api/error\";\n+import { EquivMap } from \"@thi.ng/associative/equiv-map\";\nimport { Transducer } from \"@thi.ng/transducers/api\";\n-import { DEBUG, ISubscribableSubscriber, ISubscriber } from \"./api\";\n+import { DEBUG, ISubscriber } from \"./api\";\nimport { Subscription } from \"./subscription\";\n-import { unsupported } from \"@thi.ng/api/error\";\nexport interface PubSubOpts<A, B> {\n- topic: (x: B) => PropertyKey;\n+ /**\n+ * Topic function. Incoming values will be routed to topic\n+ * subscriptions using this function's return value.\n+ */\n+ topic: (x: B) => any;\n+ /**\n+ * Optional transformer for incoming values. If given, `xform` will\n+ * be applied first and the transformed value passed to the\n+ * `topic` fn.\n+ */\nxform?: Transducer<A, B>;\n+ /**\n+ * Equivalence check for topic values. Should return truthy result\n+ * if given topics are considered equal.\n+ */\n+ equiv?: Predicate2<B>;\n+ /**\n+ * Optional subscription ID for the PubSub instance.\n+ */\nid?: string;\n}\n+/**\n+ * Topic based stream splitter. Applies `topic` function to each\n+ * received value and only forwards it to child subscriptions for\n+ * returned topic. The actual topic (return value from `topic` fn) can\n+ * be of any type, apart from `undefined`. Complex topics (e.g objects /\n+ * arrays) are allowed and they're matched with registered topics using\n+ * @thi.ng/api/equiv by default (but customizable via `equiv` option).\n+ * Each topic can have any number of subscribers.\n+ *\n+ * If a transducer is specified for the `PubSub`, it is always applied\n+ * prior to passing the input to the topic function. I.e. in this case\n+ * the topic function will receive the transformed inputs.\n+ *\n+ * PubSub supports dynamic topic subscriptions and unsubscriptions via\n+ * `subscribeTopic()` and `unsubscribeTopic()`. However, the standard\n+ * `subscribe()` / `unsubscribe()` methods are NOT supported (since\n+ * meaningless) and will throw an error! `unsubscribe()` can only be\n+ * called WITHOUT argument to unsubscribe the entire `PubSub` instance\n+ * (incl. all topic subscriptions) from the parent stream.\n+ */\nexport class PubSub<A, B> extends Subscription<A, B> {\ntopicfn: (x: B) => PropertyKey;\n- topics: IObjectOf<Subscription<B, B>>;\n+ topics: EquivMap<any, Subscription<B, B>>;\nconstructor(opts?: PubSubOpts<A, B>) {\nopts = opts || <PubSubOpts<A, B>>{};\nsuper(null, opts.xform, null, opts.id || `pubsub-${Subscription.NEXT_ID++}`);\nthis.topicfn = opts.topic;\n- this.topics = {};\n+ this.topics = new EquivMap<any, Subscription<B, B>>(null, { equiv: opts.equiv });\n}\n/**\n@@ -43,18 +81,18 @@ export class PubSub<A, B> extends Subscription<A, B> {\nreturn null;\n}\n- subscribeTopic(topicID: PropertyKey, sub: Partial<ISubscriber<B>>, id?: string): Subscription<B, B>;\n- subscribeTopic<C>(topicID: PropertyKey, tx: Transducer<B, C>, id?: string): Subscription<B, C>;\n- subscribeTopic(topicID: PropertyKey, sub: any, id?: string): Subscription<any, any> {\n- let t = this.topics[topicID];\n+ subscribeTopic(topicID: any, sub: Partial<ISubscriber<B>>, id?: string): Subscription<B, B>;\n+ subscribeTopic<C>(topicID: any, tx: Transducer<B, C>, id?: string): Subscription<B, C>;\n+ subscribeTopic(topicID: any, sub: any, id?: string): Subscription<any, any> {\n+ let t = this.topics.get(topicID);\nif (!t) {\n- t = this.topics[topicID] = new Subscription<B, B>();\n+ this.topics.set(topicID, t = new Subscription<B, B>());\n}\nreturn t.subscribe(sub, id);\n}\n- unsubscribeTopic(topicID: string, sub: Subscription<B, any>) {\n- let t = this.topics[topicID];\n+ unsubscribeTopic(topicID: any, sub: Subscription<B, any>) {\n+ let t = this.topics.get(topicID);\nif (t) {\nreturn t.unsubscribe(sub);\n}\n@@ -63,11 +101,10 @@ export class PubSub<A, B> extends Subscription<A, B> {\nunsubscribe(sub?: Subscription<B, any>) {\nif (!sub) {\n- const topics = this.topics;\n- for (let id in this.topics) {\n- topics[id].unsubscribe();\n- delete this.topics[id];\n+ for (let t of this.topics.values()) {\n+ t.unsubscribe();\n}\n+ this.topics.clear();\nreturn super.unsubscribe();\n}\nunsupported();\n@@ -75,17 +112,17 @@ export class PubSub<A, B> extends Subscription<A, B> {\n}\ndone() {\n- super.done();\n- for (let id in this.topics) {\n- this.topics[id].done();\n+ for (let t of this.topics.values()) {\n+ t.done();\n}\n+ super.done();\n}\nprotected dispatch(x: B) {\nDEBUG && console.log(this.id, \"dispatch\", x);\nconst t = this.topicfn(x);\n- if (t != null) {\n- const sub = this.topics[t];\n+ if (t !== undefined) {\n+ const sub = this.topics.get(t);\nif (sub) {\ntry {\nsub.next && sub.next(x);\n",
"new_path": "packages/rstream/src/pubsub.ts",
"old_path": "packages/rstream/src/pubsub.ts"
},
{
"change_type": "MODIFY",
"diff": "+import { EquivMap } from \"@thi.ng/associative\";\nimport * as tx from \"@thi.ng/transducers\";\nimport * as assert from \"assert\";\n@@ -10,11 +11,29 @@ describe(\"PubSub\", () => {\nconst acc = { a: [], b: [] };\nconst collect = { next: (x) => acc[x].push(x) };\npub = rs.pubsub({ topic: (x) => x });\n- pub.subscribeTopic(\"a\", collect);\n- pub.subscribeTopic(\"b\", collect);\n+ const a = pub.subscribeTopic(\"a\", collect);\n+ const b = pub.subscribeTopic(\"b\", collect);\nrs.fromIterableSync(\"abcbd\").subscribe(pub);\nassert.deepEqual(acc, { a: [\"a\"], b: [\"b\", \"b\"] });\nassert.equal(pub.getState(), rs.State.DONE);\n+ assert.equal(a.getState(), rs.State.DONE);\n+ assert.equal(b.getState(), rs.State.DONE);\n+ });\n+\n+ it(\"complex keys\", () => {\n+ const acc = new EquivMap();\n+ const collect = { next: (x) => { let v = acc.get(x); v ? v.push(x) : acc.set(x, [x]) } };\n+ pub = rs.pubsub({ topic: (x) => x });\n+ pub.subscribeTopic([\"a\", 0], collect);\n+ pub.subscribeTopic([\"a\", 1], collect);\n+ pub.subscribeTopic([\"b\", 2], collect);\n+ rs.fromIterableSync([[\"a\", 0], [\"a\", 1], [\"b\", 2], [\"a\", 0], [\"c\", 3]]).subscribe(pub);\n+ assert.deepEqual([...acc], [\n+ [[\"a\", 0], [[\"a\", 0], [\"a\", 0]]],\n+ [[\"a\", 1], [[\"a\", 1]]],\n+ [[\"b\", 2], [[\"b\", 2]]],\n+ ]);\n+ assert.equal(pub.getState(), rs.State.DONE);\n});\nit(\"transducer\", () => {\n@@ -45,4 +64,5 @@ describe(\"PubSub\", () => {\ndone();\n}, 40);\n});\n+\n});\n\\ No newline at end of file\n",
"new_path": "packages/rstream/test/pubsub.ts",
"old_path": "packages/rstream/test/pubsub.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
feat(rstream): allow arbitrary PubSub topic vals, add @thi.ng/associative dep
- use EquivMap for storing topics
- add/update tests
- add docs
| 1
|
feat
|
rstream
|
217,922
|
20.04.2018 17:33:06
| -7,200
|
a307b6184cf88314007c42ca5e7373d03d24b495
|
chore: finalized scrollspy
|
[
{
"change_type": "MODIFY",
"diff": "<div class=\"app-container {{settings.theme}}-theme mat-typography\">\n- <mat-toolbar color=\"primary\">\n+ <mat-toolbar color=\"primary\" class=\"app-toolbar\">\n<button *ngIf=\"mobile\" mat-icon-button (click)=\"sidenav.toggle()\">\n<mat-icon>menu</mat-icon>\n</button>\n",
"new_path": "src/app/app.component.html",
"old_path": "src/app/app.component.html"
},
{
"change_type": "MODIFY",
"diff": "export interface MarkdownSection {\ntitle: string;\nelement: Element;\n+ level: string;\nactive?: boolean;\n}\n",
"new_path": "src/app/pages/wiki/markdown-section.ts",
"old_path": "src/app/pages/wiki/markdown-section.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -51,7 +51,7 @@ export class ScrollSpiedElement implements ScrollItem {\n* @param {number} topOffset - The distance from the top at which the element becomes active.\n*/\ncalculateTop(scrollTop: number, topOffset: number) {\n- this.top = scrollTop + this.element.getBoundingClientRect().top - topOffset;\n+ this.top = scrollTop + (<any>this.element).offsetTop - topOffset;\n}\n}\n@@ -105,8 +105,8 @@ export class ScrollSpiedElementGroup {\n*/\nonScroll(scrollTop: number, maxScrollTop: number) {\nlet activeItem: ScrollItem | undefined;\n- if (scrollTop + 1 >= maxScrollTop) {\n- activeItem = this.spiedElements[0];\n+ if (maxScrollTop === 0) {\n+ activeItem = this.spiedElements[this.spiedElements.length - 1];\n} else {\nthis.spiedElements.some(spiedElem => {\nif (spiedElem.top <= scrollTop) {\n@@ -186,7 +186,7 @@ export class ScrollSpyService {\n}\nprivate getTopOffset() {\n- return this.scrollService.topOffset + 50;\n+ return 10;\n}\nprivate getViewportHeight() {\n",
"new_path": "src/app/pages/wiki/services/scroll-spy.service.ts",
"old_path": "src/app/pages/wiki/services/scroll-spy.service.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -4,7 +4,7 @@ import {fromEvent} from 'rxjs/observable/fromEvent';\n// https://github.com/angular/angular/blob/master/aio/src/app/shared/scroll.service.ts\n-export const topMargin = 16;\n+export const topMargin = 20;\n/**\n* A service that scrolls document elements into view\n",
"new_path": "src/app/pages/wiki/services/scroll.service.ts",
"old_path": "src/app/pages/wiki/services/scroll.service.ts"
},
{
"change_type": "MODIFY",
"diff": "-<h2 *ngIf=\"!notFound\">{{'WIKI.Title' | translate}}</h2>\n<mat-error *ngIf=\"notFoundInCurrentLang && !notFound\">{{'WIKI.Not_found_in_current_lang' | translate}}</mat-error>\n<h4 class=\"not-found\" *ngIf=\"notFound\">{{\"WIKI.Not_found\" | translate}}</h4>\n<div class=\"wiki-container\" #markdown>\n<div markdown class=\"markdown\" (click)=\"interceptLinks($event)\" [data]=\"markdownContent | async\"></div>\n<div class=\"toc\">\n<ul>\n- <li *ngFor=\"let row of tableOfContent | async\"\n- (click)=\"scrollTo(row.element)\"\n- [ngClass]=\"{'toc-active': row.active}\">{{row.title}}</li>\n+ <li *ngFor=\"let row of tableOfContent | async; let i = index\"\n+ (click)=\"scrollTo(row.element, i)\"\n+ [ngClass]=\"{'toc-active': row.active}\" class=\"toc-{{row.level}}\">{{row.title}}</li>\n</ul>\n</div>\n</div>\n",
"new_path": "src/app/pages/wiki/wiki/wiki.component.html",
"old_path": "src/app/pages/wiki/wiki/wiki.component.html"
},
{
"change_type": "MODIFY",
"diff": "@@ -22,10 +22,27 @@ div.wiki-container {\nposition: fixed;\ntop: 72px;\nright: 0;\n+ ul {\n+ list-style-type: none;\nli {\ncursor: pointer;\n- &.toc-active {\n- color: red;\n+ &.toc-h1 {\n+ font-size: 110%;\n+ &::after {\n+ content: \"\";\n+ display: block;\n+ height: 1px;\n+ width: 40%;\n+ margin: 7px 0 4px 0;\n+ background: #dbdbdb;\n+ clear: both;\n+ }\n+ }\n+ &.toc-h2 {\n+ }\n+ &.toc-h3 {\n+ padding-left: 24px;\n+ }\n}\n}\n}\n",
"new_path": "src/app/pages/wiki/wiki/wiki.component.scss",
"old_path": "src/app/pages/wiki/wiki/wiki.component.scss"
},
{
"change_type": "MODIFY",
"diff": "@@ -44,7 +44,6 @@ export class WikiComponent implements OnInit {\nthis.reloader$.next(null);\nthis.tocReloader$.next(null);\n});\n- this.activeSectionIndex.subscribe(console.log);\n}\ninterceptLinks(event: MouseEvent): void {\n@@ -55,8 +54,12 @@ export class WikiComponent implements OnInit {\n}\n}\n- scrollTo(element: Element): void {\n+ scrollTo(element: Element, index: number): void {\nthis.scrollService.scrollToElement(element);\n+ // Wait a bit before emitting index\n+ setTimeout(() => {\n+ this.activeSectionIndex.next(index);\n+ }, 50);\n}\nngOnInit(): void {\n@@ -104,22 +107,24 @@ export class WikiComponent implements OnInit {\nreturn {\ntitle: node.innerText,\nelement: node,\n+ level: node.localName,\nactive: false\n};\n});\n})\n.do((sections) => {\nthis.spyInfo = this.scrollSpyService.spyOn(sections.map(section => section.element));\n- this.spyInfo.active.subscribe(item => {\n+ this.spyInfo.active\n+ .filter(item => item !== null)\n+ .subscribe(item => {\nthis.activeSectionIndex.next(item && item.index)\n});\n})\n.mergeMap((sections) => {\n- return this.spyInfo.active\n- .filter(item => item !== null)\n+ return this.activeSectionIndex\n.map((activeItem) => {\nsections.forEach((section, index) => {\n- section.active = index === activeItem.index;\n+ section.active = index === activeItem;\n});\nreturn sections;\n});\n",
"new_path": "src/app/pages/wiki/wiki/wiki.component.ts",
"old_path": "src/app/pages/wiki/wiki/wiki.component.ts"
},
{
"change_type": "MODIFY",
"diff": "}\n}\n-\n-\n@mixin expansion-panel-accent($theme) {\nmat-expansion-panel.accent {\n$accent: map-get($theme, accent);\n@include text-color($theme);\n}\n}\n+\n+@mixin toc-theme($theme) {\n+ div.toc {\n+ $accent: map-get($theme, accent);\n+ $primary: map-get($theme, primary);\n+ border-left: solid 4px mat-color($primary);\n+ li {\n+ opacity: .8;\n+ &.toc-active {\n+ color: mat-color($accent);\n+ opacity: 1;\n+ &:hover {\n+ color: mat-color($accent);\n+ opacity: 1;\n+ }\n+ }\n+ &:hover {\n+ color: mat-color($accent);\n+ opacity: .6;\n+ }\n+ }\n+ }\n+}\n+\n// Palette\n// orange\n$primary-orange: mat-palette($mat-orange, 700);\n@@ -119,7 +141,6 @@ $accent-pink: mat-palette($mat-pink, 300);\n$warn: mat-palette($mat-red, 600);\n-\n// Dark or Light theme\n// orange\n$dark-theme: mat-dark-theme($primary-orange, $accent-orange, $warn);\n@@ -163,6 +184,7 @@ $light-pink-theme: mat-light-theme($primary-pink, $accent-pink, $warn);\n@include expansion-panel-accent($dark-theme);\n@include card-accent($dark-theme);\n@include color-fixes($dark-theme);\n+ @include toc-theme($dark-theme);\n}\n// Light orange theme class\n@@ -172,6 +194,7 @@ $light-pink-theme: mat-light-theme($primary-pink, $accent-pink, $warn);\n@include expansion-panel-accent($light-orange-theme);\n@include card-accent($light-orange-theme);\n@include color-fixes($light-orange-theme);\n+ @include toc-theme($light-orange-theme);\n}\n// Light teal theme class\n@@ -181,6 +204,7 @@ $light-pink-theme: mat-light-theme($primary-pink, $accent-pink, $warn);\n@include expansion-panel-accent($light-teal-theme);\n@include card-accent($light-teal-theme);\n@include color-fixes($light-teal-theme);\n+ @include toc-theme($light-teal-theme);\n}\n// Dark teal theme class\n@@ -190,6 +214,7 @@ $light-pink-theme: mat-light-theme($primary-pink, $accent-pink, $warn);\n@include expansion-panel-accent($dark-teal-theme);\n@include card-accent($dark-teal-theme);\n@include color-fixes($dark-teal-theme);\n+ @include toc-theme($dark-teal-theme);\n}\n// Light brown theme class\n@@ -199,6 +224,7 @@ $light-pink-theme: mat-light-theme($primary-pink, $accent-pink, $warn);\n@include expansion-panel-accent($light-brown-theme);\n@include card-accent($light-brown-theme);\n@include color-fixes($light-brown-theme);\n+ @include toc-theme($light-brown-theme);\n}\n// Light amber theme class\n@@ -208,6 +234,7 @@ $light-pink-theme: mat-light-theme($primary-pink, $accent-pink, $warn);\n@include expansion-panel-accent($light-amber-theme);\n@include card-accent($light-amber-theme);\n@include color-fixes($light-amber-theme);\n+ @include toc-theme($light-amber-theme);\n}\n// Dark amber theme class\n@@ -217,6 +244,7 @@ $light-pink-theme: mat-light-theme($primary-pink, $accent-pink, $warn);\n@include expansion-panel-accent($dark-amber-theme);\n@include card-accent($dark-amber-theme);\n@include color-fixes($dark-amber-theme);\n+ @include toc-theme($dark-amber-theme);\n}\n// Light green theme class\n@@ -226,6 +254,7 @@ $light-pink-theme: mat-light-theme($primary-pink, $accent-pink, $warn);\n@include expansion-panel-accent($light-green-theme);\n@include card-accent($light-green-theme);\n@include color-fixes($light-green-theme);\n+ @include toc-theme($light-green-theme);\n}\n// Dark lime theme class\n@@ -235,6 +264,7 @@ $light-pink-theme: mat-light-theme($primary-pink, $accent-pink, $warn);\n@include expansion-panel-accent($dark-lime-theme);\n@include card-accent($dark-lime-theme);\n@include color-fixes($dark-lime-theme);\n+ @include toc-theme($dark-lime-theme);\n}\n// Light lime theme class\n@@ -244,6 +274,7 @@ $light-pink-theme: mat-light-theme($primary-pink, $accent-pink, $warn);\n@include expansion-panel-accent($light-lime-theme);\n@include card-accent($light-lime-theme);\n@include color-fixes($light-lime-theme);\n+ @include toc-theme($light-lime-theme);\n}\n// Dark cyan theme class\n@@ -253,6 +284,7 @@ $light-pink-theme: mat-light-theme($primary-pink, $accent-pink, $warn);\n@include expansion-panel-accent($dark-cyan-theme);\n@include card-accent($dark-cyan-theme);\n@include color-fixes($dark-cyan-theme);\n+ @include toc-theme($dark-cyan-theme);\n}\n// Light cyan theme class\n@@ -262,6 +294,7 @@ $light-pink-theme: mat-light-theme($primary-pink, $accent-pink, $warn);\n@include expansion-panel-accent($light-cyan-theme);\n@include card-accent($light-cyan-theme);\n@include color-fixes($light-cyan-theme);\n+ @include toc-theme($light-cyan-theme);\n}\n// Dark indigo theme class\n@@ -271,6 +304,7 @@ $light-pink-theme: mat-light-theme($primary-pink, $accent-pink, $warn);\n@include expansion-panel-accent($dark-indigo-theme);\n@include card-accent($dark-indigo-theme);\n@include color-fixes($dark-indigo-theme);\n+ @include toc-theme($dark-indigo-theme);\n}\n// Light indigo theme class\n@@ -280,6 +314,7 @@ $light-pink-theme: mat-light-theme($primary-pink, $accent-pink, $warn);\n@include expansion-panel-accent($light-indigo-theme);\n@include card-accent($light-indigo-theme);\n@include color-fixes($light-indigo-theme);\n+ @include toc-theme($light-indigo-theme);\n}\n// Dark blue theme class\n@@ -289,6 +324,7 @@ $light-pink-theme: mat-light-theme($primary-pink, $accent-pink, $warn);\n@include expansion-panel-accent($dark-blue-theme);\n@include card-accent($dark-blue-theme);\n@include color-fixes($dark-blue-theme);\n+ @include toc-theme($dark-blue-theme);\n}\n// Light blue theme class\n@@ -298,6 +334,7 @@ $light-pink-theme: mat-light-theme($primary-pink, $accent-pink, $warn);\n@include expansion-panel-accent($light-blue-theme);\n@include card-accent($light-blue-theme);\n@include color-fixes($light-blue-theme);\n+ @include toc-theme($light-blue-theme);\n}\n// Dark deep-purple theme class\n@@ -307,6 +344,7 @@ $light-pink-theme: mat-light-theme($primary-pink, $accent-pink, $warn);\n@include expansion-panel-accent($dark-deep-purple-theme);\n@include card-accent($dark-deep-purple-theme);\n@include color-fixes($dark-deep-purple-theme);\n+ @include toc-theme($dark-deep-purple-theme);\n}\n// Light deep-purple theme class\n@@ -316,6 +354,7 @@ $light-pink-theme: mat-light-theme($primary-pink, $accent-pink, $warn);\n@include expansion-panel-accent($light-deep-purple-theme);\n@include card-accent($light-deep-purple-theme);\n@include color-fixes($light-deep-purple-theme);\n+ @include toc-theme($light-deep-purple-theme);\n}\n// Dark red theme class\n@@ -325,6 +364,7 @@ $light-pink-theme: mat-light-theme($primary-pink, $accent-pink, $warn);\n@include expansion-panel-accent($dark-red-theme);\n@include card-accent($dark-red-theme);\n@include color-fixes($dark-red-theme);\n+ @include toc-theme($dark-red-theme);\n}\n// Light red theme class\n@@ -334,6 +374,7 @@ $light-pink-theme: mat-light-theme($primary-pink, $accent-pink, $warn);\n@include expansion-panel-accent($light-red-theme);\n@include card-accent($light-red-theme);\n@include color-fixes($light-red-theme);\n+ @include toc-theme($light-red-theme);\n}\n// Dark pink theme class\n@@ -343,6 +384,7 @@ $light-pink-theme: mat-light-theme($primary-pink, $accent-pink, $warn);\n@include expansion-panel-accent($dark-pink-theme);\n@include card-accent($dark-pink-theme);\n@include color-fixes($dark-pink-theme);\n+ @include toc-theme($dark-pink-theme);\n}\n// Light pink theme class\n@@ -352,6 +394,7 @@ $light-pink-theme: mat-light-theme($primary-pink, $accent-pink, $warn);\n@include expansion-panel-accent($light-pink-theme);\n@include card-accent($light-pink-theme);\n@include color-fixes($light-pink-theme);\n+ @include toc-theme($light-pink-theme);\n}\n// Responsive breakpoint mixin/definitions\n",
"new_path": "src/theme.scss",
"old_path": "src/theme.scss"
}
] |
TypeScript
|
MIT License
|
ffxiv-teamcraft/ffxiv-teamcraft
|
chore: finalized scrollspy
| 1
|
chore
| null |
217,922
|
20.04.2018 19:20:51
| -7,200
|
14fa86ca75361ba45e00650dff39744e504558d6
|
feat: features page is now replaced with the wiki
|
[
{
"change_type": "MODIFY",
"diff": "matTooltipPosition=\"right\"\nmatTooltip=\"{{'HOME_PAGE.Wiki' | translate}}\"\n[matTooltipDisabled]=\"!settings.compactSidebar\">\n- <mat-icon matListIcon>find_in_page</mat-icon>\n+ <mat-icon matListIcon>library_books</mat-icon>\n<span matLine *ngIf=\"!settings.compactSidebar\">{{'WIKI.Title' | translate}}</span>\n</mat-list-item>\n<mat-list-item routerLink=\"/about\" (click)=\"mobile ? sidenav.close() : null\"\n",
"new_path": "src/app/app.component.html",
"old_path": "src/app/app.component.html"
},
{
"change_type": "MODIFY",
"diff": "<mat-error *ngIf=\"notFoundInCurrentLang && !notFound\">{{'WIKI.Not_found_in_current_lang' | translate}}</mat-error>\n-<h4 class=\"not-found\" *ngIf=\"notFound\">{{\"WIKI.Not_found\" | translate}}</h4>\n+<h1 class=\"page-not-found\" *ngIf=\"notFound\">{{\"WIKI.Not_found\" | translate}}</h1>\n<div class=\"wiki-container\" #markdown>\n<div markdown class=\"markdown\" (click)=\"interceptLinks($event)\" [data]=\"markdownContent | async\"></div>\n- <div class=\"toc\">\n+ <div class=\"toc\" *ngIf=\"!notFound\">\n<ul>\n<li *ngFor=\"let row of tableOfContent | async; let i = index\"\n(click)=\"scrollTo(row.element, i)\"\n",
"new_path": "src/app/pages/wiki/wiki/wiki.component.html",
"old_path": "src/app/pages/wiki/wiki/wiki.component.html"
},
{
"change_type": "MODIFY",
"diff": "-.not-found {\n- margin-top: 50px;\n+.page-not-found {\n+ margin-top: 50px !important;\ntext-align: center;\n- font-size: 40px;\n+ font-size: 40px !important;\nopacity: 0.6;\n}\n",
"new_path": "src/app/pages/wiki/wiki/wiki.component.scss",
"old_path": "src/app/pages/wiki/wiki/wiki.component.scss"
},
{
"change_type": "MODIFY",
"diff": "@@ -47,7 +47,8 @@ export class WikiComponent implements OnInit {\n}\ninterceptLinks(event: MouseEvent): void {\n- if (event.srcElement.tagName === 'A' && event.srcElement.baseURI.indexOf('ffxivteamcraft.com') > -1) {\n+ if (event.srcElement.tagName === 'A' && (event.srcElement.baseURI.indexOf('ffxivteamcraft.com') > -1 ||\n+ event.srcElement.baseURI.indexOf('localhost') > -1 )) {\n// If that's an anchor, intercept the click and handle it properly with router\nevent.preventDefault();\nthis.router.navigateByUrl((<HTMLAnchorElement>event.srcElement).pathname);\n",
"new_path": "src/app/pages/wiki/wiki/wiki.component.ts",
"old_path": "src/app/pages/wiki/wiki/wiki.component.ts"
},
{
"change_type": "ADD",
"diff": "+# Home\n+\n+Hello and welcome to FFXIV Teamcraft's wiki, here you can find guides about features, how to configure your\n+Teamcraft account properly to fit the experience you're looking for.\n+\n+This is also the place where you'll be able to find new features you didn't hear about.\n+Consider this wiki as a knowledge database, created by users and contributors to help everybody\n+through their crafting adventures, using FFXIV Teamcraft.\n+\n+Below you'll find a summary of all pages you can find on this wiki.\n+\n+## The basics\n+\n+ * [Lists](/wiki/lists), how to create a list, add items to it.\n+ * [Favourites](/wiki/favourites), describing how favourite list/workshop system works\n+ * [Books](/wiki/books), how to link your ingame mastercraft books (and folklore books) to your profile.\n+\n+## Advanced features\n+\n+ * [Layouts](/wiki/layouts), this describes how the layout system works, this system is one of the best tools to provide you the best user experience possible as it's fully customizable.\n+\n+\n+## I want to contribute to the wiki\n+\n+To contribute to this wiki, you can either fork the [github repository] or simply whisp Miu on [Discord] to talk about it.\n+Each page is shown in english if it doesn't exist in your current language.\n+\n+### Requirements\n+\n+To contribute to this wiki, there isn't a lot of requirements, a basic knowledge of Markdown is required, and some rules have to be followed to ensure the format fits this wiki system.\n",
"new_path": "src/assets/wiki/en/home.md",
"old_path": null
}
] |
TypeScript
|
MIT License
|
ffxiv-teamcraft/ffxiv-teamcraft
|
feat: features page is now replaced with the wiki
| 1
|
feat
| null |
679,913
|
20.04.2018 23:44:31
| -3,600
|
7bbbfa88dba8f69ba26bc2c9db56f873ca5c692c
|
feat(cache): initial import package
|
[
{
"change_type": "ADD",
"diff": "+build\n+coverage\n+dev\n+doc\n+src*\n+test\n+.nyc_output\n+tsconfig.json\n+*.tgz\n+*.html\n",
"new_path": "packages/cache/.npmignore",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+ Apache License\n+ Version 2.0, January 2004\n+ http://www.apache.org/licenses/\n+\n+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n+\n+ 1. Definitions.\n+\n+ \"License\" shall mean the terms and conditions for use, reproduction,\n+ and distribution as defined by Sections 1 through 9 of this document.\n+\n+ \"Licensor\" shall mean the copyright owner or entity authorized by\n+ the copyright owner that is granting the License.\n+\n+ \"Legal Entity\" shall mean the union of the acting entity and all\n+ other entities that control, are controlled by, or are under common\n+ control with that entity. For the purposes of this definition,\n+ \"control\" means (i) the power, direct or indirect, to cause the\n+ direction or management of such entity, whether by contract or\n+ otherwise, or (ii) ownership of fifty percent (50%) or more of the\n+ outstanding shares, or (iii) beneficial ownership of such entity.\n+\n+ \"You\" (or \"Your\") shall mean an individual or Legal Entity\n+ exercising permissions granted by this License.\n+\n+ \"Source\" form shall mean the preferred form for making modifications,\n+ including but not limited to software source code, documentation\n+ source, and configuration files.\n+\n+ \"Object\" form shall mean any form resulting from mechanical\n+ transformation or translation of a Source form, including but\n+ not limited to compiled object code, generated documentation,\n+ and conversions to other media types.\n+\n+ \"Work\" shall mean the work of authorship, whether in Source or\n+ Object form, made available under the License, as indicated by a\n+ copyright notice that is included in or attached to the work\n+ (an example is provided in the Appendix below).\n+\n+ \"Derivative Works\" shall mean any work, whether in Source or Object\n+ form, that is based on (or derived from) the Work and for which the\n+ editorial revisions, annotations, elaborations, or other modifications\n+ represent, as a whole, an original work of authorship. For the purposes\n+ of this License, Derivative Works shall not include works that remain\n+ separable from, or merely link (or bind by name) to the interfaces of,\n+ the Work and Derivative Works thereof.\n+\n+ \"Contribution\" shall mean any work of authorship, including\n+ the original version of the Work and any modifications or additions\n+ to that Work or Derivative Works thereof, that is intentionally\n+ submitted to Licensor for inclusion in the Work by the copyright owner\n+ or by an individual or Legal Entity authorized to submit on behalf of\n+ the copyright owner. For the purposes of this definition, \"submitted\"\n+ means any form of electronic, verbal, or written communication sent\n+ to the Licensor or its representatives, including but not limited to\n+ communication on electronic mailing lists, source code control systems,\n+ and issue tracking systems that are managed by, or on behalf of, the\n+ Licensor for the purpose of discussing and improving the Work, but\n+ excluding communication that is conspicuously marked or otherwise\n+ designated in writing by the copyright owner as \"Not a Contribution.\"\n+\n+ \"Contributor\" shall mean Licensor and any individual or Legal Entity\n+ on behalf of whom a Contribution has been received by Licensor and\n+ subsequently incorporated within the Work.\n+\n+ 2. Grant of Copyright License. Subject to the terms and conditions of\n+ this License, each Contributor hereby grants to You a perpetual,\n+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n+ copyright license to reproduce, prepare Derivative Works of,\n+ publicly display, publicly perform, sublicense, and distribute the\n+ Work and such Derivative Works in Source or Object form.\n+\n+ 3. Grant of Patent License. Subject to the terms and conditions of\n+ this License, each Contributor hereby grants to You a perpetual,\n+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n+ (except as stated in this section) patent license to make, have made,\n+ use, offer to sell, sell, import, and otherwise transfer the Work,\n+ where such license applies only to those patent claims licensable\n+ by such Contributor that are necessarily infringed by their\n+ Contribution(s) alone or by combination of their Contribution(s)\n+ with the Work to which such Contribution(s) was submitted. If You\n+ institute patent litigation against any entity (including a\n+ cross-claim or counterclaim in a lawsuit) alleging that the Work\n+ or a Contribution incorporated within the Work constitutes direct\n+ or contributory patent infringement, then any patent licenses\n+ granted to You under this License for that Work shall terminate\n+ as of the date such litigation is filed.\n+\n+ 4. Redistribution. You may reproduce and distribute copies of the\n+ Work or Derivative Works thereof in any medium, with or without\n+ modifications, and in Source or Object form, provided that You\n+ meet the following conditions:\n+\n+ (a) You must give any other recipients of the Work or\n+ Derivative Works a copy of this License; and\n+\n+ (b) You must cause any modified files to carry prominent notices\n+ stating that You changed the files; and\n+\n+ (c) You must retain, in the Source form of any Derivative Works\n+ that You distribute, all copyright, patent, trademark, and\n+ attribution notices from the Source form of the Work,\n+ excluding those notices that do not pertain to any part of\n+ the Derivative Works; and\n+\n+ (d) If the Work includes a \"NOTICE\" text file as part of its\n+ distribution, then any Derivative Works that You distribute must\n+ include a readable copy of the attribution notices contained\n+ within such NOTICE file, excluding those notices that do not\n+ pertain to any part of the Derivative Works, in at least one\n+ of the following places: within a NOTICE text file distributed\n+ as part of the Derivative Works; within the Source form or\n+ documentation, if provided along with the Derivative Works; or,\n+ within a display generated by the Derivative Works, if and\n+ wherever such third-party notices normally appear. The contents\n+ of the NOTICE file are for informational purposes only and\n+ do not modify the License. You may add Your own attribution\n+ notices within Derivative Works that You distribute, alongside\n+ or as an addendum to the NOTICE text from the Work, provided\n+ that such additional attribution notices cannot be construed\n+ as modifying the License.\n+\n+ You may add Your own copyright statement to Your modifications and\n+ may provide additional or different license terms and conditions\n+ for use, reproduction, or distribution of Your modifications, or\n+ for any such Derivative Works as a whole, provided Your use,\n+ reproduction, and distribution of the Work otherwise complies with\n+ the conditions stated in this License.\n+\n+ 5. Submission of Contributions. Unless You explicitly state otherwise,\n+ any Contribution intentionally submitted for inclusion in the Work\n+ by You to the Licensor shall be under the terms and conditions of\n+ this License, without any additional terms or conditions.\n+ Notwithstanding the above, nothing herein shall supersede or modify\n+ the terms of any separate license agreement you may have executed\n+ with Licensor regarding such Contributions.\n+\n+ 6. Trademarks. This License does not grant permission to use the trade\n+ names, trademarks, service marks, or product names of the Licensor,\n+ except as required for reasonable and customary use in describing the\n+ origin of the Work and reproducing the content of the NOTICE file.\n+\n+ 7. Disclaimer of Warranty. Unless required by applicable law or\n+ agreed to in writing, Licensor provides the Work (and each\n+ Contributor provides its Contributions) on an \"AS IS\" BASIS,\n+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n+ implied, including, without limitation, any warranties or conditions\n+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n+ PARTICULAR PURPOSE. You are solely responsible for determining the\n+ appropriateness of using or redistributing the Work and assume any\n+ risks associated with Your exercise of permissions under this License.\n+\n+ 8. Limitation of Liability. In no event and under no legal theory,\n+ whether in tort (including negligence), contract, or otherwise,\n+ unless required by applicable law (such as deliberate and grossly\n+ negligent acts) or agreed to in writing, shall any Contributor be\n+ liable to You for damages, including any direct, indirect, special,\n+ incidental, or consequential damages of any character arising as a\n+ result of this License or out of the use or inability to use the\n+ Work (including but not limited to damages for loss of goodwill,\n+ work stoppage, computer failure or malfunction, or any and all\n+ other commercial damages or losses), even if such Contributor\n+ has been advised of the possibility of such damages.\n+\n+ 9. Accepting Warranty or Additional Liability. While redistributing\n+ the Work or Derivative Works thereof, You may choose to offer,\n+ and charge a fee for, acceptance of support, warranty, indemnity,\n+ or other liability obligations and/or rights consistent with this\n+ License. However, in accepting such obligations, You may act only\n+ on Your own behalf and on Your sole responsibility, not on behalf\n+ of any other Contributor, and only if You agree to indemnify,\n+ defend, and hold each Contributor harmless for any liability\n+ incurred by, or claims asserted against, such Contributor by reason\n+ of your accepting any such warranty or additional liability.\n+\n+ END OF TERMS AND CONDITIONS\n+\n+ APPENDIX: How to apply the Apache License to your work.\n+\n+ To apply the Apache License to your work, attach the following\n+ boilerplate notice, with the fields enclosed by brackets \"{}\"\n+ replaced with your own identifying information. (Don't include\n+ the brackets!) The text should be enclosed in the appropriate\n+ comment syntax for the file format. We also recommend that a\n+ file or class name and description of purpose be included on the\n+ same \"printed page\" as the copyright notice for easier\n+ identification within third-party archives.\n+\n+ Copyright {yyyy} {name of copyright owner}\n+\n+ Licensed under the Apache License, Version 2.0 (the \"License\");\n+ you may not use this file except in compliance with the License.\n+ You may obtain a copy of the License at\n+\n+ http://www.apache.org/licenses/LICENSE-2.0\n+\n+ Unless required by applicable law or agreed to in writing, software\n+ distributed under the License is distributed on an \"AS IS\" BASIS,\n+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ See the License for the specific language governing permissions and\n+ limitations under the License.\n",
"new_path": "packages/cache/LICENSE",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+# @thi.ng/cache\n+\n+[](https://www.npmjs.com/package/@thi.ng/cache)\n+\n+## About\n+\n+In-memory cache implementations with ES6 Map-like API and different\n+expunge strategies. Supports any types for both keys & values.\n+\n+This package is still in early development and currently the only\n+strategies available are:\n+\n+- **LRU**: Least Recently Used\n+\n+## Installation\n+\n+```\n+yarn add @thi.ng/cache\n+```\n+\n+## Usage examples\n+\n+```typescript\n+import * as cache from \"@thi.ng/cache\";\n+\n+// caches can be configured with maxLen, maxSize and sizing functions (see below)\n+const lru = new cache.LRUCache<string, number>({ maxLen: 3 });\n+lru.set(\"foo\", 23);\n+lru.set(\"bar\", 42);\n+lru.set(\"baz\", 66);\n+\n+lru.has(\"foo\");\n+// true\n+// retrieving a value from the cache updates its timestamp\n+lru.get(\"foo\");\n+// 23\n+\n+// caches are fully iterable\n+[...lru]\n+// [ { k: 'bar', v: 42, s: 0, t: 1524263352848 },\n+// { k: 'baz', v: 66, s: 0, t: 1524263353254 },\n+// { k: 'foo', v: 23, s: 0, t: 1524263362677 } ]\n+[...lru.keys()]\n+// [ 'bar', 'baz', 'foo' ]\n+[...lru.values()]\n+// [ 42, 66, 23 ]\n+\n+// caches have a getSet() method to obtain & store a new value if its key is not known\n+// this process is asynchronous\n+lru.getSet(\"boo\", ()=> Promise.resolve(999)).then(console.log);\n+// 999\n+\n+// the given fn is only called if there's a cache miss (not the case here)\n+lru.getSet(\"boo\", ()=> Promise.resolve(123)).then(console.log);\n+// 999\n+\n+// caches can be limited by actual size rather than number of items\n+// the meaning of `size` is user-defined\n+// sizing fns are provided for both keys & values\n+// here we multiply value size by 8 since JS numbers are doubles by default\n+lru = new cache.LRUCache<string,number[]>({ maxSize: 32, ksize: (k)=>k.length, vsize: (v) => v.length * 8})\n+lru.set(\"a\", [1.0, 2.0]);\n+lru.size\n+// 17\n+\n+lru.set(\"b\", [3.0, 4.0]);\n+// 17 (\"a\" has been expunged due to max size)\n+\n+[...lru.keys()]\n+// [ 'b' ]\n+```\n+\n+## Authors\n+\n+- Karsten Schmidt\n+\n+## License\n+\n+© 2018 Karsten Schmidt // Apache Software License 2.0\n",
"new_path": "packages/cache/README.md",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+{\n+ \"name\": \"@thi.ng/cache\",\n+ \"version\": \"0.0.1\",\n+ \"description\": \"TODO\",\n+ \"main\": \"./index.js\",\n+ \"typings\": \"./index.d.ts\",\n+ \"repository\": \"https://github.com/thi-ng/umbrella\",\n+ \"author\": \"Karsten Schmidt <k+npm@thi.ng>\",\n+ \"license\": \"Apache-2.0\",\n+ \"scripts\": {\n+ \"build\": \"yarn run clean && tsc --declaration\",\n+ \"clean\": \"rm -rf *.js *.d.ts .nyc_output build coverage doc\",\n+ \"cover\": \"yarn test && nyc report --reporter=lcov\",\n+ \"doc\": \"node_modules/.bin/typedoc --mode modules --out doc src\",\n+ \"pub\": \"yarn run build && yarn publish --access public\",\n+ \"test\": \"rm -rf build && tsc -p test && nyc mocha build/test/*.js\"\n+ },\n+ \"devDependencies\": {\n+ \"@types/mocha\": \"^5.0.0\",\n+ \"@types/node\": \"^9.6.1\",\n+ \"mocha\": \"^5.0.5\",\n+ \"nyc\": \"^11.6.0\",\n+ \"typedoc\": \"^0.11.1\",\n+ \"typescript\": \"^2.8.1\"\n+ },\n+ \"dependencies\": {\n+ \"@thi.ng/api\": \"^2.1.0\",\n+ \"@thi.ng/dcons\": \"^0.2.0\",\n+ \"@thi.ng/iterators\": \"^4.1.5\"\n+ },\n+ \"keywords\": [\n+ \"ES6\",\n+ \"typescript\"\n+ ],\n+ \"publishConfig\": {\n+ \"access\": \"public\"\n+ }\n+}\n\\ No newline at end of file\n",
"new_path": "packages/cache/package.json",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+import { ICopy, IEmpty, ILength } from \"@thi.ng/api/api\";\n+\n+export interface ICache<K, V> extends\n+ Iterable<CacheEntry<K, V>>,\n+ ICopy<ICache<K, V>>,\n+ IEmpty<ICache<K, V>>,\n+ ILength {\n+\n+ readonly size: number;\n+\n+ has(key: K): boolean;\n+ get(key: K, notFound?: V): V;\n+ set(key: K, val: V): V;\n+ getSet(key: K, fn: () => Promise<V>): Promise<V>;\n+ delete(key: K): boolean;\n+}\n+\n+export interface CacheOpts<K, V> {\n+ ksize: (k: K) => number;\n+ vsize: (v: V) => number;\n+ maxLen: number;\n+ maxSize: number;\n+}\n+\n+export interface CacheEntry<K, V> {\n+ k: K;\n+ v: V;\n+ s: number;\n+}\n\\ No newline at end of file\n",
"new_path": "packages/cache/src/api.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+export * from \"./api\";\n+export * from \"./lru\";\n",
"new_path": "packages/cache/src/index.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+import { equiv } from \"@thi.ng/api/equiv\";\n+import { DCons, ConsCell } from \"@thi.ng/dcons\";\n+import { map } from \"@thi.ng/iterators/map\";\n+\n+import { ICache, CacheOpts, CacheEntry } from \"./api\";\n+\n+export interface LRUEntry<K, V> extends CacheEntry<K, V> {\n+ t: number;\n+}\n+\n+export class LRUCache<K, V> implements ICache<K, V> {\n+\n+ protected ksize: (k: K) => number;\n+ protected vsize: (v: V) => number;\n+ protected items: DCons<LRUEntry<K, V>>;\n+ protected _size: number;\n+ protected maxSize: number;\n+ protected maxLen: number;\n+\n+ constructor(opts?: Partial<CacheOpts<K, V>>) {\n+ opts = Object.assign({\n+ maxLen: Number.POSITIVE_INFINITY,\n+ maxSize: Number.POSITIVE_INFINITY,\n+ ksize: () => 0,\n+ vsize: () => 0,\n+ }, opts);\n+ this.items = new DCons<LRUEntry<K, V>>();\n+ this._size = 0;\n+ this.ksize = opts.ksize;\n+ this.vsize = opts.vsize;\n+ this.maxSize = opts.maxSize;\n+ this.maxLen = opts.maxLen;\n+ }\n+\n+ get length() {\n+ return this.items.length;\n+ }\n+\n+ get size() {\n+ return this._size;\n+ }\n+\n+ [Symbol.iterator]() {\n+ return this.entries();\n+ }\n+\n+ *entries(): IterableIterator<Readonly<CacheEntry<K, V>>> {\n+ yield* this.items;\n+ }\n+\n+ *keys(): IterableIterator<Readonly<K>> {\n+ yield* map((e) => e.k, this.items);\n+ }\n+\n+ *values(): Iterator<Readonly<V>> {\n+ yield* map((e) => e.v, this.items);\n+ }\n+\n+ copy(): ICache<K, V> {\n+ const c = this.empty();\n+ c.items = this.items.copy();\n+ return c;\n+ }\n+\n+ empty(): LRUCache<K, V> {\n+ return new LRUCache<K, V>({\n+ maxLen: this.maxLen,\n+ maxSize: this.maxSize,\n+ ksize: this.ksize,\n+ vsize: this.vsize,\n+ });\n+ }\n+\n+ has(key: K): boolean {\n+ return !!this.find(key);\n+ }\n+\n+ get(key: K, notFound?: V): V {\n+ const e = this.find(key);\n+ if (!e) {\n+ return notFound;\n+ }\n+ this.items.splice(e, 1);\n+ e.value.t = Date.now();\n+ this.items.push(e.value);\n+ return e.value.v;\n+ }\n+\n+ set(key: K, value: V) {\n+ this.delete(key);\n+ const size = this.ksize(key) + this.vsize(value);\n+ this._size += size;\n+ while (this._size > this.maxSize || this.length >= this.maxLen) {\n+ const e = this.items.drop();\n+ if (!e) {\n+ return;\n+ }\n+ this._size -= e.s;\n+ }\n+ this.items.push({\n+ k: key,\n+ v: value,\n+ s: size,\n+ t: Date.now(),\n+ });\n+ return value;\n+ }\n+\n+ getSet(key: K, fn: () => Promise<V>): Promise<V> {\n+ const e = this.find(key);\n+ if (e) {\n+ this.items.splice(e, 1);\n+ e.value.t = Date.now();\n+ this.items.push(e.value);\n+ return Promise.resolve(e.value.v);\n+ }\n+ return fn().then((v) => this.set(key, v));\n+ }\n+\n+ delete(key: K): boolean {\n+ const e = this.find(key);\n+ if (e) {\n+ this.items.splice(e, 1);\n+ this._size -= e.value.s;\n+ return true;\n+ }\n+ return false;\n+ }\n+\n+ protected find(key: K): ConsCell<LRUEntry<K, V>> {\n+ return this.items.findWith((x) => equiv(x.k, key));\n+ }\n+}\n",
"new_path": "packages/cache/src/lru.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+// import * as assert from \"assert\";\n+// import * as cache from \"../src/index\";\n+\n+describe(\"cache\", () => {\n+ it(\"tests pending\");\n+});\n",
"new_path": "packages/cache/test/index.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+{\n+ \"extends\": \"../../../tsconfig.json\",\n+ \"compilerOptions\": {\n+ \"outDir\": \"../build\"\n+ },\n+ \"include\": [\n+ \"./**/*.ts\",\n+ \"../src/**/*.ts\"\n+ ]\n+}\n",
"new_path": "packages/cache/test/tsconfig.json",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+{\n+ \"extends\": \"../../tsconfig.json\",\n+ \"compilerOptions\": {\n+ \"outDir\": \".\"\n+ },\n+ \"include\": [\n+ \"./src/**/*.ts\"\n+ ]\n+}\n",
"new_path": "packages/cache/tsconfig.json",
"old_path": null
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
feat(cache): initial import @thi.ng/cache package
| 1
|
feat
|
cache
|
679,913
|
21.04.2018 01:30:17
| -3,600
|
d37a91ebfa71010ea81a81ee57195c0a1cdb88dd
|
refactor(cache): update/extend ICache & LRUCache, update readme
|
[
{
"change_type": "MODIFY",
"diff": "## About\n-In-memory cache implementations with ES6 Map-like API and different\n-expunge strategies. Supports any types for both keys & values.\n-\n-This package is still in early development and currently the only\n-strategies available are:\n+In-memory cache implementations different expunge strategies. This\n+package is still in early development and currently the only strategies\n+available are:\n- **LRU**: Least Recently Used\n+### Features\n+\n+- ES6 Map-like API (with minor differences)\n+- Supports any types for both keys & values\n+- Customizable cache limits (no. of items / actual size)\n+- Customizable key equality checks (@thi.ng/api/equiv by default)\n+- Optional item release callbacks (to clean up resources when value is expunged)\n+\n## Installation\n```\n@@ -45,26 +51,38 @@ lru.get(\"foo\");\n[...lru.values()]\n// [ 42, 66, 23 ]\n-// caches have a getSet() method to obtain & store a new value if its key is not known\n-// this process is asynchronous\n+// remove from cache\n+lru.delete(\"foo\");\n+// true\n+\n+// caches have a getSet() method to obtain & store a new value\n+// if its key is not known. this process is asynchronous\nlru.getSet(\"boo\", () => Promise.resolve(999)).then(console.log);\n// 999\n-// the given fn is only called if there's a cache miss (not the case here)\n+// the given retrieval fn is only called if there's a cache miss\n+// (not the case here). `getSet()` always returns a promise\nlru.getSet(\"boo\", () => Promise.resolve(123)).then(console.log);\n// 999\n-// caches can be limited by actual size rather than number of items\n-// the meaning of `size` is user-defined\n-// sizing fns are provided for both keys & values\n+// caches can be limited by actual size instead of (or in addition to)\n+// number of items. the meaning of `size` is user-defined.\n+// sizing fns can be provided for both keys & values (both default to 0)\n// here we multiply value size by 8 since JS numbers are doubles by default\n-lru = new cache.LRUCache<string,number[]>({ maxSize: 32, ksize: (k)=>k.length, vsize: (v) => v.length * 8})\n+// also provide a release hook for demo purposes\n+lru = new cache.LRUCache<string, number[]>({\n+ maxSize: 32,\n+ ksize: (k) => k.length,\n+ vsize: (v) => v.length * 8,\n+ release: (k, v) => console.log(\"release\", k, v);\n+});\n+\nlru.set(\"a\", [1.0, 2.0]);\nlru.size\n// 17\nlru.set(\"b\", [3.0, 4.0]);\n-// 17 (\"a\" has been expunged due to max size)\n+// 17 (\"a\" has been expunged due to max size constraint)\n[...lru.keys()]\n// [ 'b' ]\n",
"new_path": "packages/cache/README.md",
"old_path": "packages/cache/README.md"
},
{
"change_type": "MODIFY",
"diff": "-import { ICopy, IEmpty, ILength } from \"@thi.ng/api/api\";\n+import { ICopy, IEmpty, ILength, Predicate2, IRelease } from \"@thi.ng/api/api\";\nexport interface ICache<K, V> extends\n- Iterable<CacheEntry<K, V>>,\n+ Iterable<Readonly<CacheEntry<K, V>>>,\nICopy<ICache<K, V>>,\nIEmpty<ICache<K, V>>,\n- ILength {\n+ ILength,\n+ IRelease {\nreadonly size: number;\n@@ -13,13 +14,19 @@ export interface ICache<K, V> extends\nset(key: K, val: V): V;\ngetSet(key: K, fn: () => Promise<V>): Promise<V>;\ndelete(key: K): boolean;\n+\n+ entries(): IterableIterator<Readonly<CacheEntry<K, V>>>;\n+ keys(): IterableIterator<Readonly<K>>;\n+ values(): IterableIterator<Readonly<V>>;\n}\nexport interface CacheOpts<K, V> {\nksize: (k: K) => number;\nvsize: (v: V) => number;\n- maxLen: number;\n- maxSize: number;\n+ release: (k: K, v: V) => void;\n+ equiv: Predicate2<K>;\n+ maxlen: number;\n+ maxsize: number;\n}\nexport interface CacheEntry<K, V> {\n",
"new_path": "packages/cache/src/api.ts",
"old_path": "packages/cache/src/api.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -10,26 +10,35 @@ export interface LRUEntry<K, V> extends CacheEntry<K, V> {\nexport class LRUCache<K, V> implements ICache<K, V> {\n+ protected items: DCons<LRUEntry<K, V>>;\n+ protected _equiv: (a: K, b: K) => boolean;\n+ protected _release: (k: K, v: V) => void;\nprotected ksize: (k: K) => number;\nprotected vsize: (v: V) => number;\n- protected items: DCons<LRUEntry<K, V>>;\n+\nprotected _size: number;\n- protected maxSize: number;\n- protected maxLen: number;\n+ protected maxsize: number;\n+ protected maxlen: number;\n- constructor(opts?: Partial<CacheOpts<K, V>>) {\n+ constructor(pairs?: Iterable<[K, V]>, opts?: Partial<CacheOpts<K, V>>) {\nopts = Object.assign({\n- maxLen: Number.POSITIVE_INFINITY,\n- maxSize: Number.POSITIVE_INFINITY,\n+ maxlen: Number.POSITIVE_INFINITY,\n+ maxsize: Number.POSITIVE_INFINITY,\n+ equiv: equiv,\nksize: () => 0,\nvsize: () => 0,\n}, opts);\nthis.items = new DCons<LRUEntry<K, V>>();\nthis._size = 0;\n+ this._equiv = opts.equiv;\nthis.ksize = opts.ksize;\nthis.vsize = opts.vsize;\n- this.maxSize = opts.maxSize;\n- this.maxLen = opts.maxLen;\n+ this._release = opts.release;\n+ this.maxsize = opts.maxsize;\n+ this.maxlen = opts.maxlen;\n+ if (pairs) {\n+ this.into(pairs);\n+ }\n}\nget length() {\n@@ -52,7 +61,7 @@ export class LRUCache<K, V> implements ICache<K, V> {\nyield* map((e) => e.k, this.items);\n}\n- *values(): Iterator<Readonly<V>> {\n+ *values(): IterableIterator<Readonly<V>> {\nyield* map((e) => e.v, this.items);\n}\n@@ -63,14 +72,29 @@ export class LRUCache<K, V> implements ICache<K, V> {\n}\nempty(): LRUCache<K, V> {\n- return new LRUCache<K, V>({\n- maxLen: this.maxLen,\n- maxSize: this.maxSize,\n+ return new LRUCache<K, V>(null, {\n+ maxlen: this.maxlen,\n+ maxsize: this.maxsize,\n+ equiv: this._equiv,\n+ release: this._release,\nksize: this.ksize,\nvsize: this.vsize,\n});\n}\n+ release() {\n+ const release = this._release;\n+ this._size = 0;\n+ if (release) {\n+ let e;\n+ while (e = this.items.drop()) {\n+ release(e.k, e.v);\n+ }\n+ return true;\n+ }\n+ return this.items.release();\n+ }\n+\nhas(key: K): boolean {\nreturn !!this.find(key);\n}\n@@ -80,23 +104,14 @@ export class LRUCache<K, V> implements ICache<K, V> {\nif (!e) {\nreturn notFound;\n}\n- this.items.splice(e, 1);\n- e.value.t = Date.now();\n- this.items.push(e.value);\n- return e.value.v;\n+ return this.resetEntry(e);\n}\nset(key: K, value: V) {\nthis.delete(key);\nconst size = this.ksize(key) + this.vsize(value);\nthis._size += size;\n- while (this._size > this.maxSize || this.length >= this.maxLen) {\n- const e = this.items.drop();\n- if (!e) {\n- return;\n- }\n- this._size -= e.s;\n- }\n+ this.ensureSize();\nthis.items.push({\nk: key,\nv: value,\n@@ -106,15 +121,19 @@ export class LRUCache<K, V> implements ICache<K, V> {\nreturn value;\n}\n- getSet(key: K, fn: () => Promise<V>): Promise<V> {\n+ into(pairs: Iterable<[K, V]>) {\n+ for (let p of pairs) {\n+ this.set(p[0], p[1]);\n+ }\n+ return this;\n+ }\n+\n+ getSet(key: K, retrieve: () => Promise<V>): Promise<V> {\nconst e = this.find(key);\nif (e) {\n- this.items.splice(e, 1);\n- e.value.t = Date.now();\n- this.items.push(e.value);\n- return Promise.resolve(e.value.v);\n+ return Promise.resolve(this.resetEntry(e));\n}\n- return fn().then((v) => this.set(key, v));\n+ return retrieve().then((v) => this.set(key, v));\n}\ndelete(key: K): boolean {\n@@ -128,6 +147,26 @@ export class LRUCache<K, V> implements ICache<K, V> {\n}\nprotected find(key: K): ConsCell<LRUEntry<K, V>> {\n- return this.items.findWith((x) => equiv(x.k, key));\n+ const eq = this._equiv;\n+ return this.items.findWith((x) => eq(x.k, key));\n+ }\n+\n+ protected resetEntry(e: ConsCell<LRUEntry<K, V>>) {\n+ e.value.t = Date.now();\n+ this.items.splice(e, 1).push(e.value);\n+ return e.value.v;\n+ }\n+\n+ protected ensureSize() {\n+ const release = this._release;\n+ while (this._size > this.maxsize || this.length >= this.maxlen) {\n+ const e = this.items.drop();\n+ if (!e) {\n+ return false;\n+ }\n+ release && release(e.k, e.v);\n+ this._size -= e.s;\n+ }\n+ return true;\n}\n}\n",
"new_path": "packages/cache/src/lru.ts",
"old_path": "packages/cache/src/lru.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
refactor(cache): update/extend ICache & LRUCache, update readme
| 1
|
refactor
|
cache
|
679,913
|
21.04.2018 01:55:48
| -3,600
|
3947419cd0570e2e9b3efdc3339c9e5f17fef6ef
|
fix(cache): don't insert new val if > maxsize
|
[
{
"change_type": "MODIFY",
"diff": "@@ -111,13 +111,14 @@ export class LRUCache<K, V> implements ICache<K, V> {\nthis.delete(key);\nconst size = this.ksize(key) + this.vsize(value);\nthis._size += size;\n- this.ensureSize();\n+ if (this.ensureSize()) {\nthis.items.push({\nk: key,\nv: value,\ns: size,\nt: Date.now(),\n});\n+ }\nreturn value;\n}\n",
"new_path": "packages/cache/src/lru.ts",
"old_path": "packages/cache/src/lru.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
fix(cache): don't insert new val if > maxsize
| 1
|
fix
|
cache
|
679,913
|
21.04.2018 15:15:45
| -3,600
|
19f7e761abf7b1ce4f40443b52698715e14234bb
|
feat(dcons): add asHead()/asTail()
|
[
{
"change_type": "MODIFY",
"diff": "@@ -474,6 +474,32 @@ export class DCons<T> implements\nreturn this;\n}\n+ asHead(cell: ConsCell<T>) {\n+ if (cell === this.head) {\n+ return this;\n+ }\n+ this.remove(cell);\n+ this.head.prev = cell;\n+ cell.next = this.head;\n+ cell.prev = undefined;\n+ this.head = cell;\n+ this._length++;\n+ return this;\n+ }\n+\n+ asTail(cell: ConsCell<T>) {\n+ if (cell === this.tail) {\n+ return this;\n+ }\n+ this.remove(cell);\n+ this.tail.next = cell;\n+ cell.prev = this.tail;\n+ cell.next = undefined;\n+ this.tail = cell;\n+ this._length++;\n+ return this;\n+ }\n+\ntoString() {\nlet res: any = [];\nlet cell = this.head;\n",
"new_path": "packages/dcons/src/index.ts",
"old_path": "packages/dcons/src/index.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
feat(dcons): add asHead()/asTail()
| 1
|
feat
|
dcons
|
679,913
|
21.04.2018 15:26:11
| -3,600
|
00ca831f4973654788c4e306d30327132d02c665
|
refactor(cache): make LRU ops O(1), update/remove (some) interfaces
use Map to index dcons cells
update CachOpts (add map ctor option)
remove LRUEntry
update LRU entries iterator
|
[
{
"change_type": "MODIFY",
"diff": "-import { ICopy, IEmpty, ILength, Predicate2, IRelease } from \"@thi.ng/api/api\";\n+import { ICopy, IEmpty, ILength, IRelease } from \"@thi.ng/api/api\";\nexport interface ICache<K, V> extends\n- Iterable<Readonly<CacheEntry<K, V>>>,\n+ Iterable<Readonly<[K, CacheEntry<K, V>]>>,\nICopy<ICache<K, V>>,\nIEmpty<ICache<K, V>>,\nILength,\n@@ -15,7 +15,7 @@ export interface ICache<K, V> extends\ngetSet(key: K, fn: () => Promise<V>): Promise<V>;\ndelete(key: K): boolean;\n- entries(): IterableIterator<Readonly<CacheEntry<K, V>>>;\n+ entries(): IterableIterator<Readonly<[K, CacheEntry<K, V>]>>;\nkeys(): IterableIterator<Readonly<K>>;\nvalues(): IterableIterator<Readonly<V>>;\n}\n@@ -24,7 +24,7 @@ export interface CacheOpts<K, V> {\nksize: (k: K) => number;\nvsize: (v: V) => number;\nrelease: (k: K, v: V) => void;\n- equiv: Predicate2<K>;\n+ map: () => Map<K, any>;\nmaxlen: number;\nmaxsize: number;\n}\n",
"new_path": "packages/cache/src/api.ts",
"old_path": "packages/cache/src/api.ts"
},
{
"change_type": "MODIFY",
"diff": "-import { equiv } from \"@thi.ng/api/equiv\";\nimport { DCons, ConsCell } from \"@thi.ng/dcons\";\nimport { map } from \"@thi.ng/iterators/map\";\n-import { ICache, CacheOpts, CacheEntry } from \"./api\";\n-\n-export interface LRUEntry<K, V> extends CacheEntry<K, V> {\n- t: number;\n-}\n+import { ICache, CacheEntry, CacheOpts } from \"./api\";\nexport class LRUCache<K, V> implements ICache<K, V> {\n- protected items: DCons<LRUEntry<K, V>>;\n- protected _equiv: (a: K, b: K) => boolean;\n- protected _release: (k: K, v: V) => void;\n- protected ksize: (k: K) => number;\n- protected vsize: (v: V) => number;\n-\n+ protected map: Map<K, ConsCell<CacheEntry<K, V>>>;\n+ protected items: DCons<CacheEntry<K, V>>;\n+ protected opts: CacheOpts<K, V>;\nprotected _size: number;\n- protected maxsize: number;\n- protected maxlen: number;\nconstructor(pairs?: Iterable<[K, V]>, opts?: Partial<CacheOpts<K, V>>) {\n- opts = Object.assign({\n+ const _opts = <CacheOpts<K, V>>Object.assign({\nmaxlen: Number.POSITIVE_INFINITY,\nmaxsize: Number.POSITIVE_INFINITY,\n- equiv: equiv,\n+ map: () => new Map<K, any>(),\nksize: () => 0,\nvsize: () => 0,\n}, opts);\n- this.items = new DCons<LRUEntry<K, V>>();\n+ this.map = _opts.map();\n+ this.items = new DCons<CacheEntry<K, V>>();\nthis._size = 0;\n- this._equiv = opts.equiv;\n- this.ksize = opts.ksize;\n- this.vsize = opts.vsize;\n- this._release = opts.release;\n- this.maxsize = opts.maxsize;\n- this.maxlen = opts.maxlen;\n+ this.opts = _opts;\nif (pairs) {\nthis.into(pairs);\n}\n@@ -53,8 +39,8 @@ export class LRUCache<K, V> implements ICache<K, V> {\nreturn this.entries();\n}\n- *entries(): IterableIterator<Readonly<CacheEntry<K, V>>> {\n- yield* this.items;\n+ *entries(): IterableIterator<Readonly<[K, CacheEntry<K, V>]>> {\n+ yield* map((e) => [e.k, e], this.items);\n}\n*keys(): IterableIterator<Readonly<K>> {\n@@ -68,23 +54,22 @@ export class LRUCache<K, V> implements ICache<K, V> {\ncopy(): ICache<K, V> {\nconst c = this.empty();\nc.items = this.items.copy();\n+ let cell = c.items.head;\n+ while (cell) {\n+ c.map.set(cell.value.k, cell);\n+ cell = cell.next;\n+ }\nreturn c;\n}\nempty(): LRUCache<K, V> {\n- return new LRUCache<K, V>(null, {\n- maxlen: this.maxlen,\n- maxsize: this.maxsize,\n- equiv: this._equiv,\n- release: this._release,\n- ksize: this.ksize,\n- vsize: this.vsize,\n- });\n+ return new LRUCache<K, V>(null, this.opts);\n}\nrelease() {\n- const release = this._release;\nthis._size = 0;\n+ this.map.clear();\n+ const release = this.opts.release;\nif (release) {\nlet e;\nwhile (e = this.items.drop()) {\n@@ -96,11 +81,11 @@ export class LRUCache<K, V> implements ICache<K, V> {\n}\nhas(key: K): boolean {\n- return !!this.find(key);\n+ return this.map.has(key);\n}\nget(key: K, notFound?: V): V {\n- const e = this.find(key);\n+ const e = this.map.get(key);\nif (!e) {\nreturn notFound;\n}\n@@ -108,16 +93,25 @@ export class LRUCache<K, V> implements ICache<K, V> {\n}\nset(key: K, value: V) {\n- this.delete(key);\n- const size = this.ksize(key) + this.vsize(value);\n+ const size = this.opts.ksize(key) + this.opts.vsize(value);\n+ const e = this.map.get(key);\n+ if (e) {\n+ this._size -= e.value.s;\n+ }\nthis._size += size;\nif (this.ensureSize()) {\n+ if (e) {\n+ e.value.v = value;\n+ e.value.s = size;\n+ this.items.asTail(e);\n+ } else {\nthis.items.push({\nk: key,\nv: value,\ns: size,\n- t: Date.now(),\n});\n+ this.map.set(key, this.items.tail);\n+ }\n}\nreturn value;\n}\n@@ -130,7 +124,7 @@ export class LRUCache<K, V> implements ICache<K, V> {\n}\ngetSet(key: K, retrieve: () => Promise<V>): Promise<V> {\n- const e = this.find(key);\n+ const e = this.map.get(key);\nif (e) {\nreturn Promise.resolve(this.resetEntry(e));\n}\n@@ -138,33 +132,31 @@ export class LRUCache<K, V> implements ICache<K, V> {\n}\ndelete(key: K): boolean {\n- const e = this.find(key);\n+ const e = this.map.get(key);\nif (e) {\n- this.items.splice(e, 1);\n+ this.map.delete(key);\n+ this.items.remove(e);\nthis._size -= e.value.s;\nreturn true;\n}\nreturn false;\n}\n- protected find(key: K): ConsCell<LRUEntry<K, V>> {\n- const eq = this._equiv;\n- return this.items.findWith((x) => eq(x.k, key));\n- }\n-\n- protected resetEntry(e: ConsCell<LRUEntry<K, V>>) {\n- e.value.t = Date.now();\n- this.items.splice(e, 1).push(e.value);\n+ protected resetEntry(e: ConsCell<CacheEntry<K, V>>) {\n+ this.items.asTail(e);\nreturn e.value.v;\n}\nprotected ensureSize() {\n- const release = this._release;\n- while (this._size > this.maxsize || this.length >= this.maxlen) {\n+ const release = this.opts.release;\n+ const maxs = this.opts.maxsize;\n+ const maxl = this.opts.maxlen;\n+ while (this._size > maxs || this.length >= maxl) {\nconst e = this.items.drop();\nif (!e) {\nreturn false;\n}\n+ this.map.delete(e.k);\nrelease && release(e.k, e.v);\nthis._size -= e.s;\n}\n",
"new_path": "packages/cache/src/lru.ts",
"old_path": "packages/cache/src/lru.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
refactor(cache): make LRU ops O(1), update/remove (some) interfaces
- use Map to index dcons cells
- update CachOpts (add map ctor option)
- remove LRUEntry
- update LRU entries iterator
| 1
|
refactor
|
cache
|
679,913
|
21.04.2018 17:11:11
| -3,600
|
26c4cfd0daae89060e280816064de925d324dce8
|
feat(cache): add MRUCache, update package & readme
|
[
{
"change_type": "MODIFY",
"diff": "{\n\"name\": \"@thi.ng/cache\",\n\"version\": \"0.0.1\",\n- \"description\": \"TODO\",\n+ \"description\": \"In-memory cache implementations with ES6 Map-like API and different eviction strategies\",\n\"main\": \"./index.js\",\n\"typings\": \"./index.d.ts\",\n\"repository\": \"https://github.com/thi-ng/umbrella\",\n",
"new_path": "packages/cache/package.json",
"old_path": "packages/cache/package.json"
},
{
"change_type": "MODIFY",
"diff": "export * from \"./api\";\nexport * from \"./lru\";\n+export * from \"./mru\";\n",
"new_path": "packages/cache/src/index.ts",
"old_path": "packages/cache/src/index.ts"
},
{
"change_type": "ADD",
"diff": "+import { ConsCell } from \"@thi.ng/dcons\";\n+\n+import { CacheEntry, CacheOpts } from \"./api\";\n+import { LRUCache } from \"./lru\";\n+\n+export class MRUCache<K, V> extends LRUCache<K, V> {\n+\n+ constructor(pairs?: Iterable<[K, V]>, opts?: Partial<CacheOpts<K, V>>) {\n+ super(pairs, opts);\n+ }\n+\n+ empty(): MRUCache<K, V> {\n+ return new MRUCache<K, V>(null, this.opts);\n+ }\n+\n+ set(key: K, value: V) {\n+ const size = this.opts.ksize(key) + this.opts.vsize(value);\n+ const e = this.map.get(key);\n+ if (e) {\n+ this._size -= e.value.s;\n+ }\n+ this._size += size;\n+ if (this.ensureSize()) {\n+ if (e) {\n+ e.value.v = value;\n+ e.value.s = size;\n+ this.items.asHead(e);\n+ } else {\n+ this.items.cons({\n+ k: key,\n+ v: value,\n+ s: size,\n+ });\n+ this.map.set(key, this.items.head);\n+ }\n+ }\n+ return value;\n+ }\n+\n+ protected resetEntry(e: ConsCell<CacheEntry<K, V>>) {\n+ this.items.asHead(e);\n+ return e.value.v;\n+ }\n+}\n",
"new_path": "packages/cache/src/mru.ts",
"old_path": null
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
feat(cache): add MRUCache, update package & readme
| 1
|
feat
|
cache
|
679,913
|
21.04.2018 17:55:43
| -3,600
|
0ea0847d0229ed3d9ee78505d8c1f08ae974539f
|
feat(heaps): import package
|
[
{
"change_type": "ADD",
"diff": "+build\n+coverage\n+dev\n+doc\n+src*\n+test\n+.nyc_output\n+tsconfig.json\n+*.tgz\n+*.html\n",
"new_path": "packages/heaps/.npmignore",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+ Apache License\n+ Version 2.0, January 2004\n+ http://www.apache.org/licenses/\n+\n+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n+\n+ 1. Definitions.\n+\n+ \"License\" shall mean the terms and conditions for use, reproduction,\n+ and distribution as defined by Sections 1 through 9 of this document.\n+\n+ \"Licensor\" shall mean the copyright owner or entity authorized by\n+ the copyright owner that is granting the License.\n+\n+ \"Legal Entity\" shall mean the union of the acting entity and all\n+ other entities that control, are controlled by, or are under common\n+ control with that entity. For the purposes of this definition,\n+ \"control\" means (i) the power, direct or indirect, to cause the\n+ direction or management of such entity, whether by contract or\n+ otherwise, or (ii) ownership of fifty percent (50%) or more of the\n+ outstanding shares, or (iii) beneficial ownership of such entity.\n+\n+ \"You\" (or \"Your\") shall mean an individual or Legal Entity\n+ exercising permissions granted by this License.\n+\n+ \"Source\" form shall mean the preferred form for making modifications,\n+ including but not limited to software source code, documentation\n+ source, and configuration files.\n+\n+ \"Object\" form shall mean any form resulting from mechanical\n+ transformation or translation of a Source form, including but\n+ not limited to compiled object code, generated documentation,\n+ and conversions to other media types.\n+\n+ \"Work\" shall mean the work of authorship, whether in Source or\n+ Object form, made available under the License, as indicated by a\n+ copyright notice that is included in or attached to the work\n+ (an example is provided in the Appendix below).\n+\n+ \"Derivative Works\" shall mean any work, whether in Source or Object\n+ form, that is based on (or derived from) the Work and for which the\n+ editorial revisions, annotations, elaborations, or other modifications\n+ represent, as a whole, an original work of authorship. For the purposes\n+ of this License, Derivative Works shall not include works that remain\n+ separable from, or merely link (or bind by name) to the interfaces of,\n+ the Work and Derivative Works thereof.\n+\n+ \"Contribution\" shall mean any work of authorship, including\n+ the original version of the Work and any modifications or additions\n+ to that Work or Derivative Works thereof, that is intentionally\n+ submitted to Licensor for inclusion in the Work by the copyright owner\n+ or by an individual or Legal Entity authorized to submit on behalf of\n+ the copyright owner. For the purposes of this definition, \"submitted\"\n+ means any form of electronic, verbal, or written communication sent\n+ to the Licensor or its representatives, including but not limited to\n+ communication on electronic mailing lists, source code control systems,\n+ and issue tracking systems that are managed by, or on behalf of, the\n+ Licensor for the purpose of discussing and improving the Work, but\n+ excluding communication that is conspicuously marked or otherwise\n+ designated in writing by the copyright owner as \"Not a Contribution.\"\n+\n+ \"Contributor\" shall mean Licensor and any individual or Legal Entity\n+ on behalf of whom a Contribution has been received by Licensor and\n+ subsequently incorporated within the Work.\n+\n+ 2. Grant of Copyright License. Subject to the terms and conditions of\n+ this License, each Contributor hereby grants to You a perpetual,\n+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n+ copyright license to reproduce, prepare Derivative Works of,\n+ publicly display, publicly perform, sublicense, and distribute the\n+ Work and such Derivative Works in Source or Object form.\n+\n+ 3. Grant of Patent License. Subject to the terms and conditions of\n+ this License, each Contributor hereby grants to You a perpetual,\n+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n+ (except as stated in this section) patent license to make, have made,\n+ use, offer to sell, sell, import, and otherwise transfer the Work,\n+ where such license applies only to those patent claims licensable\n+ by such Contributor that are necessarily infringed by their\n+ Contribution(s) alone or by combination of their Contribution(s)\n+ with the Work to which such Contribution(s) was submitted. If You\n+ institute patent litigation against any entity (including a\n+ cross-claim or counterclaim in a lawsuit) alleging that the Work\n+ or a Contribution incorporated within the Work constitutes direct\n+ or contributory patent infringement, then any patent licenses\n+ granted to You under this License for that Work shall terminate\n+ as of the date such litigation is filed.\n+\n+ 4. Redistribution. You may reproduce and distribute copies of the\n+ Work or Derivative Works thereof in any medium, with or without\n+ modifications, and in Source or Object form, provided that You\n+ meet the following conditions:\n+\n+ (a) You must give any other recipients of the Work or\n+ Derivative Works a copy of this License; and\n+\n+ (b) You must cause any modified files to carry prominent notices\n+ stating that You changed the files; and\n+\n+ (c) You must retain, in the Source form of any Derivative Works\n+ that You distribute, all copyright, patent, trademark, and\n+ attribution notices from the Source form of the Work,\n+ excluding those notices that do not pertain to any part of\n+ the Derivative Works; and\n+\n+ (d) If the Work includes a \"NOTICE\" text file as part of its\n+ distribution, then any Derivative Works that You distribute must\n+ include a readable copy of the attribution notices contained\n+ within such NOTICE file, excluding those notices that do not\n+ pertain to any part of the Derivative Works, in at least one\n+ of the following places: within a NOTICE text file distributed\n+ as part of the Derivative Works; within the Source form or\n+ documentation, if provided along with the Derivative Works; or,\n+ within a display generated by the Derivative Works, if and\n+ wherever such third-party notices normally appear. The contents\n+ of the NOTICE file are for informational purposes only and\n+ do not modify the License. You may add Your own attribution\n+ notices within Derivative Works that You distribute, alongside\n+ or as an addendum to the NOTICE text from the Work, provided\n+ that such additional attribution notices cannot be construed\n+ as modifying the License.\n+\n+ You may add Your own copyright statement to Your modifications and\n+ may provide additional or different license terms and conditions\n+ for use, reproduction, or distribution of Your modifications, or\n+ for any such Derivative Works as a whole, provided Your use,\n+ reproduction, and distribution of the Work otherwise complies with\n+ the conditions stated in this License.\n+\n+ 5. Submission of Contributions. Unless You explicitly state otherwise,\n+ any Contribution intentionally submitted for inclusion in the Work\n+ by You to the Licensor shall be under the terms and conditions of\n+ this License, without any additional terms or conditions.\n+ Notwithstanding the above, nothing herein shall supersede or modify\n+ the terms of any separate license agreement you may have executed\n+ with Licensor regarding such Contributions.\n+\n+ 6. Trademarks. This License does not grant permission to use the trade\n+ names, trademarks, service marks, or product names of the Licensor,\n+ except as required for reasonable and customary use in describing the\n+ origin of the Work and reproducing the content of the NOTICE file.\n+\n+ 7. Disclaimer of Warranty. Unless required by applicable law or\n+ agreed to in writing, Licensor provides the Work (and each\n+ Contributor provides its Contributions) on an \"AS IS\" BASIS,\n+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n+ implied, including, without limitation, any warranties or conditions\n+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n+ PARTICULAR PURPOSE. You are solely responsible for determining the\n+ appropriateness of using or redistributing the Work and assume any\n+ risks associated with Your exercise of permissions under this License.\n+\n+ 8. Limitation of Liability. In no event and under no legal theory,\n+ whether in tort (including negligence), contract, or otherwise,\n+ unless required by applicable law (such as deliberate and grossly\n+ negligent acts) or agreed to in writing, shall any Contributor be\n+ liable to You for damages, including any direct, indirect, special,\n+ incidental, or consequential damages of any character arising as a\n+ result of this License or out of the use or inability to use the\n+ Work (including but not limited to damages for loss of goodwill,\n+ work stoppage, computer failure or malfunction, or any and all\n+ other commercial damages or losses), even if such Contributor\n+ has been advised of the possibility of such damages.\n+\n+ 9. Accepting Warranty or Additional Liability. While redistributing\n+ the Work or Derivative Works thereof, You may choose to offer,\n+ and charge a fee for, acceptance of support, warranty, indemnity,\n+ or other liability obligations and/or rights consistent with this\n+ License. However, in accepting such obligations, You may act only\n+ on Your own behalf and on Your sole responsibility, not on behalf\n+ of any other Contributor, and only if You agree to indemnify,\n+ defend, and hold each Contributor harmless for any liability\n+ incurred by, or claims asserted against, such Contributor by reason\n+ of your accepting any such warranty or additional liability.\n+\n+ END OF TERMS AND CONDITIONS\n+\n+ APPENDIX: How to apply the Apache License to your work.\n+\n+ To apply the Apache License to your work, attach the following\n+ boilerplate notice, with the fields enclosed by brackets \"{}\"\n+ replaced with your own identifying information. (Don't include\n+ the brackets!) The text should be enclosed in the appropriate\n+ comment syntax for the file format. We also recommend that a\n+ file or class name and description of purpose be included on the\n+ same \"printed page\" as the copyright notice for easier\n+ identification within third-party archives.\n+\n+ Copyright {yyyy} {name of copyright owner}\n+\n+ Licensed under the Apache License, Version 2.0 (the \"License\");\n+ you may not use this file except in compliance with the License.\n+ You may obtain a copy of the License at\n+\n+ http://www.apache.org/licenses/LICENSE-2.0\n+\n+ Unless required by applicable law or agreed to in writing, software\n+ distributed under the License is distributed on an \"AS IS\" BASIS,\n+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ See the License for the specific language governing permissions and\n+ limitations under the License.\n",
"new_path": "packages/heaps/LICENSE",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+# @thi.ng/heaps\n+\n+[](https://www.npmjs.com/package/@thi.ng/heaps)\n+\n+## About\n+\n+Type agnostic binary heap & d-ary heap implementations with customizable\n+ordering and fanout / tree arity (in case of `DHeap`). Both `Heap` and\n+`DHeap` have identical API.\n+\n+## Installation\n+\n+```\n+yarn add @thi.ng/heaps\n+```\n+\n+## Usage examples\n+\n+```typescript\n+import { Heap, DHeap } from \"@thi.ng/heaps\";\n+\n+const h = new DHeap(\n+ [5, 2, 10, 15, 18, 23, 22, -1],\n+ { compare: (a,b) => b - a, d: 4 }\n+);\n+h.pop();\n+// 23\n+h.pop();\n+// 22\n+\n+h.pushPop(16)\n+// 18\n+h.pop();\n+// 16\n+```\n+\n+## Authors\n+\n+- Karsten Schmidt\n+\n+## License\n+\n+© 2017 - 2018 Karsten Schmidt // Apache Software License 2.0\n",
"new_path": "packages/heaps/README.md",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+{\n+ \"name\": \"@thi.ng/heaps\",\n+ \"version\": \"0.0.1\",\n+ \"description\": \"Generic binary heap & d-ary heap implementations with customizable ordering\",\n+ \"main\": \"./index.js\",\n+ \"typings\": \"./index.d.ts\",\n+ \"repository\": \"https://github.com/thi-ng/umbrella\",\n+ \"author\": \"Karsten Schmidt <k+npm@thi.ng>\",\n+ \"license\": \"Apache-2.0\",\n+ \"scripts\": {\n+ \"build\": \"yarn run clean && tsc --declaration\",\n+ \"clean\": \"rm -rf *.js *.d.ts .nyc_output build coverage doc\",\n+ \"cover\": \"yarn test && nyc report --reporter=lcov\",\n+ \"doc\": \"node_modules/.bin/typedoc --mode modules --out doc src\",\n+ \"pub\": \"yarn run build && yarn publish --access public\",\n+ \"test\": \"rm -rf build && tsc -p test && nyc mocha build/test/*.js\"\n+ },\n+ \"devDependencies\": {\n+ \"@types/mocha\": \"^5.0.0\",\n+ \"@types/node\": \"^9.6.1\",\n+ \"mocha\": \"^5.0.5\",\n+ \"nyc\": \"^11.6.0\",\n+ \"typedoc\": \"^0.11.1\",\n+ \"typescript\": \"^2.8.1\"\n+ },\n+ \"dependencies\": {\n+ \"@thi.ng/api\": \"^2.2.0\"\n+ },\n+ \"keywords\": [\n+ \"ES6\",\n+ \"typescript\"\n+ ],\n+ \"publishConfig\": {\n+ \"access\": \"public\"\n+ }\n+}\n\\ No newline at end of file\n",
"new_path": "packages/heaps/package.json",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+import { Comparator } from \"@thi.ng/api/api\";\n+\n+export interface HeapOpts<T> {\n+ compare: Comparator<T>;\n+}\n+\n+export interface DHeapOpts<T> extends HeapOpts<T> {\n+ d: number;\n+}\n",
"new_path": "packages/heaps/src/api.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+import { DHeapOpts } from \"./api\";\n+import { Heap } from \"./heap\";\n+\n+/**\n+ * Generic d-ary heap / priority queue with configurable fanout (default\n+ * = 4) and ordering via user-supplied comparator. By default,\n+ * implements min-heap ordering and uses @thi.ng/api/compare. The fanout\n+ * value will be coerced to a power of 2.\n+ *\n+ * https://en.wikipedia.org/wiki/D-ary_heap\n+ */\n+export class DHeap<T> extends Heap<T> {\n+\n+ protected d: number;\n+ protected shift: number;\n+\n+ constructor(values?: Iterable<T>, opts?: DHeapOpts<T>) {\n+ super(null, opts);\n+ const d = (opts && opts.d) || 4;\n+ this.shift = (Math.log(d) / Math.LN2) | 0;\n+ this.d = 1 << this.shift;\n+ if (values) {\n+ this.into(values);\n+ }\n+ }\n+\n+ empty() {\n+ return new DHeap<T>(null, { compare: this.compare, d: this.d });\n+ }\n+\n+ push(val: T) {\n+ const vals = this.values;\n+ const shift = this.shift;\n+ const cmp = this.compare;\n+ let pos = this.values.length;\n+ let parent;\n+ vals.push(val);\n+ while (pos > 0 && cmp(vals[pos], vals[parent = pos >> shift]) < 0) {\n+ const tmp = vals[parent];\n+ vals[parent] = vals[pos];\n+ vals[pos] = tmp;\n+ pos = parent;\n+ }\n+ return val;\n+ }\n+\n+ protected propagateUp(from = 0, to?: number) {\n+ if (to === 0) { return; }\n+ const vals = this.values;\n+ const d = this.d;\n+ const cmp = this.compare;\n+ let pos, offset, i, j;\n+ to = to || vals.length - 1;\n+\n+ while (true) {\n+ pos = from;\n+ offset = d * pos;\n+ for (i = offset + 1, j = offset + d; i <= j; i++) {\n+ if (i <= to && cmp(vals[i], vals[pos]) < 0) {\n+ pos = i;\n+ }\n+ }\n+ if (pos === from) {\n+ return;\n+ }\n+ const tmp = vals[from];\n+ vals[from] = vals[pos];\n+ vals[pos] = tmp;\n+ from = pos;\n+ }\n+ }\n+}\n",
"new_path": "packages/heaps/src/dheap.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+import { ICopy, ILength, IEmpty, Comparator } from \"@thi.ng/api/api\";\n+import { compare } from \"@thi.ng/api/compare\";\n+\n+import { HeapOpts } from \"./api\";\n+\n+/**\n+ * Generic binary heap / priority queue with customizable ordering via\n+ * user-supplied comparator. By default, implements min-heap ordering\n+ * and uses @thi.ng/api/compare.\n+ *\n+ * ```\n+ * h = new Heap([20, 5, 10]);\n+ * h.push(15);\n+ *\n+ * h.pop(); // 5\n+ * h.pop(); // 10\n+ * h.pop(); // 15\n+ * h.pop(); // 20\n+ * h.pop(); // undefined\n+ * ```\n+ */\n+export class Heap<T> implements\n+ ICopy<Heap<T>>,\n+ IEmpty<Heap<T>>,\n+ ILength {\n+\n+ protected values: T[];\n+ protected compare: Comparator<T>;\n+\n+ constructor(values?: Iterable<T>, opts?: HeapOpts<T>) {\n+ opts = Object.assign({ compare: compare }, opts);\n+ this.compare = opts.compare;\n+ this.values = [];\n+ if (values) {\n+ this.into(values);\n+ }\n+ }\n+\n+ *[Symbol.iterator]() {\n+ yield* this.values;\n+ }\n+\n+ get length() {\n+ return this.values.length;\n+ }\n+\n+ copy() {\n+ const h = this.empty();\n+ h.values = this.values.slice();\n+ return h;\n+ }\n+\n+ empty() {\n+ return new Heap<T>(null, { compare: this.compare });\n+ }\n+\n+ peek() {\n+ return this.values[0];\n+ }\n+\n+ push(val: T) {\n+ this.values.push(val);\n+ return this.propagateDown(0, this.values.length - 1);\n+ }\n+\n+ pop() {\n+ const vals = this.values;\n+ const tail = vals.pop();\n+ let res: T;\n+ if (vals.length > 0) {\n+ res = vals[0];\n+ vals[0] = tail;\n+ this.propagateUp(0);\n+ } else {\n+ res = tail;\n+ }\n+ return res;\n+ }\n+\n+ pushPop(val: T) {\n+ const vals = this.values;\n+ const head = vals[0];\n+ if (vals.length > 0 && this.compare(head, val) < 0) {\n+ vals[0] = val;\n+ val = head;\n+ this.propagateUp(0);\n+ }\n+ return val;\n+ }\n+\n+ into(vals: Iterable<T>) {\n+ for (let v of vals) {\n+ this.push(v);\n+ }\n+ }\n+\n+ replaceHead(val: T) {\n+ const res = this.values[0];\n+ this.values[0] = val;\n+ this.propagateUp(0);\n+ return res;\n+ }\n+\n+ protected propagateDown(from: number, to: number) {\n+ const vals = this.values;\n+ const newVal = vals[to];\n+ const cmp = this.compare;\n+ while (to > from) {\n+ const p = (to - 1) >> 1;\n+ const parent = vals[p];\n+ if (cmp(newVal, parent) < 0) {\n+ vals[to] = parent;\n+ to = p;\n+ continue;\n+ }\n+ break;\n+ }\n+ return vals[to] = newVal;\n+ }\n+\n+ protected propagateUp(pos: number, to?: number) {\n+ if (to === 0) { return; }\n+ const vals = this.values;\n+ const newVal = vals[pos];\n+ const from = pos;\n+ const cmp = this.compare;\n+ to = to || vals.length - 1;\n+ let child = (pos << 1) + 1;\n+ while (child <= to) {\n+ const next = child + 1;\n+ if (next <= to && cmp(vals[child], vals[next]) >= 0) {\n+ child = next;\n+ }\n+ vals[pos] = vals[child];\n+ pos = child;\n+ child = (pos << 1) + 1;\n+ }\n+ vals[pos] = newVal;\n+ this.propagateDown(from, pos);\n+ }\n+}\n",
"new_path": "packages/heaps/src/heap.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+export * from \"./api\";\n+export * from \"./dheap\";\n+export * from \"./heap\";\n",
"new_path": "packages/heaps/src/index.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+// import * as assert from \"assert\";\n+// import * as heaps from \"../src/index\";\n+\n+describe(\"heaps\", () => {\n+ it(\"tests pending\");\n+});\n",
"new_path": "packages/heaps/test/index.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+{\n+ \"extends\": \"../../../tsconfig.json\",\n+ \"compilerOptions\": {\n+ \"outDir\": \"../build\"\n+ },\n+ \"include\": [\n+ \"./**/*.ts\",\n+ \"../src/**/*.ts\"\n+ ]\n+}\n",
"new_path": "packages/heaps/test/tsconfig.json",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+{\n+ \"extends\": \"../../tsconfig.json\",\n+ \"compilerOptions\": {\n+ \"outDir\": \".\"\n+ },\n+ \"include\": [\n+ \"./src/**/*.ts\"\n+ ]\n+}\n",
"new_path": "packages/heaps/tsconfig.json",
"old_path": null
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
feat(heaps): import @thi.ng/heaps package
| 1
|
feat
|
heaps
|
679,913
|
21.04.2018 21:06:23
| -3,600
|
c4a9c074f55e76787f19d1c93144e205b6d180ca
|
fix(cache): recompute size in LRUCache.delete(), extract removeEntry()
|
[
{
"change_type": "MODIFY",
"diff": "@@ -84,7 +84,7 @@ export class LRUCache<K, V> implements ICache<K, V> {\nreturn this.map.has(key);\n}\n- get(key: K, notFound?: V): V {\n+ get(key: K, notFound?: any) {\nconst e = this.map.get(key);\nif (!e) {\nreturn notFound;\n@@ -134,9 +134,7 @@ export class LRUCache<K, V> implements ICache<K, V> {\ndelete(key: K): boolean {\nconst e = this.map.get(key);\nif (e) {\n- this.map.delete(key);\n- this.items.remove(e);\n- this._size -= e.value.s;\n+ this.removeEntry(e);\nreturn true;\n}\nreturn false;\n@@ -162,4 +160,12 @@ export class LRUCache<K, V> implements ICache<K, V> {\n}\nreturn true;\n}\n+\n+ protected removeEntry(e: ConsCell<CacheEntry<K, V>>) {\n+ const ee = e.value;\n+ this.map.delete(ee.k);\n+ this.items.remove(e);\n+ this.opts.release && this.opts.release(ee.k, ee.v);\n+ this._size -= ee.s;\n+ }\n}\n",
"new_path": "packages/cache/src/lru.ts",
"old_path": "packages/cache/src/lru.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
fix(cache): recompute size in LRUCache.delete(), extract removeEntry()
| 1
|
fix
|
cache
|
679,913
|
21.04.2018 21:08:22
| -3,600
|
574b5d96f329bd1011d884212c49c47caf9adfc4
|
feat(cache): add TLRUCache
|
[
{
"change_type": "MODIFY",
"diff": "export * from \"./api\";\nexport * from \"./lru\";\nexport * from \"./mru\";\n+export * from \"./tlru\";\n",
"new_path": "packages/cache/src/index.ts",
"old_path": "packages/cache/src/index.ts"
},
{
"change_type": "ADD",
"diff": "+import { ConsCell, DCons } from \"@thi.ng/dcons\";\n+\n+import { CacheEntry, CacheOpts } from \"./api\";\n+import { LRUCache } from \"./lru\";\n+\n+export interface TLRUCacheOpts<K, V> extends CacheOpts<K, V> {\n+ ttl: number;\n+}\n+\n+export interface TLRUCacheEntry<K, V> extends CacheEntry<K, V> {\n+ t: number;\n+}\n+\n+/**\n+ * Time-aware LRU cache. Extends LRU strategy with TTL (time-to-live)\n+ * values associated to each entry. `has()` will only return true and\n+ * `get()` only returns a cached value if its TTL hasn't yet expired.\n+ * When adding a new value to the cache, first removes expired entries\n+ * and if still not sufficient space then removes entries in LRU order.\n+ * `set()` takes an optional entry specific `ttl` arg. If not given,\n+ * uses the cache instance's default (provided via ctor option arg).\n+ * If no instance TTL is given, TTL defaults to 1 hour.\n+ */\n+export class TLRUCache<K, V> extends LRUCache<K, V> {\n+\n+ protected opts: TLRUCacheOpts<K, V>;\n+ protected map: Map<K, ConsCell<TLRUCacheEntry<K, V>>>;\n+ protected items: DCons<TLRUCacheEntry<K, V>>;\n+\n+ constructor(pairs?: Iterable<[K, V]>, opts?: Partial<TLRUCacheOpts<K, V>>) {\n+ opts = Object.assign({ ttl: 60 * 60 * 1000 }, opts)\n+ super(pairs, opts);\n+ }\n+\n+ empty(): TLRUCache<K, V> {\n+ return new TLRUCache<K, V>(null, this.opts);\n+ }\n+\n+ has(key: K) {\n+ return this.get(key) !== undefined;\n+ }\n+\n+ get(key: K, notFound?: any) {\n+ const e = this.map.get(key);\n+ if (e) {\n+ if (e.value.t >= Date.now()) {\n+ return e.value.v;\n+ }\n+ this.removeEntry(e);\n+ }\n+ return notFound;\n+ }\n+\n+ set(key: K, value: V, ttl = this.opts.ttl) {\n+ const size = this.opts.ksize(key) + this.opts.vsize(value);\n+ const e = this.map.get(key);\n+ if (e) {\n+ this._size -= e.value.s;\n+ }\n+ this._size += size;\n+ if (this.ensureSize()) {\n+ const t = Date.now() + ttl;\n+ if (e) {\n+ e.value.v = value;\n+ e.value.s = size;\n+ e.value.t = t;\n+ this.items.asTail(e);\n+ } else {\n+ this.items.push({\n+ k: key,\n+ v: value,\n+ s: size,\n+ t,\n+ });\n+ this.map.set(key, this.items.tail);\n+ }\n+ }\n+ return value;\n+ }\n+\n+ protected ensureSize() {\n+ const release = this.opts.release;\n+ const maxs = this.opts.maxsize;\n+ const maxl = this.opts.maxlen;\n+ const now = Date.now();\n+ let cell = this.items.head;\n+ while (cell && (this._size > maxs || this.length >= maxl)) {\n+ if (cell.value.t < now) {\n+ this.removeEntry(cell);\n+ }\n+ cell = cell.next;\n+ }\n+ cell = this.items.head;\n+ while (cell && (this._size > maxs || this.length >= maxl)) {\n+ this.removeEntry(cell);\n+ cell = cell.next;\n+ }\n+ return true;\n+ }\n+}\n",
"new_path": "packages/cache/src/tlru.ts",
"old_path": null
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
feat(cache): add TLRUCache
| 1
|
feat
|
cache
|
679,913
|
22.04.2018 03:33:43
| -3,600
|
ab4abf55ccf966394ed8394b2b690bfc285b28e7
|
refactor(heaps): major update / simplify, fix DHeap, add accessors
|
[
{
"change_type": "MODIFY",
"diff": "@@ -19,19 +19,26 @@ yarn add @thi.ng/heaps\n```typescript\nimport { Heap, DHeap } from \"@thi.ng/heaps\";\n+// with initial values, custom comparator and heap arity\nconst h = new DHeap(\n[5, 2, 10, 15, 18, 23, 22, -1],\n- { compare: (a,b) => b - a, d: 4 }\n+ {\n+ compare: (a,b) => b - a,\n+ d: 4\n+ }\n);\n+\nh.pop();\n// 23\nh.pop();\n// 22\n+// insert new value unless it's a new root\n+// else pop and return current root\nh.pushPop(16)\n// 18\n-h.pop();\n-// 16\n+\n+h.push(24);\n```\n## Authors\n",
"new_path": "packages/heaps/README.md",
"old_path": "packages/heaps/README.md"
},
{
"change_type": "MODIFY",
"diff": "+import { compare } from \"@thi.ng/api/compare\";\n+\nimport { DHeapOpts } from \"./api\";\nimport { Heap } from \"./heap\";\n/**\n- * Generic d-ary heap / priority queue with configurable fanout (default\n+ * Generic d-ary heap / priority queue with configurable arity (default\n* = 4) and ordering via user-supplied comparator. By default,\n- * implements min-heap ordering and uses @thi.ng/api/compare. The fanout\n- * value will be coerced to a power of 2.\n+ * implements min-heap ordering and uses @thi.ng/api/compare. The arity\n+ * `d` must be >= 2. If `d=2`, the default binary `Heap` implementation\n+ * will be faster.\n*\n* https://en.wikipedia.org/wiki/D-ary_heap\n*/\nexport class DHeap<T> extends Heap<T> {\n+ /**\n+ * Returns index of parent node or -1 if `idx < 1`.\n+ *\n+ * @param idx\n+ * @param d\n+ */\n+ static parentIndex(idx: number, d = 4) {\n+ return idx > 0 ? ((idx - 1) / d) | 0 : -1;\n+ }\n+\n+ /**\n+ * If `d=2` return index of other sibling. For all other `d`\n+ * there're no unique solutions so always returns -1.\n+ *\n+ * @param idx\n+ * @param d\n+ */\n+ static siblingIndex(idx: number, d = 4) {\n+ return d === 2 ? Heap.siblingIndex(idx) : -1;\n+ }\n+\n+ /**\n+ * Returns index of 1st child or -1 if `idx < 0`.\n+ *\n+ * @param idx\n+ * @param d\n+ */\n+ static childIndex(idx: number, d = 4) {\n+ return idx >= 0 ? (idx * d) + 1 : -1;\n+ }\n+\nprotected d: number;\n- protected shift: number;\n- constructor(values?: Iterable<T>, opts?: DHeapOpts<T>) {\n- super(null, opts);\n- const d = (opts && opts.d) || 4;\n- this.shift = (Math.log(d) / Math.LN2) | 0;\n- this.d = 1 << this.shift;\n+ constructor(values?: Iterable<T>, opts?: Partial<DHeapOpts<T>>) {\n+ super(null, Object.assign({ compare }, opts));\n+ this.d = (opts && opts.d) || 4;\n+ this.values = [];\nif (values) {\nthis.into(values);\n}\n}\n- empty() {\n- return new DHeap<T>(null, { compare: this.compare, d: this.d });\n+ parent(n: number) {\n+ n = DHeap.parentIndex(n, this.d);\n+ return n >= 0 ? this.values[n] : undefined;\n}\n- push(val: T) {\n+ children(n: number) {\n+ n = DHeap.childIndex(n, this.d);\nconst vals = this.values;\n- const shift = this.shift;\n- const cmp = this.compare;\n- let pos = this.values.length;\n- let parent;\n- vals.push(val);\n- while (pos > 0 && cmp(vals[pos], vals[parent = pos >> shift]) < 0) {\n- const tmp = vals[parent];\n- vals[parent] = vals[pos];\n- vals[pos] = tmp;\n- pos = parent;\n+ if (n >= vals.length) return;\n+ return vals.slice(n, n + this.d);\n+ }\n+\n+ leaves() {\n+ const vals = this.values;\n+ if (!vals.length) {\n+ return []\n+ }\n+ return vals.slice(DHeap.parentIndex(vals.length - 1, this.d) + 1);\n+ }\n+\n+ heapify() {\n+ for (var i = ((this.values.length - 1) / this.d) | 0; i >= 0; i--) {\n+ this.percolateDown(i);\n}\n- return val;\n}\n- protected propagateUp(from = 0, to?: number) {\n- if (to === 0) { return; }\n+ protected percolateUp(i: number) {\nconst vals = this.values;\n+ const node = vals[i];\nconst d = this.d;\nconst cmp = this.compare;\n- let pos, offset, i, j;\n- to = to || vals.length - 1;\n+ while (i > 0) {\n+ const pi = ((i - 1) / d) | 0;\n+ const parent = vals[pi];\n+ if (cmp(node, parent) >= 0) {\n+ break;\n+ }\n+ vals[pi] = node;\n+ vals[i] = parent;\n+ i = pi;\n+ }\n+ }\n- while (true) {\n- pos = from;\n- offset = d * pos;\n- for (i = offset + 1, j = offset + d; i <= j; i++) {\n- if (i <= to && cmp(vals[i], vals[pos]) < 0) {\n- pos = i;\n+ protected percolateDown(i: number) {\n+ const vals = this.values;\n+ const n = vals.length;\n+ const d = this.d;\n+ const node = vals[i];\n+ const cmp = this.compare;\n+ let child = (i * d) + 1, minChild;\n+ while (child < n) {\n+ minChild = child;\n+ for (let j = child + 1, k = child + d; j < k; j++) {\n+ if (j < n && cmp(vals[j], vals[minChild]) < 0) {\n+ minChild = j;\n}\n}\n- if (pos === from) {\n- return;\n+ if (cmp(vals[minChild], node) < 0) {\n+ vals[i] = vals[minChild];\n+ } else {\n+ break;\n}\n- const tmp = vals[from];\n- vals[from] = vals[pos];\n- vals[pos] = tmp;\n- from = pos;\n+ i = minChild;\n+ child = (i * d) + 1;\n}\n+ vals[i] = node;\n}\n}\n\\ No newline at end of file\n",
"new_path": "packages/heaps/src/dheap.ts",
"old_path": "packages/heaps/src/dheap.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -24,6 +24,18 @@ export class Heap<T> implements\nIEmpty<Heap<T>>,\nILength {\n+ static parentIndex(idx: number) {\n+ return idx > 0 ? (idx - 1) >> 1 : -1;\n+ }\n+\n+ static siblingIndex(idx: number) {\n+ return idx > 0 ? idx + 1 - ((idx & 1) << 1) : -1;\n+ }\n+\n+ static childIndex(idx: number) {\n+ return idx >= 0 ? (idx << 1) + 1 : -1;\n+ }\n+\nprotected values: T[];\nprotected compare: Comparator<T>;\n@@ -50,6 +62,10 @@ export class Heap<T> implements\nreturn h;\n}\n+ clear() {\n+ this.values.length = 0;\n+ }\n+\nempty() {\nreturn new Heap<T>(null, { compare: this.compare });\n}\n@@ -60,7 +76,8 @@ export class Heap<T> implements\npush(val: T) {\nthis.values.push(val);\n- return this.propagateDown(0, this.values.length - 1);\n+ this.percolateUp(this.values.length - 1);\n+ return this;\n}\npop() {\n@@ -70,7 +87,7 @@ export class Heap<T> implements\nif (vals.length > 0) {\nres = vals[0];\nvals[0] = tail;\n- this.propagateUp(0);\n+ this.percolateDown(0);\n} else {\nres = tail;\n}\n@@ -83,7 +100,7 @@ export class Heap<T> implements\nif (vals.length > 0 && this.compare(head, val) < 0) {\nvals[0] = val;\nval = head;\n- this.propagateUp(0);\n+ this.percolateDown(0);\n}\nreturn val;\n}\n@@ -92,50 +109,87 @@ export class Heap<T> implements\nfor (let v of vals) {\nthis.push(v);\n}\n+ return this;\n}\nreplaceHead(val: T) {\nconst res = this.values[0];\nthis.values[0] = val;\n- this.propagateUp(0);\n+ this.percolateDown(0);\nreturn res;\n}\n- protected propagateDown(from: number, to: number) {\n+ heapify() {\n+ for (var i = (this.values.length - 1) >> 1; i >= 0; i--) {\n+ this.percolateDown(i);\n+ }\n+ }\n+\n+ *sorted() {\n+ const h = this.copy();\n+ let x: T;\n+ while ((x = h.pop()) !== undefined) {\n+ yield x;\n+ }\n+ }\n+\n+ parent(n: number) {\n+ n = Heap.parentIndex(n);\n+ return n >= 0 ? this.values[n] : undefined;\n+ }\n+\n+ children(n: number) {\n+ n = Heap.childIndex(n);\nconst vals = this.values;\n- const newVal = vals[to];\n- const cmp = this.compare;\n- while (to > from) {\n- const p = (to - 1) >> 1;\n- const parent = vals[p];\n- if (cmp(newVal, parent) < 0) {\n- vals[to] = parent;\n- to = p;\n- continue;\n+ const m = vals.length;\n+ if (n >= m) return;\n+ if (n === m - 1) return [vals[n]];\n+ return [vals[n], vals[n + 1]];\n+ }\n+\n+ leaves() {\n+ const vals = this.values;\n+ if (!vals.length) {\n+ return []\n+ }\n+ return vals.slice(Heap.parentIndex(vals.length - 1) + 1);\n}\n+\n+ protected percolateUp(i: number) {\n+ const vals = this.values;\n+ const node = vals[i];\n+ const cmp = this.compare;\n+ while (i > 0) {\n+ const pi = (i - 1) >> 1;\n+ const parent = vals[pi];\n+ if (cmp(node, parent) >= 0) {\nbreak;\n}\n- return vals[to] = newVal;\n+ vals[pi] = node;\n+ vals[i] = parent;\n+ i = pi;\n+ }\n}\n- protected propagateUp(pos: number, to?: number) {\n- if (to === 0) { return; }\n+ protected percolateDown(i: number) {\nconst vals = this.values;\n- const newVal = vals[pos];\n- const from = pos;\n+ const n = vals.length;\n+ const node = vals[i];\nconst cmp = this.compare;\n- to = to || vals.length - 1;\n- let child = (pos << 1) + 1;\n- while (child <= to) {\n+ let child = (i << 1) + 1;\n+ while (child < n) {\nconst next = child + 1;\n- if (next <= to && cmp(vals[child], vals[next]) >= 0) {\n+ if (next < n && cmp(vals[child], vals[next]) >= 0) {\nchild = next;\n}\n- vals[pos] = vals[child];\n- pos = child;\n- child = (pos << 1) + 1;\n+ if (cmp(vals[child], node) < 0) {\n+ vals[i] = vals[child];\n+ } else {\n+ break;\n+ }\n+ i = child;\n+ child = (i << 1) + 1;\n}\n- vals[pos] = newVal;\n- this.propagateDown(from, pos);\n+ vals[i] = node;\n}\n}\n",
"new_path": "packages/heaps/src/heap.ts",
"old_path": "packages/heaps/src/heap.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
refactor(heaps): major update / simplify, fix DHeap, add accessors
| 1
|
refactor
|
heaps
|
679,913
|
22.04.2018 04:43:41
| -3,600
|
b83c0300c8c2f4415f7cfe75cdc7fa0d6a1018f4
|
minor(cache): cleanup
|
[
{
"change_type": "MODIFY",
"diff": "@@ -79,7 +79,6 @@ export class TLRUCache<K, V> extends LRUCache<K, V> {\n}\nprotected ensureSize() {\n- const release = this.opts.release;\nconst maxs = this.opts.maxsize;\nconst maxl = this.opts.maxlen;\nconst now = Date.now();\n",
"new_path": "packages/cache/src/tlru.ts",
"old_path": "packages/cache/src/tlru.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
minor(cache): cleanup
| 1
|
minor
|
cache
|
815,745
|
22.04.2018 13:40:08
| -10,800
|
727c63720c006a4d9ffe8d7a29e25b279d26bc52
|
fix: use min-width for dropdown panel
closes
|
[
{
"change_type": "MODIFY",
"diff": "@@ -340,7 +340,8 @@ export class NgDropdownPanelComponent implements OnInit, OnChanges, OnDestroy, A\ndropdownPanel.style.top = offsetTop + topDelta + 'px';\ndropdownPanel.style.bottom = 'auto';\ndropdownPanel.style.left = offsetLeft + 'px';\n- dropdownPanel.style.width = selectRect.width + 'px';\n+ dropdownPanel.style.minWidth = selectRect.width + 'px';\n+ dropdownPanel.style.width = 'auto';\n}\nprivate _whenContentReady(): Promise<void> {\n",
"new_path": "src/ng-select/ng-dropdown-panel.component.ts",
"old_path": "src/ng-select/ng-dropdown-panel.component.ts"
}
] |
TypeScript
|
MIT License
|
ng-select/ng-select
|
fix: use min-width for dropdown panel
closes #476
| 1
|
fix
| null |
815,745
|
22.04.2018 13:51:18
| -10,800
|
1006a937caae7f983f521bcd98777e374d70eac6
|
fix: use bindlabel for group key when using fn expression
fixes
|
[
{
"change_type": "MODIFY",
"diff": "import { NgOption } from './ng-select.types';\nimport * as searchHelper from './search-helper';\nimport { NgSelectComponent } from './ng-select.component';\n-import { isObject, isDefined } from './value-utils';\n+import { isObject, isDefined, isFunction } from './value-utils';\nimport { newId } from './id';\ntype OptionGroups = Map<string, NgOption[]>;\n@@ -268,9 +268,8 @@ export class ItemsList {\n}\nprivate _groupBy(items: NgOption[], prop: string | Function): OptionGroups {\n- const isPropFn = prop instanceof Function;\nconst groups = items.reduce((grouped, item) => {\n- const key = isPropFn ? (<Function>prop).apply(this, [item.value]) : item.value[<string>prop];\n+ const key = isFunction(prop) ? (<Function>prop).apply(this, [item.value]) : item.value[<string>prop];\nconst group = grouped.get(key);\nif (group) {\ngroup.push(item);\n@@ -293,8 +292,8 @@ export class ItemsList {\ndisabled: !this._ngSelect.selectableGroup,\nhtmlId: newId()\n};\n- parent.value = {};\n- parent.value[this._ngSelect.groupBy] = key;\n+ const groupKey = isFunction(this._ngSelect.groupBy) ? this._ngSelect.bindLabel : this._ngSelect.groupBy;\n+ parent.value = { [groupKey]: key };\nitems.push(parent);\ni++;\n",
"new_path": "src/ng-select/items-list.ts",
"old_path": "src/ng-select/items-list.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -2392,6 +2392,7 @@ describe('NgSelectComponent', function () {\nconst fixture = createTestingModule(\nNgSelectGroupingTestCmp,\n`<ng-select [items]=\"accounts\"\n+ bindLabel=\"name\"\n[groupBy]=\"groupByFn\"\n[(ngModel)]=\"selectedAccount\">\n</ng-select>`);\n@@ -2402,7 +2403,9 @@ describe('NgSelectComponent', function () {\nexpect(items.length).toBe(12);\nexpect(items[0].hasChildren).toBe(true);\n+ expect(items[0].value['name']).toBe('c1');\nexpect(items[6].hasChildren).toBe(true);\n+ expect(items[6].value['name']).toBe('c2');\n}));\nit('should not mark optgroup item as marked', fakeAsync(() => {\n",
"new_path": "src/ng-select/ng-select.component.spec.ts",
"old_path": "src/ng-select/ng-select.component.spec.ts"
}
] |
TypeScript
|
MIT License
|
ng-select/ng-select
|
fix: use bindlabel for group key when using fn expression
fixes #488
| 1
|
fix
| null |
679,913
|
22.04.2018 14:40:58
| -3,600
|
c4bbee0a8aaa6c63e5ea31aff540aff873cee48d
|
feat(heaps): add min/max(), update heapify() and percolate methods
|
[
{
"change_type": "MODIFY",
"diff": "@@ -24,17 +24,6 @@ export class DHeap<T> extends Heap<T> {\nreturn idx > 0 ? ((idx - 1) / d) | 0 : -1;\n}\n- /**\n- * If `d=2` return index of other sibling. For all other `d`\n- * there're no unique solutions so always returns -1.\n- *\n- * @param idx\n- * @param d\n- */\n- static siblingIndex(idx: number, d = 4) {\n- return d === 2 ? Heap.siblingIndex(idx) : -1;\n- }\n-\n/**\n* Returns index of 1st child or -1 if `idx < 0`.\n*\n@@ -76,14 +65,13 @@ export class DHeap<T> extends Heap<T> {\nreturn vals.slice(DHeap.parentIndex(vals.length - 1, this.d) + 1);\n}\n- heapify() {\n- for (var i = ((this.values.length - 1) / this.d) | 0; i >= 0; i--) {\n- this.percolateDown(i);\n+ heapify(vals = this.values) {\n+ for (var i = ((vals.length - 1) / this.d) | 0; i >= 0; i--) {\n+ this.percolateDown(i, vals);\n}\n}\n- protected percolateUp(i: number) {\n- const vals = this.values;\n+ protected percolateUp(i: number, vals = this.values) {\nconst node = vals[i];\nconst d = this.d;\nconst cmp = this.compare;\n@@ -99,8 +87,7 @@ export class DHeap<T> extends Heap<T> {\n}\n}\n- protected percolateDown(i: number) {\n- const vals = this.values;\n+ protected percolateDown(i: number, vals = this.values) {\nconst n = vals.length;\nconst d = this.d;\nconst node = vals[i];\n",
"new_path": "packages/heaps/src/dheap.ts",
"old_path": "packages/heaps/src/dheap.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -28,10 +28,6 @@ export class Heap<T> implements\nreturn idx > 0 ? (idx - 1) >> 1 : -1;\n}\n- static siblingIndex(idx: number) {\n- return idx > 0 ? idx + 1 - ((idx & 1) << 1) : -1;\n- }\n-\nstatic childIndex(idx: number) {\nreturn idx >= 0 ? (idx << 1) + 1 : -1;\n}\n@@ -94,13 +90,12 @@ export class Heap<T> implements\nreturn res;\n}\n- pushPop(val: T) {\n- const vals = this.values;\n+ pushPop(val: T, vals = this.values) {\nconst head = vals[0];\nif (vals.length > 0 && this.compare(head, val) < 0) {\nvals[0] = val;\nval = head;\n- this.percolateDown(0);\n+ this.percolateDown(0, vals);\n}\nreturn val;\n}\n@@ -119,19 +114,56 @@ export class Heap<T> implements\nreturn res;\n}\n- heapify() {\n- for (var i = (this.values.length - 1) >> 1; i >= 0; i--) {\n- this.percolateDown(i);\n+ heapify(vals = this.values) {\n+ for (var i = (vals.length - 1) >> 1; i >= 0; i--) {\n+ this.percolateDown(i, vals);\n}\n}\n- *sorted() {\n- const h = this.copy();\n- let x: T;\n- while ((x = h.pop()) !== undefined) {\n- yield x;\n+ /**\n+ * Returns the largest `n` values (or less) in heap, based on\n+ * comparator ordering.\n+ *\n+ * @param n\n+ */\n+ max(n = this.values.length) {\n+ const vals = this.values;\n+ const cmp = this.compare;\n+ const res = vals.slice(0, n);\n+ if (!n) {\n+ return res;\n+ }\n+ this.heapify(res);\n+ for (let m = vals.length; n < m; n++) {\n+ this.pushPop(vals[n], res);\n+ }\n+ return res.sort((a, b) => cmp(b, a));\n+ }\n+\n+ /**\n+ * Returns the smallest `n` values (or less) in heap, based on\n+ * comparator ordering.\n+ *\n+ * @param n\n+ */\n+ min(n = this.values.length) {\n+ const vals = this.values;\n+ const cmp = this.compare;\n+ const res = vals.slice(0, n).sort(cmp);\n+ if (!n) {\n+ return res;\n+ }\n+ let x = res[n - 1], y;\n+ for (let i = n, m = vals.length; i < m; i++) {\n+ y = vals[i];\n+ if (cmp(y, x) < 0) {\n+ res.splice(binarySearch(res, y, 0, n, cmp), 0, y);\n+ res.pop();\n+ x = res[n - 1];\n}\n}\n+ return res;\n+ }\nparent(n: number) {\nn = Heap.parentIndex(n);\n@@ -155,8 +187,7 @@ export class Heap<T> implements\nreturn vals.slice(Heap.parentIndex(vals.length - 1) + 1);\n}\n- protected percolateUp(i: number) {\n- const vals = this.values;\n+ protected percolateUp(i: number, vals = this.values) {\nconst node = vals[i];\nconst cmp = this.compare;\nwhile (i > 0) {\n@@ -171,8 +202,7 @@ export class Heap<T> implements\n}\n}\n- protected percolateDown(i: number) {\n- const vals = this.values;\n+ protected percolateDown(i: number, vals = this.values) {\nconst n = vals.length;\nconst node = vals[i];\nconst cmp = this.compare;\n@@ -193,3 +223,16 @@ export class Heap<T> implements\nvals[i] = node;\n}\n}\n+\n+function binarySearch<T>(vals: T[], x: T, lo: number, hi: number, cmp: Comparator<T>) {\n+ let m;\n+ while (lo < hi) {\n+ m = (lo + hi) >>> 1;\n+ if (cmp(x, vals[m]) < 0) {\n+ hi = m;\n+ } else {\n+ lo = m + 1;\n+ }\n+ }\n+ return lo;\n+}\n",
"new_path": "packages/heaps/src/heap.ts",
"old_path": "packages/heaps/src/heap.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
feat(heaps): add min/max(), update heapify() and percolate methods
| 1
|
feat
|
heaps
|
679,913
|
22.04.2018 16:37:43
| -3,600
|
58945727eed6abc96d33ad26c4bb8ea32d32e9d3
|
fix(heaps): add DHeap ICopy/IEmpty impls, fix return types
|
[
{
"change_type": "MODIFY",
"diff": "@@ -2,6 +2,7 @@ import { compare } from \"@thi.ng/api/compare\";\nimport { DHeapOpts } from \"./api\";\nimport { Heap } from \"./heap\";\n+import { ICopy, IEmpty } from \"@thi.ng/api/api\";\n/**\n* Generic d-ary heap / priority queue with configurable arity (default\n@@ -12,7 +13,9 @@ import { Heap } from \"./heap\";\n*\n* https://en.wikipedia.org/wiki/D-ary_heap\n*/\n-export class DHeap<T> extends Heap<T> {\n+export class DHeap<T> extends Heap<T> implements\n+ ICopy<DHeap<T>>,\n+ IEmpty<DHeap<T>> {\n/**\n* Returns index of parent node or -1 if `idx < 1`.\n@@ -45,6 +48,14 @@ export class DHeap<T> extends Heap<T> {\n}\n}\n+ copy() {\n+ return <DHeap<T>>super.copy();\n+ }\n+\n+ empty() {\n+ return new DHeap<T>(null, { compare: this.compare, d: this.d });\n+ }\n+\nparent(n: number) {\nn = DHeap.parentIndex(n, this.d);\nreturn n >= 0 ? this.values[n] : undefined;\n",
"new_path": "packages/heaps/src/dheap.ts",
"old_path": "packages/heaps/src/dheap.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
fix(heaps): add DHeap ICopy/IEmpty impls, fix return types
| 1
|
fix
|
heaps
|
679,913
|
22.04.2018 16:38:40
| -3,600
|
944aaf6dcff3bda3a8643ecd022b8bc54a89bd6f
|
test(heaps): add tests
|
[
{
"change_type": "ADD",
"diff": "+import * as assert from \"assert\";\n+import { DHeap } from \"../src/index\";\n+import { compare } from \"@thi.ng/api/compare\";\n+\n+describe(\"DHeap\", () => {\n+\n+ const rcmp: (a: number, b: number) => number = (a, b) => b - a;\n+\n+ const src = [5, 2, 10, 20, 15, 18, 23, 22, -1];\n+ let h: DHeap<any>;\n+\n+ beforeEach(() => {\n+ h = new DHeap(src);\n+ });\n+\n+ it(\"length\", () => {\n+ assert.equal(h.length, src.length);\n+ });\n+\n+ it(\"copy\", () => {\n+ assert.deepEqual(drain(h.copy()), drain(h));\n+ h = new DHeap(src, { compare: rcmp });\n+ assert.deepEqual(drain(h.copy()), drain(h));\n+ });\n+\n+ it(\"peek\", () => {\n+ assert.equal(h.peek(), -1);\n+ h.push(-2);\n+ assert.equal(h.peek(), -2);\n+ });\n+\n+ it(\"pop\", () => {\n+ assert.deepEqual(drain(h), src.slice().sort(compare));\n+ h = new DHeap(src, { compare: rcmp });\n+ assert.deepEqual(drain(h), src.slice().sort(compare).reverse());\n+ });\n+\n+ it(\"into\", () => {\n+ assert.deepEqual(drain(h.into(src)), src.concat(src).sort(compare));\n+ });\n+\n+ it(\"pushPop\", () => {\n+ assert.equal(h.pushPop(-2), -2);\n+ assert.equal(h.length, src.length);\n+ assert.equal(h.pushPop(-1), -1);\n+ assert.equal(h.length, src.length);\n+ assert.equal(h.pushPop(11), -1);\n+ assert.equal(h.length, src.length);\n+ assert.equal(h.pushPop(24), 2);\n+ assert.equal(h.length, src.length);\n+ });\n+\n+ it(\"min\", () => {\n+ assert.deepEqual(h.min(0), []);\n+ assert.deepEqual(h.min(1), [-1]);\n+ assert.deepEqual(h.min(2), [-1, 2]);\n+ assert.deepEqual(h.min(3), [-1, 2, 5]);\n+ assert.deepEqual(h.min(4), [-1, 2, 5, 10]);\n+ assert.deepEqual(h.min(), src.slice().sort(compare));\n+ });\n+\n+ it(\"max\", () => {\n+ assert.deepEqual(h.max(0), []);\n+ assert.deepEqual(h.max(1), [23]);\n+ assert.deepEqual(h.max(2), [23, 22]);\n+ assert.deepEqual(h.max(3), [23, 22, 20]);\n+ assert.deepEqual(h.max(4), [23, 22, 20, 18]);\n+ assert.deepEqual(h.max(), src.slice().sort(compare).reverse());\n+ });\n+\n+ it(\"parent\", () => {\n+ assert.equal(h.parent(0), undefined);\n+ assert.equal(h.parent(1), -1);\n+ assert.equal(h.parent(2), -1);\n+ assert.equal(h.parent(3), -1);\n+ assert.equal(h.parent(4), -1);\n+ assert.equal(h.parent(5), 2);\n+ assert.equal(h.parent(6), 2);\n+ assert.equal(h.parent(7), 2);\n+ assert.equal(h.parent(8), 2);\n+ });\n+\n+ it(\"children\", () => {\n+ assert.deepEqual(h.children(0), [2, 10, 20, 15]);\n+ assert.deepEqual(h.children(1), [18, 23, 22, 5]);\n+ assert.deepEqual(h.children(2), undefined);\n+ });\n+});\n+\n+function drain(h: DHeap<any>) {\n+ const res = [];\n+ let x;\n+ while (x = h.pop()) {\n+ res.push(x);\n+ }\n+ return res;\n+}\n+\n",
"new_path": "packages/heaps/test/dheap.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+import * as assert from \"assert\";\n+import { Heap } from \"../src/index\";\n+import { compare } from \"@thi.ng/api/compare\";\n+\n+describe(\"Heap\", () => {\n+\n+ const rcmp: (a: number, b: number) => number = (a, b) => b - a;\n+\n+ const src = [5, 2, 10, 20, 15, 18, 23, 22, -1];\n+ let h: Heap<any>;\n+\n+ beforeEach(() => {\n+ h = new Heap(src);\n+ });\n+\n+ it(\"length\", () => {\n+ assert.equal(h.length, src.length);\n+ });\n+\n+ it(\"copy\", () => {\n+ assert.deepEqual(drain(h.copy()), drain(h));\n+ h = new Heap(src, { compare: rcmp });\n+ assert.deepEqual(drain(h.copy()), drain(h));\n+ });\n+\n+ it(\"peek\", () => {\n+ assert.equal(h.peek(), -1);\n+ h.push(-2);\n+ assert.equal(h.peek(), -2);\n+ });\n+\n+ it(\"pop\", () => {\n+ assert.deepEqual(drain(h), src.slice().sort(compare));\n+ h = new Heap(src, { compare: rcmp });\n+ assert.deepEqual(drain(h), src.slice().sort(compare).reverse());\n+ });\n+\n+ it(\"into\", () => {\n+ assert.deepEqual(drain(h.into(src)), src.concat(src).sort(compare));\n+ });\n+\n+ it(\"pushPop\", () => {\n+ assert.equal(h.pushPop(-2), -2);\n+ assert.equal(h.length, src.length);\n+ assert.equal(h.pushPop(-1), -1);\n+ assert.equal(h.length, src.length);\n+ assert.equal(h.pushPop(11), -1);\n+ assert.equal(h.length, src.length);\n+ assert.equal(h.pushPop(24), 2);\n+ assert.equal(h.length, src.length);\n+ });\n+\n+ it(\"min\", () => {\n+ assert.deepEqual(h.min(0), []);\n+ assert.deepEqual(h.min(1), [-1]);\n+ assert.deepEqual(h.min(2), [-1, 2]);\n+ assert.deepEqual(h.min(3), [-1, 2, 5]);\n+ assert.deepEqual(h.min(4), [-1, 2, 5, 10]);\n+ assert.deepEqual(h.min(), src.slice().sort(compare));\n+ });\n+\n+ it(\"max\", () => {\n+ assert.deepEqual(h.max(0), []);\n+ assert.deepEqual(h.max(1), [23]);\n+ assert.deepEqual(h.max(2), [23, 22]);\n+ assert.deepEqual(h.max(3), [23, 22, 20]);\n+ assert.deepEqual(h.max(4), [23, 22, 20, 18]);\n+ assert.deepEqual(h.max(), src.slice().sort(compare).reverse());\n+ });\n+\n+ it(\"parent\", () => {\n+ assert.equal(h.parent(0), undefined);\n+ assert.equal(h.parent(1), -1);\n+ assert.equal(h.parent(2), -1);\n+ assert.equal(h.parent(3), 2);\n+ assert.equal(h.parent(4), 2);\n+ assert.equal(h.parent(5), 10);\n+ assert.equal(h.parent(6), 10);\n+ });\n+\n+ it(\"children\", () => {\n+ assert.deepEqual(h.children(0), [2, 10]);\n+ assert.deepEqual(h.children(1), [5, 15]);\n+ assert.deepEqual(h.children(2), [18, 23]);\n+ assert.deepEqual(h.children(3), [22, 20]);\n+ assert.deepEqual(h.children(4), undefined);\n+ });\n+});\n+\n+function drain(h: Heap<any>) {\n+ const res = [];\n+ let x;\n+ while (x = h.pop()) {\n+ res.push(x);\n+ }\n+ return res;\n+}\n+\n",
"new_path": "packages/heaps/test/heap.ts",
"old_path": null
},
{
"change_type": "DELETE",
"diff": "-// import * as assert from \"assert\";\n-// import * as heaps from \"../src/index\";\n-\n-describe(\"heaps\", () => {\n- it(\"tests pending\");\n-});\n",
"new_path": null,
"old_path": "packages/heaps/test/index.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
test(heaps): add tests
| 1
|
test
|
heaps
|
679,913
|
22.04.2018 18:14:44
| -3,600
|
9d53ae33674dd6ecfadc784e94b8dcdee7371c3d
|
feat(cache): add TLRUCache.prune(), fix ensureSize()
|
[
{
"change_type": "MODIFY",
"diff": "@@ -78,22 +78,28 @@ export class TLRUCache<K, V> extends LRUCache<K, V> {\nreturn value;\n}\n- protected ensureSize() {\n- const maxs = this.opts.maxsize;\n- const maxl = this.opts.maxlen;\n+ prune() {\nconst now = Date.now();\nlet cell = this.items.head;\n- while (cell && (this._size > maxs || this.length >= maxl)) {\n+ while (cell) {\nif (cell.value.t < now) {\nthis.removeEntry(cell);\n}\ncell = cell.next;\n}\n- cell = this.items.head;\n+ }\n+\n+ protected ensureSize() {\n+ const maxs = this.opts.maxsize;\n+ const maxl = this.opts.maxlen;\n+ const now = Date.now();\n+ let cell = this.items.head;\nwhile (cell && (this._size > maxs || this.length >= maxl)) {\n+ if (cell.value.t < now) {\nthis.removeEntry(cell);\n+ }\ncell = cell.next;\n}\n- return true;\n+ return super.ensureSize();\n}\n}\n",
"new_path": "packages/cache/src/tlru.ts",
"old_path": "packages/cache/src/tlru.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
feat(cache): add TLRUCache.prune(), fix ensureSize()
| 1
|
feat
|
cache
|
679,913
|
22.04.2018 18:15:01
| -3,600
|
7d38e5b01fdba2e19cfac67618640ef62b57aeef
|
test(cache): add tests
|
[
{
"change_type": "DELETE",
"diff": "-// import * as assert from \"assert\";\n-// import * as cache from \"../src/index\";\n-\n-describe(\"cache\", () => {\n- it(\"tests pending\");\n-});\n",
"new_path": null,
"old_path": "packages/cache/test/index.ts"
},
{
"change_type": "ADD",
"diff": "+import * as assert from \"assert\";\n+import { LRUCache } from \"../src/index\";\n+\n+describe(\"LRU\", () => {\n+\n+ let c: LRUCache<string, number>;\n+ let evicts: any[];\n+\n+ beforeEach(() => {\n+ evicts = [];\n+ c = new LRUCache(\n+ [[\"a\", 1], [\"b\", 2], [\"c\", 3]],\n+ {\n+ maxlen: 4,\n+ release: (k, v) => evicts.push([k, v])\n+ }\n+ );\n+ });\n+\n+ it(\"max length\", () => {\n+ assert.equal(c.length, 3);\n+ c.set(\"d\", 4);\n+ assert.equal(c.length, 4);\n+ c.set(\"e\", 5);\n+ assert.equal(c.length, 4);\n+ assert.deepEqual(evicts, [[\"a\", 1]]);\n+ });\n+\n+ it(\"get\", () => {\n+ assert.equal(c.get(\"a\"), 1);\n+ assert.equal(c.get(\"b\"), 2);\n+ assert.deepEqual([...c.keys()], [\"c\", \"a\", \"b\"]);\n+ c.set(\"d\", 4);\n+ assert.deepEqual([...c.keys()], [\"c\", \"a\", \"b\", \"d\"]);\n+ c.set(\"e\", 5);\n+ assert.deepEqual([...c.keys()], [\"a\", \"b\", \"d\", \"e\"]);\n+ assert.deepEqual([...c.values()], [1, 2, 4, 5]);\n+ assert.deepEqual(evicts, [[\"c\", 3]]);\n+ });\n+\n+});\n",
"new_path": "packages/cache/test/lru.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+import * as assert from \"assert\";\n+import { MRUCache } from \"../src/index\";\n+\n+describe(\"MRU\", () => {\n+\n+ let c: MRUCache<string, number>;\n+ let evicts: any[];\n+\n+ beforeEach(() => {\n+ evicts = [];\n+ c = new MRUCache(\n+ [[\"a\", 1], [\"b\", 2], [\"c\", 3]],\n+ {\n+ maxlen: 4,\n+ release: (k, v) => evicts.push([k, v])\n+ }\n+ );\n+ });\n+\n+ it(\"max length\", () => {\n+ assert.equal(c.length, 3);\n+ c.set(\"d\", 4);\n+ assert.equal(c.length, 4);\n+ c.set(\"e\", 5);\n+ assert.equal(c.length, 4);\n+ assert.deepEqual(evicts, [[\"d\", 4]]);\n+ });\n+\n+ it(\"get\", () => {\n+ assert.equal(c.get(\"a\"), 1);\n+ assert.equal(c.get(\"b\"), 2);\n+ assert.deepEqual([...c.keys()], [\"b\", \"a\", \"c\"]);\n+ c.set(\"d\", 4);\n+ assert.deepEqual([...c.keys()], [\"d\", \"b\", \"a\", \"c\"]);\n+ c.set(\"e\", 5);\n+ assert.deepEqual([...c.keys()], [\"e\", \"b\", \"a\", \"c\"]);\n+ assert.deepEqual([...c.values()], [5, 2, 1, 3]);\n+ assert.deepEqual(evicts, [[\"d\", 4]]);\n+ });\n+\n+});\n",
"new_path": "packages/cache/test/mru.ts",
"old_path": null
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
test(cache): add tests
| 1
|
test
|
cache
|
679,913
|
22.04.2018 20:21:39
| -3,600
|
aa78d77edb6ec26982222ec129a15c795b291173
|
fix(cache): TLRUCache.get(), add tests, update package
get() now correctly shifts element to back (LRU)
|
[
{
"change_type": "MODIFY",
"diff": "\"@thi.ng/iterators\": \"^4.1.6\"\n},\n\"keywords\": [\n+ \"cache\",\n+ \"data structure\",\n\"ES6\",\n+ \"LRU\",\n+ \"Map\",\n+ \"MRU\",\n+ \"TLRU\",\n+ \"TTL\",\n\"typescript\"\n],\n\"publishConfig\": {\n",
"new_path": "packages/cache/package.json",
"old_path": "packages/cache/package.json"
},
{
"change_type": "MODIFY",
"diff": "@@ -86,11 +86,11 @@ export class LRUCache<K, V> implements ICache<K, V> {\nget(key: K, notFound?: any) {\nconst e = this.map.get(key);\n- if (!e) {\n- return notFound;\n- }\n+ if (e) {\nreturn this.resetEntry(e);\n}\n+ return notFound;\n+ }\nset(key: K, value: V) {\nconst size = this.opts.ksize(key) + this.opts.vsize(value);\n",
"new_path": "packages/cache/src/lru.ts",
"old_path": "packages/cache/src/lru.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -44,7 +44,7 @@ export class TLRUCache<K, V> extends LRUCache<K, V> {\nconst e = this.map.get(key);\nif (e) {\nif (e.value.t >= Date.now()) {\n- return e.value.v;\n+ return this.resetEntry(e);\n}\nthis.removeEntry(e);\n}\n",
"new_path": "packages/cache/src/tlru.ts",
"old_path": "packages/cache/src/tlru.ts"
},
{
"change_type": "ADD",
"diff": "+import * as assert from \"assert\";\n+import { TLRUCache } from \"../src/index\";\n+\n+describe(\"TLRU\", () => {\n+\n+ let c: TLRUCache<string, number>;\n+ let evicts: any[];\n+\n+ beforeEach(() => {\n+ evicts = [];\n+ c = new TLRUCache(\n+ [[\"a\", 1], [\"b\", 2], [\"c\", 3]],\n+ {\n+ maxlen: 4,\n+ ttl: 10,\n+ release: (k, v) => evicts.push([k, v])\n+ }\n+ );\n+ });\n+\n+ it(\"max length\", () => {\n+ assert.equal(c.length, 3);\n+ c.set(\"d\", 4);\n+ assert.equal(c.length, 4);\n+ c.set(\"e\", 5);\n+ assert.equal(c.length, 4);\n+ assert.deepEqual(evicts, [[\"a\", 1]]);\n+ });\n+\n+ it(\"get lru\", () => {\n+ assert.equal(c.get(\"a\"), 1);\n+ assert.equal(c.get(\"b\"), 2);\n+ assert.deepEqual([...c.keys()], [\"c\", \"a\", \"b\"]);\n+ c.set(\"d\", 4);\n+ assert.deepEqual([...c.keys()], [\"c\", \"a\", \"b\", \"d\"]);\n+ c.set(\"e\", 5);\n+ assert.deepEqual([...c.keys()], [\"a\", \"b\", \"d\", \"e\"]);\n+ assert.deepEqual([...c.values()], [1, 2, 4, 5]);\n+ assert.deepEqual(evicts, [[\"c\", 3]]);\n+ });\n+\n+ it(\"get ttl\", (done) => {\n+ assert.equal(c.set(\"a\", 10, 100), 10);\n+ setTimeout(() => {\n+ assert(!c.has(\"b\"));\n+ assert(!c.has(\"c\"));\n+ assert.deepEqual(evicts, [[\"b\", 2], [\"c\", 3]]);\n+ assert.deepEqual([...c.keys()], [\"a\"]);\n+ done();\n+ }, 20);\n+ });\n+\n+});\n",
"new_path": "packages/cache/test/tlru.ts",
"old_path": null
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
fix(cache): TLRUCache.get(), add tests, update package
- get() now correctly shifts element to back (LRU)
| 1
|
fix
|
cache
|
679,913
|
22.04.2018 20:31:11
| -3,600
|
03cee0fa7d9ca3e5603f1fc110c7b1144177a89b
|
build(heaps): update package desc
|
[
{
"change_type": "MODIFY",
"diff": "\"@thi.ng/api\": \"^2.2.0\"\n},\n\"keywords\": [\n+ \"data structure\",\n+ \"d-heap\",\n\"ES6\",\n+ \"heap\",\n+ \"priority queue\",\n+ \"sort\",\n\"typescript\"\n],\n\"publishConfig\": {\n",
"new_path": "packages/heaps/package.json",
"old_path": "packages/heaps/package.json"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
build(heaps): update package desc
| 1
|
build
|
heaps
|
743,913
|
22.04.2018 22:36:08
| 14,400
|
8edbce9141ea90dfa3a9a2070789285259bf2950
|
docs: grammar in advanced.md
|
[
{
"change_type": "MODIFY",
"diff": "@@ -429,7 +429,7 @@ for detailed documentation of this feature.\n## Middleware\nSometimes you might want to transform arguments before they reach the command handler.\n-For example, you perhaps you want to validate that credentials have been provided and otherwise load credentials from a file.\n+For example, perhaps you want to validate that credentials have been provided and otherwise load credentials from a file.\nMiddleware is simply a stack of functions, each of which is passed the the current parsed arguments, which it can in turn update by adding values, removing values, or overwriting values.\n",
"new_path": "docs/advanced.md",
"old_path": "docs/advanced.md"
}
] |
JavaScript
|
MIT License
|
yargs/yargs
|
docs: grammar in advanced.md (#1108)
| 1
|
docs
| null |
724,238
|
23.04.2018 01:04:54
| -28,800
|
b7f16359fbb19ed7eebb5942e43d641a8f11f319
|
docs: add Peer Dependency documentation
|
[
{
"change_type": "MODIFY",
"diff": "@@ -15,6 +15,13 @@ npm install --save-dev @vue/test-utils\nnpm install --save-dev @vue/server-test-utils\n```\n+## Peer Dependencies\n+You need to install `vue-template-compiler` which is used to compiled components. It should be the same version as the version of Vue you are using.\n+\n+```\n+npm install --save-dev vue-template-compiler\n+```\n+\n## Documentation\nRefer to the [documentation](https://vue-test-utils.vuejs.org/)\n",
"new_path": "README.md",
"old_path": "README.md"
}
] |
JavaScript
|
MIT License
|
vuejs/vue-test-utils
|
docs: add Peer Dependency documentation (#548)
| 1
|
docs
| null |
217,922
|
23.04.2018 09:58:29
| -7,200
|
3739e360e2746b7cc95eeda2e9a121cb10df1560
|
fix: map name was sometimes incorrect
closes
|
[
{
"change_type": "MODIFY",
"diff": "@@ -17,9 +17,10 @@ export class DropsExtractor extends AbstractExtractor<Drop[]> {\nconst partial = itemData.getPartial(d.toString(), 'mob');\nif (partial !== undefined) {\nconst monsterId: string = Math.floor(d % 1000000).toString();\n+ const zoneid = monsters[monsterId] !== undefined ? monsters[monsterId].zoneid : partial.obj.z;\nconst drop: Drop = {\nid: d,\n- zoneid: partial.obj.z,\n+ zoneid: zoneid,\nlvl: partial.obj.l,\nposition: monsters[monsterId]\n};\n",
"new_path": "src/app/core/list/data/extractor/drops-extractor.ts",
"old_path": "src/app/core/list/data/extractor/drops-extractor.ts"
}
] |
TypeScript
|
MIT License
|
ffxiv-teamcraft/ffxiv-teamcraft
|
fix: map name was sometimes incorrect
closes #325
| 1
|
fix
| null |
217,922
|
23.04.2018 10:05:21
| -7,200
|
85e24947d3f7dc374da45d0f4fa820250392b9de
|
feat: two new layout filters: IS_TOME_TRADE and IS_SCRIPT_TRADE
|
[
{
"change_type": "MODIFY",
"diff": "@@ -35,6 +35,51 @@ export class LayoutRowFilter {\nreturn false;\n}, 'IS_TOKEN_TRADE');\n+ static IS_TOME_TRADE = new LayoutRowFilter(row => {\n+ if (row.tradeSources !== undefined) {\n+ const tomeIds = [\n+ 28,\n+ 35,\n+ 36,\n+ 7811,\n+ 9383,\n+ 14298,\n+ 16928,\n+ 19107,\n+ 21789,\n+ ];\n+\n+ for (const tokenId of tomeIds) {\n+ if (row.tradeSources\n+ .find(source => source.trades\n+ .find(trade => trade.currencyId === tokenId) !== undefined) !== undefined) {\n+ return true;\n+ }\n+ }\n+ }\n+ return false;\n+ }, 'IS_TOME_TRADE');\n+\n+ static IS_SCRIPT_TRADE = new LayoutRowFilter(row => {\n+ if (row.tradeSources !== undefined) {\n+ const scriptIds = [\n+ 10309,\n+ 10311,\n+ 17833,\n+ 17834,\n+ ];\n+\n+ for (const tokenId of scriptIds) {\n+ if (row.tradeSources\n+ .find(source => source.trades\n+ .find(trade => trade.currencyId === tokenId) !== undefined) !== undefined) {\n+ return true;\n+ }\n+ }\n+ }\n+ return false;\n+ }, 'IS_SCRIPT_TRADE');\n+\nstatic IS_VENTURE = new LayoutRowFilter(row => row.ventures !== undefined && row.ventures.length > 0, 'IS_VENTURE');\nstatic IS_MASTERCRAFT = LayoutRowFilter.IS_CRAFT\n",
"new_path": "src/app/core/layout/layout-row-filter.ts",
"old_path": "src/app/core/layout/layout-row-filter.ts"
}
] |
TypeScript
|
MIT License
|
ffxiv-teamcraft/ffxiv-teamcraft
|
feat: two new layout filters: IS_TOME_TRADE and IS_SCRIPT_TRADE
| 1
|
feat
| null |
217,922
|
23.04.2018 10:58:20
| -7,200
|
3f5e310f83ab0216794648e86a5669ce80a2896c
|
fix: login sometimes triggers an email spam and a temporary ban from logging in from firebase
closes
|
[
{
"change_type": "MODIFY",
"diff": "import {Component} from '@angular/core';\n-import * as firebase from 'firebase/app';\nimport {MatDialog, MatDialogRef} from '@angular/material';\nimport {AngularFireAuth} from 'angularfire2/auth';\nimport {FormBuilder, FormGroup, Validators} from '@angular/forms';\n@@ -74,7 +73,9 @@ export class LoginPopupComponent {\nclassicLogin(): void {\nthis.router.navigate(['home']).then(() => {\nconst prevUser = this.af.auth.currentUser;\n- this.listService.getUserLists(prevUser.uid).subscribe(listsBackup => {\n+ this.listService.getUserLists(prevUser.uid)\n+ .first()\n+ .subscribe(listsBackup => {\n// Delete the previous anonymous user\nif (this.af.auth.currentUser !== null && this.af.auth.currentUser.isAnonymous) {\nthis.userService.deleteUser(prevUser.uid);\n@@ -131,7 +132,9 @@ export class LoginPopupComponent {\nprivate oauth(provider: AuthProvider): void {\nconst prevUser = this.af.auth.currentUser;\n- this.listService.getUserLists(prevUser.uid).subscribe(lists => {\n+ this.listService.getUserLists(prevUser.uid)\n+ .first()\n+ .subscribe(lists => {\nif (this.af.auth.currentUser !== null && this.af.auth.currentUser.isAnonymous) {\nthis.userService.deleteUser(prevUser.uid);\nthis.af.auth.currentUser.delete();\n",
"new_path": "src/app/modules/common-components/login-popup/login-popup.component.ts",
"old_path": "src/app/modules/common-components/login-popup/login-popup.component.ts"
}
] |
TypeScript
|
MIT License
|
ffxiv-teamcraft/ffxiv-teamcraft
|
fix: login sometimes triggers an email spam and a temporary ban from logging in from firebase
closes #316
| 1
|
fix
| null |
791,834
|
23.04.2018 11:39:31
| 25,200
|
cf76f054592bad9d04af3b3aea2309ca823d19d4
|
core(lhr): lhr-lite type declaration
|
[
{
"change_type": "ADD",
"diff": "+/**\n+ * @license Copyright 2018 Google Inc. All Rights Reserved.\n+ * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n+ */\n+\n+declare global {\n+ module LH {\n+ /**\n+ * The lightweight version of Lighthouse results.\n+ */\n+ export interface ResultLite {\n+ /** The URL that was supplied to Lighthouse and initially navigated to. */\n+ requestedUrl: string;\n+ /** The post-redirects URL that Lighthouse loaded. */\n+ finalUrl: string;\n+ /** The ISO-8601 timestamp of when the results were generated. */\n+ fetchedAt: string;\n+ /** The version of Lighthouse with which these results were generated. */\n+ lighthouseVersion: string;\n+ /** An object containing the results of the audits. */\n+ audits: Record<string, ResultLite.Audit>;\n+ /** An object containing the top-level categories, their overall scores, and reference to member audits. */\n+ categories: Record<string, ResultLite.Category>;\n+ }\n+\n+ // ResultLite namespace\n+ export module ResultLite {\n+ export interface Category {\n+ /** The human-friendly name of the category. */\n+ title: string;\n+ /** A description of what this category is about (e.g. these help you validate your PWA). */\n+ description: string;\n+ /** The overall score of the category, the weighted average of all its audits. */\n+ score: number;\n+ /** An array of references to all the audit members of this category. */\n+ auditRefs: AuditRef[];\n+ /** An optional description for manual audits within this category. */\n+ manualDescription?: string;\n+ }\n+\n+ /**\n+ * A reference to an audit result, with weighting and grouping information\n+ * for its place in this category.\n+ */\n+ export interface AuditRef {\n+ /** Matches a key in the top-level `audits` object. */\n+ auditId: string;\n+ /** The weight of the audit's score in the overall category score. */\n+ weight: number;\n+ }\n+\n+ export interface Audit {\n+ /** The brief description of the audit. The text can change depending on if the audit passed or failed. */\n+ title: string;\n+ /** A more detailed description that describes why the audit is important and links to Lighthouse documentation on the audit; markdown links supported. */\n+ description: string;\n+ /** The scored value determined by the audit, in the range `0-1`, or null if `scoreDisplayMode` indicates not scored. */\n+ score: number | null;\n+ /**\n+ * A string identifying how the score should be interpreted:\n+ * 'binary': pass/fail audit (0 and 1 are only possible scores).\n+ * 'numeric': scores of 0-1 (map to displayed scores of 0-100).\n+ * 'informative': the audit is an FYI only, and can't be interpreted as pass/fail. Score is null and should be ignored.\n+ * 'notApplicable': the audit turned out to not apply to the page. Score is null and should be ignored.\n+ * 'manual': The audit exists only to tell you to review something yourself. Score is null and should be ignored.\n+ * 'error': There was an error while running the object (check `errorMessage` for details). Score is null and should be ignored.\n+ */\n+ scoreDisplayMode: 'binary' | 'numeric' | 'informative' | 'notApplicable' | 'manual' | 'error';\n+ /** An explanation of audit-related issues encountered on the test page. */\n+ explanation?: string;\n+ /** Extra information provided by some types of audits. */\n+ details?: Audit.MetricDetails | Audit.OpportunityDetails;\n+ /** Error message from any exception thrown while running this audit. */\n+ errorMessage?: string;\n+ }\n+\n+ export module Audit {\n+ export interface MetricDetails {\n+ type: 'metric';\n+ /** The value of the metric expressed in milliseconds. */\n+ timespanMs?: number;\n+ }\n+\n+ export interface OpportunityDetails {\n+ type: 'opportunity';\n+ wastedMs: number\n+ wastedBytes?: number\n+ headings: ColumnHeading[];\n+ items: (WastedBytesDetailsItem | WastedTimeDetailsItem)[];\n+ }\n+\n+ export interface ColumnHeading {\n+ key: string;\n+ label: string;\n+ valueType: 'url' | 'timespanMs' | 'bytes';\n+ }\n+\n+ export interface WastedBytesDetailsItem {\n+ url: string;\n+ wastedBytes?: number;\n+ totalBytes?: number;\n+ }\n+\n+ export interface WastedTimeDetailsItem {\n+ url: string;\n+ wastedMs: number;\n+ totalBytes?: number;\n+ }\n+ }\n+ }\n+ }\n+}\n+\n+// empty export to keep file a module\n+export {}\n",
"new_path": "typings/lhr-lite.d.ts",
"old_path": null
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
core(lhr): lhr-lite type declaration (#4983)
| 1
|
core
|
lhr
|
791,834
|
23.04.2018 12:00:02
| 25,200
|
670a77aa20093164a443697c45b51af0a2082b68
|
core(tsc): add type checking to fonts gatherer
|
[
{
"change_type": "MODIFY",
"diff": "* Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n*/\n-// @ts-nocheck\n+// eslint-disable-next-line spaced-comment\n+/// <reference types=\"css-font-loading-module\" />\n'use strict';\nconst Gatherer = require('./gatherer');\nconst Sentry = require('../../lib/sentry');\n+\n+// TODO(bckenny): manually add 'display' for now.\n+// PR to add full FontFace props in https://github.com/DefinitelyTyped/DefinitelyTyped/pull/25045\n+/** @typedef {Exclude<keyof FontFace, 'load'|'loaded'|'status'> | 'display'} FontFaceStringKeys */\n+/** @typedef {{err: {message: string, stack: string}}} FontGatherError */\n+\n+/** @type {Array<FontFaceStringKeys>} */\nconst fontFaceDescriptors = [\n'display',\n'family',\n@@ -22,18 +30,23 @@ const fontFaceDescriptors = [\n/* eslint-env browser*/\n/**\n* Collect applied webfont data from `document.fonts`\n- * @param {string[]}\n- * @return {{}}\n+ * @param {Array<FontFaceStringKeys>} descriptors\n+ * @return {Promise<Array<LH.Artifacts.Font>>}\n*/\n/* istanbul ignore next */\nfunction getAllLoadedFonts(descriptors) {\n+ /** @param {FontFace} fontFace */\nconst getFont = fontFace => {\n- const fontRule = {};\n+ /** @type {Partial<LH.Artifacts.Font>} */\n+ const fontRule = {\n+ src: [],\n+ };\ndescriptors.forEach(descriptor => {\n+ // @ts-ignore TODO(bckenny): see above 'display' TODO\nfontRule[descriptor] = fontFace[descriptor];\n});\n- return fontRule;\n+ return /** @type {LH.Artifacts.Font} */ (fontRule);\n};\nreturn document.fonts.ready.then(() => {\n@@ -44,39 +57,50 @@ function getAllLoadedFonts(descriptors) {\n/**\n* Collect authored webfont data from the `CSSFontFaceRule`s present in document.styleSheets\n- * @return {{}}\n+ * @return {Promise<Array<LH.Artifacts.Font|FontGatherError>>}\n*/\n/* istanbul ignore next */\nfunction getFontFaceFromStylesheets() {\n/**\n* Get full data about each CSSFontFaceRule within a styleSheet object\n- * @param {StyleSheet} stylesheet\n- * @return {{}}\n+ * @param {CSSStyleSheet} stylesheet\n+ * @return {Array<LH.Artifacts.Font>}\n*/\nfunction getSheetsFontFaces(stylesheet) {\nconst fontUrlRegex = 'url\\\\((?:\")([^\"]+)(?:\"|\\')\\\\)';\nconst fontFaceRules = [];\n+\nif (stylesheet.cssRules) {\n- for (const rule of stylesheet.cssRules) {\n+ for (const rule of Array.from(stylesheet.cssRules)) {\nif (rule instanceof CSSFontFaceRule) {\nconst fontsObject = {\n+ // @ts-ignore (currently) non-standard Chrome extension to CSSStyleDeclaration\n+ // See disussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1296373#c4\ndisplay: rule.style.fontDisplay || 'auto',\n- family: rule.style.fontFamily.replace(/\"|'/g, ''),\n+ family: rule.style.fontFamily ? rule.style.fontFamily.replace(/\"|'/g, '') : '',\nstretch: rule.style.fontStretch || 'normal',\nstyle: rule.style.fontStyle || 'normal',\nweight: rule.style.fontWeight || 'normal',\nvariant: rule.style.fontVariant || 'normal',\n+ // @ts-ignore (currently) non-standard Chrome extension to CSSStyleDeclaration\nunicodeRange: rule.style.unicodeRange || 'U+0-10FFFF',\n+ // @ts-ignore (currently) non-standard Chrome extension to CSSStyleDeclaration\nfeatureSettings: rule.style.featureSettings || 'normal',\n+ /** @type {Array<string>} */\nsrc: [],\n};\n- if (rule.style.src) {\n- const matches = rule.style.src.match(new RegExp(fontUrlRegex, 'g'));\n+ /** @type {string|undefined} */\n+ // @ts-ignore (currently) non-standard Chrome extension to CSSStyleDeclaration\n+ const src = rule.style.src;\n+ if (src) {\n+ const matches = src.match(new RegExp(fontUrlRegex, 'g'));\nif (matches) {\n- fontsObject.src = matches.map(match => {\n+ matches.forEach(match => {\nconst res = new RegExp(fontUrlRegex).exec(match);\n- return new URL(res[1], location.href).href;\n+ if (res) {\n+ fontsObject.src.push(new URL(res[1], location.href).href);\n+ }\n});\n}\n}\n@@ -92,11 +116,11 @@ function getFontFaceFromStylesheets() {\n/**\n* Provided a <link rel=stylesheet> element, it attempts to reload the asset with CORS headers.\n* Without CORS headers, a cross-origin stylesheet will have node.styleSheet.cssRules === null.\n- * @param {Element} oldNode\n- * @return {<!Promise>}\n+ * @param {HTMLLinkElement} oldNode\n+ * @return {Promise<Array<LH.Artifacts.Font|FontGatherError>>}\n*/\nfunction loadStylesheetWithCORS(oldNode) {\n- const newNode = oldNode.cloneNode(true);\n+ const newNode = /** @type {HTMLLinkElement} */ (oldNode.cloneNode(true));\nreturn new Promise(resolve => {\nnewNode.addEventListener('load', function onload() {\n@@ -104,32 +128,43 @@ function getFontFaceFromStylesheets() {\nresolve(getFontFaceFromStylesheets());\n});\nnewNode.crossOrigin = 'anonymous';\n- oldNode.parentNode.insertBefore(newNode, oldNode);\n+ oldNode.parentNode && oldNode.parentNode.insertBefore(newNode, oldNode);\noldNode.remove();\n});\n}\n- const promises = [];\n+ /** @type {Array<LH.Artifacts.Font|FontGatherError>} */\n+ const data = [];\n+ /** @type {Array<Promise<Array<LH.Artifacts.Font|FontGatherError>>>} */\n+ const corsDataPromises = [];\n// Get all loaded stylesheets\n- for (const stylesheet of document.styleSheets) {\n+ for (const stylesheet of Array.from(document.styleSheets)) {\ntry {\n+ const cssStylesheet = /** @type {CSSStyleSheet} */ (stylesheet);\n// Cross-origin stylesheets don't expose cssRules by default. We reload them w/ CORS headers.\n- if (stylesheet.cssRules === null && stylesheet.href && stylesheet.ownerNode &&\n- !stylesheet.ownerNode.crossOrigin) {\n- promises.push(loadStylesheetWithCORS(stylesheet.ownerNode));\n+ if (cssStylesheet.cssRules === null && cssStylesheet.href && cssStylesheet.ownerNode &&\n+ // @ts-ignore - crossOrigin exists if ownerNode is an HTMLLinkElement\n+ !cssStylesheet.ownerNode.crossOrigin) {\n+ const ownerLinkEl = /** @type {HTMLLinkElement} */ (cssStylesheet.ownerNode);\n+ corsDataPromises.push(loadStylesheetWithCORS(ownerLinkEl));\n} else {\n- promises.push(Promise.resolve(getSheetsFontFaces(stylesheet)));\n+ data.push(...getSheetsFontFaces(cssStylesheet));\n}\n} catch (err) {\n- promises.push({err: {message: err.message, stack: err.stack}});\n+ data.push({err: {message: err.message, stack: err.stack}});\n}\n}\n// Flatten results\n- return Promise.all(promises).then(fontFaces => [].concat(...fontFaces));\n+ return Promise.all(corsDataPromises).then(corsFontFaces => data.concat(...corsFontFaces));\n}\n/* eslint-env node */\nclass Fonts extends Gatherer {\n+ /**\n+ * @param {LH.Artifacts.Font} fontFace\n+ * @param {Array<LH.Artifacts.Font>} fontFacesList\n+ * @return {LH.Artifacts.Font|undefined}\n+ */\n_findSameFontFamily(fontFace, fontFacesList) {\nreturn fontFacesList.find(fontItem => {\nreturn !fontFaceDescriptors.find(descriptor => {\n@@ -138,27 +173,42 @@ class Fonts extends Gatherer {\n});\n}\n- afterPass({driver}) {\n+ /**\n+ * @param {LH.Gatherer.PassContext} passContext\n+ * @return {Promise<LH.Artifacts['Fonts']>}\n+ */\n+ afterPass(passContext) {\n+ const driver = passContext.driver;\nconst args = JSON.stringify(fontFaceDescriptors);\n- return Promise.all(\n+ /** @type {Promise<[Array<LH.Artifacts.Font>, Array<LH.Artifacts.Font|FontGatherError>]>} */\n+ const fontData = Promise.all(\n[\ndriver.evaluateAsync(`(${getAllLoadedFonts.toString()})(${args})`),\ndriver.evaluateAsync(`(${getFontFaceFromStylesheets.toString()})()`),\n]\n- ).then(([loadedFonts, fontFaces]) => {\n- return loadedFonts.map(fontFace => {\n- if (fontFace.err) {\n- const err = new Error(fontFace.err.message);\n- err.stack = fontFace.err.stack;\n+ );\n+ return fontData.then(([loadedFonts, fontsAndErrors]) => {\n+ // Filter out errors from retrieving data on font faces.\n+ const fontFaces = /** @type {Array<LH.Artifacts.Font>} */ (fontsAndErrors.filter(\n+ fontOrError => {\n+ // Abuse the type system a bit since `err` property isn't common between types.\n+ const dataError = /** @type {FontGatherError} */ (fontOrError);\n+ if (dataError.err) {\n+ const err = new Error(dataError.err.message);\n+ err.stack = dataError.err.stack;\n+ // @ts-ignore TODO(bckenny): Sentry type checking\nSentry.captureException(err, {tags: {gatherer: 'Fonts'}, level: 'warning'});\n- return null;\n+ return false;\n}\n+ return true;\n+ }));\n- const fontFaceItem = this._findSameFontFamily(fontFace, fontFaces);\n- fontFace.src = (fontFaceItem && fontFaceItem.src) || [];\n+ return loadedFonts.map(loadedFont => {\n+ const fontFaceItem = this._findSameFontFamily(loadedFont, fontFaces);\n+ loadedFont.src = (fontFaceItem && fontFaceItem.src) || [];\n- return fontFace;\n- }).filter(Boolean);\n+ return loadedFont;\n+ });\n});\n}\n}\n",
"new_path": "lighthouse-core/gather/gatherers/fonts.js",
"old_path": "lighthouse-core/gather/gatherers/fonts.js"
},
{
"change_type": "MODIFY",
"diff": "\"devDependencies\": {\n\"@types/chrome\": \"^0.0.60\",\n\"@types/configstore\": \"^2.1.1\",\n+ \"@types/css-font-loading-module\": \"^0.0.1\",\n\"@types/inquirer\": \"^0.0.35\",\n\"@types/lodash.isequal\": \"^4.5.2\",\n\"@types/node\": \"*\",\n",
"new_path": "package.json",
"old_path": "package.json"
},
{
"change_type": "MODIFY",
"diff": "@@ -36,6 +36,8 @@ declare global {\nEmbeddedContent: Artifacts.EmbeddedContentInfo[];\n/** Information on all event listeners in the page. */\nEventListeners: {url: string, type: string, handler?: {description?: string}, objectName: string, line: number, col: number}[];\n+ /** Information for font faces used in the page. */\n+ Fonts: Artifacts.Font[];\nFontSize: Artifacts.FontSize;\n/** The hreflang and href values of all link[rel=alternate] nodes found in HEAD. */\nHreflang: {href: string, hreflang: string}[];\n@@ -104,6 +106,18 @@ declare global {\nparams: {name: string; value: string}[];\n}\n+ export interface Font {\n+ display: string;\n+ family: string;\n+ featureSettings: string;\n+ stretch: string;\n+ style: string;\n+ unicodeRange: string;\n+ variant: string;\n+ weight: string;\n+ src?: string[];\n+ }\n+\nexport interface FontSize {\ntotalTextLength: number;\nfailingTextLength: number;\n",
"new_path": "typings/artifacts.d.ts",
"old_path": "typings/artifacts.d.ts"
},
{
"change_type": "MODIFY",
"diff": "version \"0.9.43\"\nresolved \"https://registry.yarnpkg.com/@types/core-js/-/core-js-0.9.43.tgz#65d646c5e8c0cd1bdee37065799f9d3d48748253\"\n+\"@types/css-font-loading-module@^0.0.1\":\n+ version \"0.0.1\"\n+ resolved \"https://registry.yarnpkg.com/@types/css-font-loading-module/-/css-font-loading-module-0.0.1.tgz#00f3594bcb15813282b8d5595d9d997db49b2608\"\n+\n\"@types/events@*\":\nversion \"1.2.0\"\nresolved \"https://registry.yarnpkg.com/@types/events/-/events-1.2.0.tgz#81a6731ce4df43619e5c8c945383b3e62a89ea86\"\n",
"new_path": "yarn.lock",
"old_path": "yarn.lock"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
core(tsc): add type checking to fonts gatherer (#5018)
| 1
|
core
|
tsc
|
217,922
|
23.04.2018 13:23:13
| -7,200
|
fa8155f2e19fab040505cda816eea27086f2065b
|
style: moved compact sidebar toggle to nav part
|
[
{
"change_type": "MODIFY",
"diff": "<button mat-raised-button *ngIf=\"!(authState | async)?.isAnonymous\" (click)=\"disconnect()\">\n{{'Disconnect' | translate}}\n</button>\n- <button mat-icon-button matTooltip=\"{{'Compact_sidebar_toggle' | translate}}\"\n- matTooltipPosition=\"right\" (click)=\"settings.compactSidebar = true; detectChanges()\">\n- <mat-icon>keyboard_arrow_left</mat-icon>\n- </button>\n</div>\n<div class=\"accent-background\" *ngIf=\"settings.compactSidebar\">\n<div class=\"user\">\n</div>\n<mat-divider></mat-divider>\n<mat-nav-list>\n- <mat-list-item *ngIf=\"settings.compactSidebar\">\n+ <mat-list-item>\n<button mat-icon-button matTooltip=\"{{'Compact_sidebar_toggle' | translate}}\"\n- matTooltipPosition=\"right\" (click)=\"settings.compactSidebar = false; detectChanges()\">\n- <mat-icon>keyboard_arrow_right</mat-icon>\n+ matTooltipPosition=\"right\"\n+ [matTooltipDisabled]=\"!settings.compactSidebar\"\n+ (click)=\"settings.compactSidebar = !settings.compactSidebar; detectChanges()\">\n+ <mat-icon *ngIf=\"settings.compactSidebar\">keyboard_arrow_right</mat-icon>\n+ <mat-icon *ngIf=\"!settings.compactSidebar\">keyboard_arrow_left</mat-icon>\n+ <span *ngIf=\"!settings.compactSidebar\">{{'Compact_sidebar_toggle' | translate}}</span>\n</button>\n</mat-list-item>\n<mat-list-item routerLink=\"/home\" (click)=\"mobile ? sidenav.close() : null\"\n",
"new_path": "src/app/app.component.html",
"old_path": "src/app/app.component.html"
},
{
"change_type": "MODIFY",
"diff": "@@ -272,6 +272,7 @@ export class AppComponent implements OnInit {\ndisconnect(): void {\nthis.router.navigate(['recipes']);\nthis.userService.signOut();\n+ this.username = 'Anonymous';\n}\nuse(lang: string): void {\n",
"new_path": "src/app/app.component.ts",
"old_path": "src/app/app.component.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -32,6 +32,7 @@ export class CharacterAddPopupComponent implements OnInit {\nselect(id: number): void {\nthis.userService.getUserData()\n+ .first()\n.map(user => {\nif (user !== null && !user.anonymous) {\nuser.lodestoneId = id;\n",
"new_path": "src/app/modules/common-components/character-add-popup/character-add-popup.component.ts",
"old_path": "src/app/modules/common-components/character-add-popup/character-add-popup.component.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -6,6 +6,8 @@ import {Router} from '@angular/router';\nimport {ForgotPasswordPopupComponent} from '../forgot-password-popup/forgot-password-popup.component';\nimport {UserService} from '../../../core/database/user.service';\nimport {ListService} from '../../../core/database/list.service';\n+// noinspection ES6UnusedImports\n+import * as firebase from 'firebase';\nimport GoogleAuthProvider = firebase.auth.GoogleAuthProvider;\nimport FacebookAuthProvider = firebase.auth.FacebookAuthProvider;\nimport AuthProvider = firebase.auth.AuthProvider;\n",
"new_path": "src/app/modules/common-components/login-popup/login-popup.component.ts",
"old_path": "src/app/modules/common-components/login-popup/login-popup.component.ts"
}
] |
TypeScript
|
MIT License
|
ffxiv-teamcraft/ffxiv-teamcraft
|
style: moved compact sidebar toggle to nav part
| 1
|
style
| null |
807,849
|
23.04.2018 13:23:32
| 25,200
|
dc725c8fc56017044b40c119ed1bb1b91565a327
|
chore(publish): Restore targeted utility tests
|
[
{
"change_type": "ADD",
"diff": "+\"use strict\";\n+\n+const initFixture = require(\"@lerna-test/init-fixture\")(__dirname);\n+const getCurrentBranch = require(\"../lib/get-current-branch\");\n+\n+test(\"getCurrentBranch\", async () => {\n+ const cwd = await initFixture(\"root-manifest-only\");\n+\n+ expect(getCurrentBranch({ cwd })).toBe(\"master\");\n+});\n",
"new_path": "commands/publish/__tests__/get-current-branch.test.js",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+\"use strict\";\n+\n+const initFixture = require(\"@lerna-test/init-fixture\")(__dirname);\n+const getCurrentSHA = require(\"../lib/get-current-sha\");\n+\n+test(\"getCurrentSHA\", async () => {\n+ const cwd = await initFixture(\"root-manifest-only\");\n+\n+ expect(getCurrentSHA({ cwd })).toMatch(/^[0-9a-f]{40}$/);\n+});\n",
"new_path": "commands/publish/__tests__/get-current-sha.test.js",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+\"use strict\";\n+\n+const initFixture = require(\"@lerna-test/init-fixture\")(__dirname);\n+const getShortSHA = require(\"../lib/get-short-sha\");\n+\n+test(\"getShortSHA\", async () => {\n+ const cwd = await initFixture(\"root-manifest-only\");\n+\n+ expect(getShortSHA({ cwd })).toMatch(/^[0-9a-f]{7,8}$/);\n+});\n",
"new_path": "commands/publish/__tests__/get-short-sha.test.js",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+\"use strict\";\n+\n+const execa = require(\"execa\");\n+const fs = require(\"fs-extra\");\n+const path = require(\"path\");\n+const slash = require(\"slash\");\n+const initFixture = require(\"@lerna-test/init-fixture\")(__dirname);\n+const gitAdd = require(\"../lib/git-add\");\n+\n+test(\"relative files\", async () => {\n+ const cwd = await initFixture(\"root-manifest-only\");\n+ const file = path.join(\"packages\", \"pkg-1\", \"index.js\");\n+\n+ await fs.outputFile(path.join(cwd, file), \"hello\");\n+ await gitAdd([file], { cwd });\n+\n+ const list = await execa.stdout(\"git\", [\"diff\", \"--cached\", \"--name-only\"], { cwd });\n+ expect(slash(list)).toBe(\"packages/pkg-1/index.js\");\n+});\n+\n+test(\"absolute files\", async () => {\n+ const cwd = await initFixture(\"root-manifest-only\");\n+ const file = path.join(cwd, \"packages\", \"pkg-2\", \"index.js\");\n+\n+ await fs.outputFile(file, \"hello\");\n+ await gitAdd([file], { cwd });\n+\n+ const list = await execa.stdout(\"git\", [\"diff\", \"--cached\", \"--name-only\"], { cwd });\n+ expect(slash(list)).toBe(\"packages/pkg-2/index.js\");\n+});\n",
"new_path": "commands/publish/__tests__/git-add.test.js",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+\"use strict\";\n+\n+const execa = require(\"execa\");\n+const fs = require(\"fs-extra\");\n+const path = require(\"path\");\n+const initFixture = require(\"@lerna-test/init-fixture\")(__dirname);\n+const gitCheckout = require(\"../lib/git-checkout\");\n+\n+test(\"gitCheckout\", async () => {\n+ const cwd = await initFixture(\"normal-no-inter-dependencies\");\n+\n+ await fs.writeJSON(path.join(cwd, \"packages\", \"package-1\", \"package.json\"), { foo: \"bar\" });\n+ await gitCheckout(\"packages/*/package.json\", { cwd });\n+\n+ const modified = await execa.stdout(\"git\", [\"ls-files\", \"--modified\"], { cwd });\n+ expect(modified).toBe(\"\");\n+});\n",
"new_path": "commands/publish/__tests__/git-checkout.test.js",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+\"use strict\";\n+\n+const execa = require(\"execa\");\n+const fs = require(\"fs-extra\");\n+const { EOL } = require(\"os\");\n+const path = require(\"path\");\n+const initFixture = require(\"@lerna-test/init-fixture\")(__dirname);\n+const gitCommit = require(\"../lib/git-commit\");\n+\n+test(\"commit message\", async () => {\n+ const cwd = await initFixture(\"root-manifest-only\");\n+\n+ await fs.outputFile(path.join(cwd, \"packages\", \"pkg-3\", \"index.js\"), \"hello\");\n+ await execa(\"git\", [\"add\", \".\"], { cwd });\n+ await gitCommit(\"foo\", { cwd });\n+\n+ const message = await execa.stdout(\"git\", [\"log\", \"-1\", \"--pretty=format:%B\"], { cwd });\n+ expect(message).toBe(\"foo\");\n+});\n+\n+test(\"multiline message\", async () => {\n+ const cwd = await initFixture(\"root-manifest-only\");\n+\n+ await fs.outputFile(path.join(cwd, \"packages\", \"pkg-4\", \"index.js\"), \"hello\");\n+ await execa(\"git\", [\"add\", \".\"], { cwd });\n+ await gitCommit(`foo${EOL}${EOL}bar`, { cwd });\n+\n+ const subject = await execa.stdout(\"git\", [\"log\", \"-1\", \"--pretty=format:%s\"], { cwd });\n+ const body = await execa.stdout(\"git\", [\"log\", \"-1\", \"--pretty=format:%b\"], { cwd });\n+\n+ expect(subject).toBe(\"foo\");\n+ expect(body).toBe(\"bar\");\n+});\n",
"new_path": "commands/publish/__tests__/git-commit.test.js",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+\"use strict\";\n+\n+const execa = require(\"execa\");\n+const initFixture = require(\"@lerna-test/init-fixture\")(__dirname);\n+const gitTag = require(\"../lib/git-tag\");\n+\n+test(\"gitTag\", async () => {\n+ const cwd = await initFixture(\"root-manifest-only\");\n+\n+ await gitTag(\"v1.2.3\", { cwd });\n+\n+ const list = await execa.stdout(\"git\", [\"tag\", \"--list\"], { cwd });\n+ expect(list).toMatch(\"v1.2.3\");\n+});\n",
"new_path": "commands/publish/__tests__/git-tag.test.js",
"old_path": null
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
chore(publish): Restore targeted utility tests
| 1
|
chore
|
publish
|
791,723
|
23.04.2018 13:27:18
| 25,200
|
4276e6ec4f9f42c0ab9d1dc755e14b0f290afdc5
|
misc: remove timing from golden lhr
|
[
{
"change_type": "MODIFY",
"diff": "const {readFileSync, writeFileSync} = require('fs');\nconst filename = process.argv[2];\n+const extraFlag = process.argv[3];\nif (!filename) throw new Error('No filename provided.');\nconst data = readFileSync(filename, 'utf8');\n@@ -24,8 +25,10 @@ writeFileSync(filename, cleanAndFormatLHR(data), 'utf8');\nfunction cleanAndFormatLHR(lhrString) {\nconst lhr = JSON.parse(lhrString);\ndelete lhr.timing;\n+ if (extraFlag !== '--only-remove-timing') {\nfor (const auditResult of Object.values(lhr.audits)) {\nauditResult.helpText = '**Excluded from diff**';\n}\n+ }\nreturn JSON.stringify(lhr, null, 2);\n}\n",
"new_path": "lighthouse-core/scripts/cleanup-LHR-for-diff.js",
"old_path": "lighthouse-core/scripts/cleanup-LHR-for-diff.js"
},
{
"change_type": "MODIFY",
"diff": "\"title\": \"Additional items to manually check\",\n\"description\": \"Run these additional validators on your site to check additional SEO best practices.\"\n}\n- },\n- \"timing\": {\n- \"total\": 1709\n}\n}\n",
"new_path": "lighthouse-core/test/results/sample_v2.json",
"old_path": "lighthouse-core/test/results/sample_v2.json"
},
{
"change_type": "MODIFY",
"diff": "\"changelog\": \"conventional-changelog --config ./build/changelog-generator/index.js --infile changelog.md --same-file\",\n\"type-check\": \"tsc -p .\",\n\"update:sample-artifacts\": \"node lighthouse-core/scripts/update-report-fixtures.js -G\",\n- \"update:sample-json\": \"node ./lighthouse-cli -A=./lighthouse-core/test/results/artifacts --output=json --output-path=./lighthouse-core/test/results/sample_v2.json http://localhost/dobetterweb/dbw_tester.html\",\n+ \"update:sample-json\": \"node ./lighthouse-cli -A=./lighthouse-core/test/results/artifacts --output=json --output-path=./lighthouse-core/test/results/sample_v2.json http://localhost/dobetterweb/dbw_tester.html && node lighthouse-core/scripts/cleanup-LHR-for-diff.js ./lighthouse-core/test/results/sample_v2.json --only-remove-timing\",\n\"diff:sample-json\": \"bash lighthouse-core/scripts/assert-golden-lhr-unchanged.sh\",\n\"update:crdp-typings\": \"node lighthouse-core/scripts/extract-crdp-mapping.js\",\n\"mixed-content\": \"./lighthouse-cli/index.js --chrome-flags='--headless' --config-path=./lighthouse-core/config/mixed-content.js\"\n",
"new_path": "package.json",
"old_path": "package.json"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
misc: remove timing from golden lhr (#5020)
| 1
|
misc
| null |
807,849
|
23.04.2018 14:07:05
| 25,200
|
afcac01556c11cf0672d7fee4369f9c1ad075237
|
test: Move away from .resolves Jest shorthand, it obfuscates stacks
|
[
{
"change_type": "MODIFY",
"diff": "@@ -377,7 +377,9 @@ describe(\"PublishCommand\", () => {\nexpect(PromptUtilities.select).not.toBeCalled();\nexpect(PromptUtilities.confirm).not.toBeCalled();\n- await expect(gitCommitMessage(testDir)).resolves.toBe(\"v1.0.1-auto-confirm\");\n+\n+ const message = await gitCommitMessage(testDir);\n+ expect(message).toBe(\"v1.0.1-auto-confirm\");\n});\n});\n@@ -410,7 +412,9 @@ describe(\"PublishCommand\", () => {\nawait lernaPublish(testDir)(\"--repo-version\", \"1.0.1-beta.25\");\nexpect(PromptUtilities.select).not.toBeCalled();\n- await expect(gitCommitMessage(testDir)).resolves.toBe(\"v1.0.1-beta.25\");\n+\n+ const message = await gitCommitMessage(testDir);\n+ expect(message).toBe(\"v1.0.1-beta.25\");\n});\n});\n@@ -446,7 +450,9 @@ describe(\"PublishCommand\", () => {\nawait lernaPublish(testDir)(\"--cd-version\", \"minor\");\nexpect(PromptUtilities.select).not.toBeCalled();\n- await expect(gitCommitMessage(testDir)).resolves.toBe(\"v1.1.0\");\n+\n+ const message = await gitCommitMessage(testDir);\n+ expect(message).toBe(\"v1.1.0\");\n});\nit(\"throws an error when an invalid semver keyword is used\", async () => {\n@@ -510,7 +516,9 @@ describe(\"PublishCommand\", () => {\nawait lernaPublish(testDir)(\"--cd-version\", \"patch\");\nexpect(PromptUtilities.select).not.toBeCalled();\n- await expect(gitCommitMessage(testDir)).resolves.toMatchSnapshot();\n+\n+ const message = await gitCommitMessage(testDir);\n+ expect(message).toMatchSnapshot();\n});\n/** =========================================================================\n@@ -587,7 +595,8 @@ describe(\"PublishCommand\", () => {\n\"package-4\" // notably does NOT work, needs to be \"**/package-4/**\" to match\n);\n- await expect(showCommit(testDir, \"--name-only\")).resolves.toMatchSnapshot();\n+ const changedFiles = await showCommit(testDir, \"--name-only\");\n+ expect(changedFiles).toMatchSnapshot();\n});\nit(\"maps deprecated --ignore\", async () => {\n@@ -600,7 +609,8 @@ describe(\"PublishCommand\", () => {\nawait lernaPublish(testDir)(\"--ignore\", \"*.md\");\n- await expect(showCommit(testDir, \"--name-only\")).resolves.toMatchSnapshot();\n+ const changedFiles = await showCommit(testDir, \"--name-only\");\n+ expect(changedFiles).toMatchSnapshot();\n});\n});\n@@ -666,7 +676,8 @@ describe(\"PublishCommand\", () => {\nawait lernaPublish(testDir)(\"--conventional-commits\");\n- await expect(showCommit(testDir, \"--name-only\")).resolves.toMatchSnapshot();\n+ const changedFiles = await showCommit(testDir, \"--name-only\");\n+ expect(changedFiles).toMatchSnapshot();\n[\"package-1\", \"package-2\", \"package-3\", \"package-4\", \"package-5\"].forEach((name, idx) => {\nexpect(ConventionalCommitUtilities.recommendVersion).toBeCalledWith(\n@@ -716,7 +727,8 @@ describe(\"PublishCommand\", () => {\nawait lernaPublish(testDir)(\"--conventional-commits\");\n- await expect(showCommit(testDir, \"--name-only\")).resolves.toMatchSnapshot();\n+ const changedFiles = await showCommit(testDir, \"--name-only\");\n+ expect(changedFiles).toMatchSnapshot();\n[\"package-1\", \"package-2\", \"package-3\", \"package-4\", \"package-5\"].forEach(name => {\nconst location = path.join(testDir, \"packages\", name);\n",
"new_path": "commands/publish/__tests__/publish-command.test.js",
"old_path": "commands/publish/__tests__/publish-command.test.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -25,7 +25,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n`;\n-exports[`conventional-commits updateChangelog() creates files if they do not exist: package-1 1`] = `\n+exports[`conventional-commits updateChangelog() creates files if they do not exist: leaf 1`] = `\n# Change Log\nAll notable changes to this project will be documented in this file.\n@@ -78,7 +78,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n`;\n-exports[`conventional-commits updateChangelog() updates fixed changelogs 1`] = `\n+exports[`conventional-commits updateChangelog() updates fixed changelogs: leaf 1`] = `\n# Change Log\nAll notable changes to this project will be documented in this file.\n@@ -106,7 +106,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline\n`;\n-exports[`conventional-commits updateChangelog() updates fixed changelogs 2`] = `\n+exports[`conventional-commits updateChangelog() updates fixed changelogs: root 1`] = `\n# Change Log\nAll notable changes to this project will be documented in this file.\n",
"new_path": "core/conventional-commits/__tests__/__snapshots__/conventional-commits.test.js.snap",
"old_path": "core/conventional-commits/__tests__/__snapshots__/conventional-commits.test.js.snap"
},
{
"change_type": "MODIFY",
"diff": "@@ -27,7 +27,8 @@ describe(\"conventional-commits\", () => {\nawait gitAdd(cwd, pkg1.manifestLocation);\nawait gitCommit(cwd, \"feat: changed 1\");\n- await expect(recommendVersion(pkg1, \"fixed\", {})).resolves.toBe(\"1.1.0\");\n+ const bump = await recommendVersion(pkg1, \"fixed\", {});\n+ expect(bump).toBe(\"1.1.0\");\n});\nit(\"returns package-specific bumps in independent mode\", async () => {\n@@ -45,8 +46,12 @@ describe(\"conventional-commits\", () => {\nawait gitAdd(cwd, pkg2.manifestLocation);\nawait gitCommit(cwd, \"feat: changed 2\");\n- await expect(recommendVersion(pkg1, \"independent\", opts)).resolves.toBe(\"1.0.1\");\n- await expect(recommendVersion(pkg2, \"independent\", opts)).resolves.toBe(\"1.1.0\");\n+ const [bump1, bump2] = await Promise.all([\n+ recommendVersion(pkg1, \"independent\", opts),\n+ recommendVersion(pkg2, \"independent\", opts),\n+ ]);\n+ expect(bump1).toBe(\"1.0.1\");\n+ expect(bump2).toBe(\"1.1.0\");\n});\nit(\"supports local preset paths\", async () => {\n@@ -171,15 +176,21 @@ describe(\"conventional-commits\", () => {\n// update version\nawait pkg1.set(\"version\", \"1.1.0\").serialize();\n- const changelogLocation = await updateChangelog(pkg1, \"fixed\", {\n- changelogPreset: \"angular\",\n- });\n+ const [leafChangelogFile, rootChangelogFile] = await Promise.all([\n+ updateChangelog(pkg1, \"fixed\", { changelogPreset: \"angular\" }),\n+ updateChangelog(rootPkg, \"root\", { version: \"1.1.0\" }),\n+ ]);\n+\n+ expect(leafChangelogFile).toBe(path.join(pkg1.location, \"CHANGELOG.md\"));\n+ expect(rootChangelogFile).toBe(path.join(rootPkg.location, \"CHANGELOG.md\"));\n- expect(changelogLocation).toBe(path.join(pkg1.location, \"CHANGELOG.md\"));\n- await expect(getFileContent(changelogLocation)).resolves.toMatchSnapshot(\"package-1\");\n- await expect(\n- updateChangelog(rootPkg, \"root\", { version: \"1.1.0\" }).then(getFileContent)\n- ).resolves.toMatchSnapshot(\"root\");\n+ const [leafChangelogContent, rootChangelogContent] = await Promise.all([\n+ getFileContent(leafChangelogFile),\n+ getFileContent(rootChangelogFile),\n+ ]);\n+\n+ expect(leafChangelogContent).toMatchSnapshot(\"leaf\");\n+ expect(rootChangelogContent).toMatchSnapshot(\"root\");\n});\nit(\"updates fixed changelogs\", async () => {\n@@ -201,13 +212,13 @@ describe(\"conventional-commits\", () => {\n// update version\nawait pkg1.set(\"version\", \"1.0.1\").serialize();\n- await expect(\n- updateChangelog(pkg1, \"fixed\", /* default preset */ {}).then(getFileContent)\n- ).resolves.toMatchSnapshot();\n+ const [leafChangelogContent, rootChangelogContent] = await Promise.all([\n+ updateChangelog(pkg1, \"fixed\", /* default preset */ {}).then(getFileContent),\n+ updateChangelog(rootPkg, \"root\", { version: \"1.0.1\" }).then(getFileContent),\n+ ]);\n- await expect(\n- updateChangelog(rootPkg, \"root\", { version: \"1.0.1\" }).then(getFileContent)\n- ).resolves.toMatchSnapshot();\n+ expect(leafChangelogContent).toMatchSnapshot(\"leaf\");\n+ expect(rootChangelogContent).toMatchSnapshot(\"root\");\n});\nit(\"appends version bump message if no commits have been recorded\", async () => {\n@@ -225,9 +236,11 @@ describe(\"conventional-commits\", () => {\n// update version\nawait pkg2.set(\"version\", \"1.0.1\").serialize();\n- await expect(\n- updateChangelog(pkg2, \"fixed\", { changelogPreset: \"./scripts/local-preset\" }).then(getFileContent)\n- ).resolves.toMatchSnapshot();\n+ const leafChangelogContent = await updateChangelog(pkg2, \"fixed\", {\n+ changelogPreset: \"./scripts/local-preset\",\n+ }).then(getFileContent);\n+\n+ expect(leafChangelogContent).toMatchSnapshot();\n});\nit(\"supports old preset API\", async () => {\n@@ -245,9 +258,11 @@ describe(\"conventional-commits\", () => {\n// update version\nawait pkg1.set(\"version\", \"1.0.1\").serialize();\n- await expect(\n- updateChangelog(pkg1, \"fixed\", { changelogPreset: \"./scripts/old-api-preset\" }).then(getFileContent)\n- ).resolves.toMatchSnapshot();\n+ const leafChangelogContent = await updateChangelog(pkg1, \"fixed\", {\n+ changelogPreset: \"./scripts/old-api-preset\",\n+ }).then(getFileContent);\n+\n+ expect(leafChangelogContent).toMatchSnapshot();\n});\nit(\"updates independent changelogs\", async () => {\n",
"new_path": "core/conventional-commits/__tests__/conventional-commits.test.js",
"old_path": "core/conventional-commits/__tests__/conventional-commits.test.js"
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
test: Move away from .resolves Jest shorthand, it obfuscates stacks
| 1
|
test
| null |
217,922
|
23.04.2018 14:17:09
| -7,200
|
c95703fd4d0737ef7da00f8ed2efbeb0e0aec27f
|
chore: translations for wiki pages
|
[
{
"change_type": "MODIFY",
"diff": "\"User_id_tip\": \"Die Nutzer-ID kann in der unteren rechten Ecke auf der Profilseite eingesehen werden.\",\n\"Saving\": \"Rechte werden gespeichert\",\n\"No_anonymous\": \"Du brauchst einen Account, um Rechte zu verwalten\"\n+ },\n+ \"WIKI\": {\n+ \"Title\": \"Wiki\",\n+ \"Not_found_in_current_lang\": \"Diese Seite wurde nicht in deiner Sprache gefunden, deshalb wird die englische Version angezeigt.\",\n+ \"Not_found\": \"Seite nicht gefunden\"\n}\n}\n",
"new_path": "src/assets/i18n/de.json",
"old_path": "src/assets/i18n/de.json"
},
{
"change_type": "MODIFY",
"diff": "\"User_id_tip\": \"The user ID can be found in profile page in bottom-right corner\",\n\"Saving\": \"Saving permissions\",\n\"No_anonymous\": \"You need an account to manage permissions\"\n+ },\n+ \"WIKI\": {\n+ \"Title\": \"Wiki\",\n+ \"Not_found_in_current_lang\": \"This page isn't found in your current language, english version will be shown\",\n+ \"Not_found\": \"Page not found\"\n}\n}\n",
"new_path": "src/assets/i18n/en.json",
"old_path": "src/assets/i18n/en.json"
},
{
"change_type": "MODIFY",
"diff": "\"Cloning_list\": \"Creating a copy of the list to your account\",\n\"Redirect_notice\": \"You'll be redirected to the list once the clone is created\",\n\"Not_found\": \"Template not found\"\n+ },\n+ \"WIKI\": {\n+ \"Title\": \"Wiki\",\n+ \"Not_found_in_current_lang\": \"This page isn't found in your current language, english version will be shown\",\n+ \"Not_found\": \"Page not found\"\n}\n}\n",
"new_path": "src/assets/i18n/ja.json",
"old_path": "src/assets/i18n/ja.json"
}
] |
TypeScript
|
MIT License
|
ffxiv-teamcraft/ffxiv-teamcraft
|
chore: translations for wiki pages
| 1
|
chore
| null |
679,913
|
23.04.2018 14:18:49
| -3,600
|
ef3903e49851663f9e069a17a0aceae43ae8b821
|
feat(rstream-query): initial import
|
[
{
"change_type": "ADD",
"diff": "+build\n+coverage\n+dev\n+doc\n+src*\n+test\n+.nyc_output\n+tsconfig.json\n+*.tgz\n+*.html\n",
"new_path": "packages/rstream-query/.npmignore",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+ Apache License\n+ Version 2.0, January 2004\n+ http://www.apache.org/licenses/\n+\n+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n+\n+ 1. Definitions.\n+\n+ \"License\" shall mean the terms and conditions for use, reproduction,\n+ and distribution as defined by Sections 1 through 9 of this document.\n+\n+ \"Licensor\" shall mean the copyright owner or entity authorized by\n+ the copyright owner that is granting the License.\n+\n+ \"Legal Entity\" shall mean the union of the acting entity and all\n+ other entities that control, are controlled by, or are under common\n+ control with that entity. For the purposes of this definition,\n+ \"control\" means (i) the power, direct or indirect, to cause the\n+ direction or management of such entity, whether by contract or\n+ otherwise, or (ii) ownership of fifty percent (50%) or more of the\n+ outstanding shares, or (iii) beneficial ownership of such entity.\n+\n+ \"You\" (or \"Your\") shall mean an individual or Legal Entity\n+ exercising permissions granted by this License.\n+\n+ \"Source\" form shall mean the preferred form for making modifications,\n+ including but not limited to software source code, documentation\n+ source, and configuration files.\n+\n+ \"Object\" form shall mean any form resulting from mechanical\n+ transformation or translation of a Source form, including but\n+ not limited to compiled object code, generated documentation,\n+ and conversions to other media types.\n+\n+ \"Work\" shall mean the work of authorship, whether in Source or\n+ Object form, made available under the License, as indicated by a\n+ copyright notice that is included in or attached to the work\n+ (an example is provided in the Appendix below).\n+\n+ \"Derivative Works\" shall mean any work, whether in Source or Object\n+ form, that is based on (or derived from) the Work and for which the\n+ editorial revisions, annotations, elaborations, or other modifications\n+ represent, as a whole, an original work of authorship. For the purposes\n+ of this License, Derivative Works shall not include works that remain\n+ separable from, or merely link (or bind by name) to the interfaces of,\n+ the Work and Derivative Works thereof.\n+\n+ \"Contribution\" shall mean any work of authorship, including\n+ the original version of the Work and any modifications or additions\n+ to that Work or Derivative Works thereof, that is intentionally\n+ submitted to Licensor for inclusion in the Work by the copyright owner\n+ or by an individual or Legal Entity authorized to submit on behalf of\n+ the copyright owner. For the purposes of this definition, \"submitted\"\n+ means any form of electronic, verbal, or written communication sent\n+ to the Licensor or its representatives, including but not limited to\n+ communication on electronic mailing lists, source code control systems,\n+ and issue tracking systems that are managed by, or on behalf of, the\n+ Licensor for the purpose of discussing and improving the Work, but\n+ excluding communication that is conspicuously marked or otherwise\n+ designated in writing by the copyright owner as \"Not a Contribution.\"\n+\n+ \"Contributor\" shall mean Licensor and any individual or Legal Entity\n+ on behalf of whom a Contribution has been received by Licensor and\n+ subsequently incorporated within the Work.\n+\n+ 2. Grant of Copyright License. Subject to the terms and conditions of\n+ this License, each Contributor hereby grants to You a perpetual,\n+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n+ copyright license to reproduce, prepare Derivative Works of,\n+ publicly display, publicly perform, sublicense, and distribute the\n+ Work and such Derivative Works in Source or Object form.\n+\n+ 3. Grant of Patent License. Subject to the terms and conditions of\n+ this License, each Contributor hereby grants to You a perpetual,\n+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n+ (except as stated in this section) patent license to make, have made,\n+ use, offer to sell, sell, import, and otherwise transfer the Work,\n+ where such license applies only to those patent claims licensable\n+ by such Contributor that are necessarily infringed by their\n+ Contribution(s) alone or by combination of their Contribution(s)\n+ with the Work to which such Contribution(s) was submitted. If You\n+ institute patent litigation against any entity (including a\n+ cross-claim or counterclaim in a lawsuit) alleging that the Work\n+ or a Contribution incorporated within the Work constitutes direct\n+ or contributory patent infringement, then any patent licenses\n+ granted to You under this License for that Work shall terminate\n+ as of the date such litigation is filed.\n+\n+ 4. Redistribution. You may reproduce and distribute copies of the\n+ Work or Derivative Works thereof in any medium, with or without\n+ modifications, and in Source or Object form, provided that You\n+ meet the following conditions:\n+\n+ (a) You must give any other recipients of the Work or\n+ Derivative Works a copy of this License; and\n+\n+ (b) You must cause any modified files to carry prominent notices\n+ stating that You changed the files; and\n+\n+ (c) You must retain, in the Source form of any Derivative Works\n+ that You distribute, all copyright, patent, trademark, and\n+ attribution notices from the Source form of the Work,\n+ excluding those notices that do not pertain to any part of\n+ the Derivative Works; and\n+\n+ (d) If the Work includes a \"NOTICE\" text file as part of its\n+ distribution, then any Derivative Works that You distribute must\n+ include a readable copy of the attribution notices contained\n+ within such NOTICE file, excluding those notices that do not\n+ pertain to any part of the Derivative Works, in at least one\n+ of the following places: within a NOTICE text file distributed\n+ as part of the Derivative Works; within the Source form or\n+ documentation, if provided along with the Derivative Works; or,\n+ within a display generated by the Derivative Works, if and\n+ wherever such third-party notices normally appear. The contents\n+ of the NOTICE file are for informational purposes only and\n+ do not modify the License. You may add Your own attribution\n+ notices within Derivative Works that You distribute, alongside\n+ or as an addendum to the NOTICE text from the Work, provided\n+ that such additional attribution notices cannot be construed\n+ as modifying the License.\n+\n+ You may add Your own copyright statement to Your modifications and\n+ may provide additional or different license terms and conditions\n+ for use, reproduction, or distribution of Your modifications, or\n+ for any such Derivative Works as a whole, provided Your use,\n+ reproduction, and distribution of the Work otherwise complies with\n+ the conditions stated in this License.\n+\n+ 5. Submission of Contributions. Unless You explicitly state otherwise,\n+ any Contribution intentionally submitted for inclusion in the Work\n+ by You to the Licensor shall be under the terms and conditions of\n+ this License, without any additional terms or conditions.\n+ Notwithstanding the above, nothing herein shall supersede or modify\n+ the terms of any separate license agreement you may have executed\n+ with Licensor regarding such Contributions.\n+\n+ 6. Trademarks. This License does not grant permission to use the trade\n+ names, trademarks, service marks, or product names of the Licensor,\n+ except as required for reasonable and customary use in describing the\n+ origin of the Work and reproducing the content of the NOTICE file.\n+\n+ 7. Disclaimer of Warranty. Unless required by applicable law or\n+ agreed to in writing, Licensor provides the Work (and each\n+ Contributor provides its Contributions) on an \"AS IS\" BASIS,\n+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n+ implied, including, without limitation, any warranties or conditions\n+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n+ PARTICULAR PURPOSE. You are solely responsible for determining the\n+ appropriateness of using or redistributing the Work and assume any\n+ risks associated with Your exercise of permissions under this License.\n+\n+ 8. Limitation of Liability. In no event and under no legal theory,\n+ whether in tort (including negligence), contract, or otherwise,\n+ unless required by applicable law (such as deliberate and grossly\n+ negligent acts) or agreed to in writing, shall any Contributor be\n+ liable to You for damages, including any direct, indirect, special,\n+ incidental, or consequential damages of any character arising as a\n+ result of this License or out of the use or inability to use the\n+ Work (including but not limited to damages for loss of goodwill,\n+ work stoppage, computer failure or malfunction, or any and all\n+ other commercial damages or losses), even if such Contributor\n+ has been advised of the possibility of such damages.\n+\n+ 9. Accepting Warranty or Additional Liability. While redistributing\n+ the Work or Derivative Works thereof, You may choose to offer,\n+ and charge a fee for, acceptance of support, warranty, indemnity,\n+ or other liability obligations and/or rights consistent with this\n+ License. However, in accepting such obligations, You may act only\n+ on Your own behalf and on Your sole responsibility, not on behalf\n+ of any other Contributor, and only if You agree to indemnify,\n+ defend, and hold each Contributor harmless for any liability\n+ incurred by, or claims asserted against, such Contributor by reason\n+ of your accepting any such warranty or additional liability.\n+\n+ END OF TERMS AND CONDITIONS\n+\n+ APPENDIX: How to apply the Apache License to your work.\n+\n+ To apply the Apache License to your work, attach the following\n+ boilerplate notice, with the fields enclosed by brackets \"{}\"\n+ replaced with your own identifying information. (Don't include\n+ the brackets!) The text should be enclosed in the appropriate\n+ comment syntax for the file format. We also recommend that a\n+ file or class name and description of purpose be included on the\n+ same \"printed page\" as the copyright notice for easier\n+ identification within third-party archives.\n+\n+ Copyright {yyyy} {name of copyright owner}\n+\n+ Licensed under the Apache License, Version 2.0 (the \"License\");\n+ you may not use this file except in compliance with the License.\n+ You may obtain a copy of the License at\n+\n+ http://www.apache.org/licenses/LICENSE-2.0\n+\n+ Unless required by applicable law or agreed to in writing, software\n+ distributed under the License is distributed on an \"AS IS\" BASIS,\n+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ See the License for the specific language governing permissions and\n+ limitations under the License.\n",
"new_path": "packages/rstream-query/LICENSE",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+# @thi.ng/rstream-query\n+\n+[](https://www.npmjs.com/package/@thi.ng/rstream-query)\n+\n+## About\n+\n+TODO...\n+\n+## Installation\n+\n+```\n+yarn add @thi.ng/rstream-query\n+```\n+\n+## Usage examples\n+\n+```typescript\n+import * as rstream-query from \"@thi.ng/rstream-query\";\n+```\n+\n+## Authors\n+\n+- Karsten Schmidt\n+\n+## License\n+\n+© 2018 Karsten Schmidt // Apache Software License 2.0\n",
"new_path": "packages/rstream-query/README.md",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+{\n+ \"name\": \"@thi.ng/rstream-query\",\n+ \"version\": \"0.0.1\",\n+ \"description\": \"TODO\",\n+ \"main\": \"./index.js\",\n+ \"typings\": \"./index.d.ts\",\n+ \"repository\": \"https://github.com/thi-ng/umbrella\",\n+ \"author\": \"Karsten Schmidt <k+npm@thi.ng>\",\n+ \"license\": \"Apache-2.0\",\n+ \"scripts\": {\n+ \"build\": \"yarn run clean && tsc --declaration\",\n+ \"clean\": \"rm -rf *.js *.d.ts .nyc_output build coverage doc\",\n+ \"cover\": \"yarn test && nyc report --reporter=lcov\",\n+ \"doc\": \"node_modules/.bin/typedoc --mode modules --out doc src\",\n+ \"pub\": \"yarn run build && yarn publish --access public\",\n+ \"test\": \"rm -rf build && tsc -p test && nyc mocha build/test/*.js\"\n+ },\n+ \"devDependencies\": {\n+ \"@types/mocha\": \"^5.0.0\",\n+ \"@types/node\": \"^9.6.1\",\n+ \"mocha\": \"^5.0.5\",\n+ \"nyc\": \"^11.6.0\",\n+ \"typedoc\": \"^0.11.1\",\n+ \"typescript\": \"^2.8.1\"\n+ },\n+ \"dependencies\": {\n+ \"@thi.ng/api\": \"^2.2.0\",\n+ \"@thi.ng/associative\": \"^0.4.3\",\n+ \"@thi.ng/rstream\": \"^1.5.1\",\n+ \"@thi.ng/transducers\": \"^1.8.1\"\n+ },\n+ \"keywords\": [\n+ \"ES6\",\n+ \"typescript\"\n+ ],\n+ \"publishConfig\": {\n+ \"access\": \"public\"\n+ }\n+}\n\\ No newline at end of file\n",
"new_path": "packages/rstream-query/package.json",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+export interface Pattern extends Array<any> {\n+ [0]: any;\n+ [1]: any;\n+ [2]: any;\n+}\n+\n+export type Fact = Pattern;\n+\n+export const CHOICES = Symbol(\"CHOICES\");\n+\n+export enum EditOp {\n+ ADD,\n+ DELETE,\n+ UPDATE\n+}\n+\n+export interface Edit {\n+ op: EditOp;\n+ key: any;\n+ id: number;\n+}\n\\ No newline at end of file\n",
"new_path": "packages/rstream-query/src/api.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+import { equiv } from \"@thi.ng/api/equiv\";\n+// import { SortedMap } from \"@thi.ng/associative/sorted-map\";\n+import { intersection } from \"@thi.ng/associative/intersection\";\n+import { Stream, trace, Subscription, sync } from \"@thi.ng/rstream\";\n+import { Transducer, Reducer } from \"@thi.ng/transducers/api\";\n+import { compR } from \"@thi.ng/transducers/func/compr\";\n+import { map } from \"@thi.ng/transducers/xform/map\";\n+\n+import { Fact, Pattern, EditOp, Edit } from \"./api\";\n+\n+export class FactGraph {\n+\n+ static NEXT_ID = 0;\n+\n+ facts: Fact[];\n+ indexS: Map<any, Set<number>>;\n+ indexP: Map<any, Set<number>>;\n+ indexO: Map<any, Set<number>>;\n+ allIDs: Set<number>;\n+\n+ indexSelS: Map<any, Subscription<Edit, Set<number>>>;\n+ indexSelP: Map<any, Subscription<Edit, Set<number>>>;\n+ indexSelO: Map<any, Subscription<Edit, Set<number>>>;\n+\n+ streamAll: Stream<Set<number>>;\n+ streamS: Stream<Edit>;\n+ streamP: Stream<Edit>;\n+ streamO: Stream<Edit>;\n+\n+ constructor() {\n+ this.facts = [];\n+ this.indexS = new Map();\n+ this.indexP = new Map();\n+ this.indexO = new Map();\n+ this.streamS = new Stream(\"S\");\n+ this.streamP = new Stream(\"P\");\n+ this.streamO = new Stream(\"O\");\n+ this.streamAll = new Stream(\"ALL\");\n+ this.allIDs = new Set<number>();\n+ }\n+\n+ addFact(f: Fact) {\n+ let s = this.indexS.get(f[0]);\n+ let p = this.indexP.get(f[1]);\n+ let o = this.indexO.get(f[2]);\n+ if (this.findInIndices(s, p, o, f) !== -1) return this;\n+ s || (s = new Set<number>());\n+ p || (p = new Set<number>());\n+ o || (o = new Set<number>());\n+ const id = FactGraph.NEXT_ID++;\n+ this.facts[id] = f;\n+ s.add(id);\n+ p.add(id);\n+ o.add(id);\n+ this.allIDs.add(id);\n+ this.indexS.set(f[0], s);\n+ this.indexP.set(f[1], p);\n+ this.indexO.set(f[2], o);\n+ this.streamAll.next(this.allIDs);\n+ this.streamS.next({ op: EditOp.ADD, key: f[0], id });\n+ this.streamP.next({ op: EditOp.ADD, key: f[1], id });\n+ this.streamO.next({ op: EditOp.ADD, key: f[2], id });\n+ return this;\n+ }\n+\n+ addQuery(id: string, [s, p, o]: Pattern) {\n+ const qs: Subscription<any, Set<number>> = s != null ?\n+ this.streamS.transform(indexSel(s), \"s\") :\n+ this.streamAll.subscribe(null, \"s\");\n+ const qp: Subscription<any, Set<number>> = p != null ?\n+ this.streamP.transform(indexSel(p), \"p\") :\n+ this.streamAll.subscribe(null, \"p\");\n+ const qo: Subscription<any, Set<number>> = o != null ?\n+ this.streamO.transform(indexSel(o), \"o\") :\n+ this.streamAll.subscribe(null, \"o\");\n+ const results = sync<Set<number>, Set<Fact>>({\n+ id,\n+ src: [qs, qp, qo],\n+ xform: map(\n+ ({ s, p, o }) => {\n+ const res = new Set<Fact>();\n+ for (let id of intersection(intersection(s, p), o)) {\n+ res.add(this.facts[id])\n+ }\n+ return res;\n+ }\n+ )\n+ });\n+ for (let id = this.facts.length - 1; id >= 0; id--) {\n+ const f = this.facts[id];\n+ qs.next(s != null ? { op: EditOp.ADD, key: f[0], id } : this.allIDs);\n+ qp.next(p != null ? { op: EditOp.ADD, key: f[1], id } : this.allIDs);\n+ qo.next(o != null ? { op: EditOp.ADD, key: f[2], id } : this.allIDs);\n+ }\n+ return results.subscribe(trace(`${id}: `));\n+ }\n+\n+ findInIndices(s: Set<number>, p: Set<number>, o: Set<number>, f: Fact) {\n+ if (s && p && o) {\n+ const facts = this.facts;\n+ const index = s.size < p.size ?\n+ s.size < o.size ? s : p.size < o.size ? p : o :\n+ p.size < o.size ? p : s.size < o.size ? s : o;\n+ console.log(\"smallest index\", index, s, p, o);\n+ for (let id of index) {\n+ if (equiv(facts[id], f)) {\n+ return id;\n+ }\n+ }\n+ }\n+ return -1;\n+ }\n+}\n+\n+export function indexSel(key: any): Transducer<Edit, Set<number>> {\n+ return (rfn: Reducer<any, Set<number>>) => {\n+ const r = rfn[2];\n+ const sel = new Set<number>();\n+ return compR(rfn,\n+ (acc, e) => {\n+ if (key == null || equiv(e.key, key)) {\n+ switch (e.op) {\n+ case EditOp.ADD:\n+ sel.add(e.id);\n+ return r(acc, sel);\n+ case EditOp.DELETE:\n+ sel.delete(e.id);\n+ case EditOp.UPDATE:\n+ return r(acc, sel);\n+ default:\n+ }\n+ }\n+ return acc;\n+ });\n+ };\n+}\n+\n+export const g = new FactGraph();\n+g.addFact([\"mia\", \"loves\", \"toxi\"]);\n+g.addFact([\"mia\", \"loves\", \"ned\"]);\n+g.addFact([\"mia\", \"age\", 42]);\n+g.addFact([\"toxi\", \"age\", 42]);\n+g.addFact([\"mia\", \"loves\", \"noah\"]);\n+export const q1 = g.addQuery(\"mia\", [\"mia\", null, null]);\n+export const q2 = g.addQuery(\"loves\", [null, \"loves\", null]);\n+export const q3 = g.addQuery(\"all\", [null, null, null]);\n",
"new_path": "packages/rstream-query/src/graph.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+import { repeatedly } from \"@thi.ng/transducers/iter/repeatedly\";\n+\n+import { Pattern } from \"./api\";\n+import { isQVar, autoQVar } from \"./qvar\";\n+\n+export const patternVarCount = (p: Pattern) => {\n+ let n = 0;\n+ if (isQVar(p[0])) n++;\n+ if (isQVar(p[1])) n++;\n+ if (isQVar(p[2])) n++;\n+ return n;\n+};\n+\n+/**\n+ * Takes a path triple pattern and max depth. The pattern's predicate\n+ * must be a seq of preds. Returns a 2-elem vector [patterns vars],\n+ * where `patterns` is a seq of query patterns with injected temp qvars\n+ * for in between patterns and`vars` the autogenerated qvars themselves.\n+ *\n+ * Example:\n+ *\n+ * ```\n+ * [\"?s\", [p1, p2, p3], \"?o\"] =>\n+ * [\n+ * [[\"?s\", p1, \"?__q0\"], [\"?__q0\", p2, \"?__q1\"], [\"?__q1\", p3, \"?o\"] ],\n+ * [\"?__q0\", \"?__q1\"]\n+ * ]\n+ * ```\n+ *\n+ * @param pattern\n+ * @param maxd\n+ */\n+export const resolvePathPattern = ([s, p, o], maxd = p.length) => {\n+ const res = [];\n+ const avars = [...repeatedly(autoQVar, maxd - 1)];\n+ for (let i = 0; i < maxd; i++) {\n+ res.push([s, p[i % p.length], s = avars[i]]);\n+ }\n+ res[res.length - 1][2] = o;\n+ return [res, avars];\n+};\n+\n+export const sortPatterns = (patterns: Pattern[]) =>\n+ patterns.sort((a, b) => patternVarCount(a) - patternVarCount(b));\n",
"new_path": "packages/rstream-query/src/pattern.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+import { isString } from \"@thi.ng/checks/is-string\";\n+\n+const AUTO_QVAR_PREFIX = \"?__q\";\n+let AUTO_QVAR_ID = 0;\n+\n+export const isQVar = (x: any) =>\n+ isString(x) && x.charAt(0) === \"?\";\n+\n+export const isAutoQVar = (x: any) =>\n+ isString(x) && x.indexOf(AUTO_QVAR_PREFIX) == 0;\n+\n+export const autoQVar = () =>\n+ AUTO_QVAR_PREFIX + (AUTO_QVAR_ID++).toString(36);\n+\n+export const qvarName = (x: string) =>\n+ x.substr(1);\n",
"new_path": "packages/rstream-query/src/qvar.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+// import * as assert from \"assert\";\n+// import * as rstream-query from \"../src/index\";\n+\n+describe(\"rstream-query\", () => {\n+ it(\"tests pending\");\n+});\n",
"new_path": "packages/rstream-query/test/index.ts",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+{\n+ \"extends\": \"../../../tsconfig.json\",\n+ \"compilerOptions\": {\n+ \"outDir\": \"../build\"\n+ },\n+ \"include\": [\n+ \"./**/*.ts\",\n+ \"../src/**/*.ts\"\n+ ]\n+}\n",
"new_path": "packages/rstream-query/test/tsconfig.json",
"old_path": null
},
{
"change_type": "ADD",
"diff": "+{\n+ \"extends\": \"../../tsconfig.json\",\n+ \"compilerOptions\": {\n+ \"outDir\": \".\"\n+ },\n+ \"include\": [\n+ \"./src/**/*.ts\"\n+ ]\n+}\n",
"new_path": "packages/rstream-query/tsconfig.json",
"old_path": null
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
feat(rstream-query): initial import
| 1
|
feat
|
rstream-query
|
679,913
|
23.04.2018 15:25:28
| -3,600
|
a4aa4cb3acda02baf9579123b416a38213f6c9ea
|
refactor(rstream-query): simplify query handling, optimize addFact()
|
[
{
"change_type": "MODIFY",
"diff": "@@ -15,7 +15,6 @@ export enum EditOp {\n}\nexport interface Edit {\n- op: EditOp;\n+ index: Set<number>;\nkey: any;\n- id: number;\n}\n\\ No newline at end of file\n",
"new_path": "packages/rstream-query/src/api.ts",
"old_path": "packages/rstream-query/src/api.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -6,7 +6,7 @@ import { Transducer, Reducer } from \"@thi.ng/transducers/api\";\nimport { compR } from \"@thi.ng/transducers/func/compr\";\nimport { map } from \"@thi.ng/transducers/xform/map\";\n-import { Fact, Pattern, EditOp, Edit } from \"./api\";\n+import { Fact, Pattern, Edit } from \"./api\";\nexport class FactGraph {\n@@ -18,10 +18,6 @@ export class FactGraph {\nindexO: Map<any, Set<number>>;\nallIDs: Set<number>;\n- indexSelS: Map<any, Subscription<Edit, Set<number>>>;\n- indexSelP: Map<any, Subscription<Edit, Set<number>>>;\n- indexSelO: Map<any, Subscription<Edit, Set<number>>>;\n-\nstreamAll: Stream<Set<number>>;\nstreamS: Stream<Edit>;\nstreamP: Stream<Edit>;\n@@ -44,22 +40,22 @@ export class FactGraph {\nlet p = this.indexP.get(f[1]);\nlet o = this.indexO.get(f[2]);\nif (this.findInIndices(s, p, o, f) !== -1) return this;\n- s || (s = new Set<number>());\n- p || (p = new Set<number>());\n- o || (o = new Set<number>());\nconst id = FactGraph.NEXT_ID++;\n+ const is = s || new Set<number>();\n+ const ip = p || new Set<number>();\n+ const io = o || new Set<number>();\nthis.facts[id] = f;\n- s.add(id);\n- p.add(id);\n- o.add(id);\n+ is.add(id);\n+ ip.add(id);\n+ io.add(id);\nthis.allIDs.add(id);\n- this.indexS.set(f[0], s);\n- this.indexP.set(f[1], p);\n- this.indexO.set(f[2], o);\n+ !s && this.indexS.set(f[0], is);\n+ !p && this.indexP.set(f[1], ip);\n+ !o && this.indexO.set(f[2], io);\nthis.streamAll.next(this.allIDs);\n- this.streamS.next({ op: EditOp.ADD, key: f[0], id });\n- this.streamP.next({ op: EditOp.ADD, key: f[1], id });\n- this.streamO.next({ op: EditOp.ADD, key: f[2], id });\n+ this.streamS.next({ index: is, key: f[0] });\n+ this.streamP.next({ index: ip, key: f[1] });\n+ this.streamO.next({ index: io, key: f[2] });\nreturn this;\n}\n@@ -86,12 +82,17 @@ export class FactGraph {\n}\n)\n});\n- for (let id = this.facts.length - 1; id >= 0; id--) {\n- const f = this.facts[id];\n- qs.next(s != null ? { op: EditOp.ADD, key: f[0], id } : this.allIDs);\n- qp.next(p != null ? { op: EditOp.ADD, key: f[1], id } : this.allIDs);\n- qo.next(o != null ? { op: EditOp.ADD, key: f[2], id } : this.allIDs);\n+ const submit = (index: Map<any, Set<number>>, stream: Subscription<any, Set<number>>, key: any) => {\n+ if (key != null) {\n+ const ids = index.get(key);\n+ ids && stream.next({ index: ids, key: s });\n+ } else {\n+ stream.next(this.allIDs);\n}\n+ };\n+ submit(this.indexS, qs, s);\n+ submit(this.indexP, qp, p);\n+ submit(this.indexO, qo, o);\nreturn results.subscribe(trace(`${id}: `));\n}\n@@ -112,28 +113,18 @@ export class FactGraph {\n}\n}\n-export function indexSel(key: any): Transducer<Edit, Set<number>> {\n- return (rfn: Reducer<any, Set<number>>) => {\n+export const indexSel = (key: any): Transducer<Edit, Set<number>> =>\n+ (rfn: Reducer<any, Set<number>>) => {\nconst r = rfn[2];\n- const sel = new Set<number>();\nreturn compR(rfn,\n(acc, e) => {\n- if (key == null || equiv(e.key, key)) {\n- switch (e.op) {\n- case EditOp.ADD:\n- sel.add(e.id);\n- return r(acc, sel);\n- case EditOp.DELETE:\n- sel.delete(e.id);\n- case EditOp.UPDATE:\n- return r(acc, sel);\n- default:\n- }\n+ if (equiv(e.key, key)) {\n+ return r(acc, e.index);\n}\nreturn acc;\n- });\n- };\n}\n+ );\n+ };\nexport const g = new FactGraph();\ng.addFact([\"mia\", \"loves\", \"toxi\"]);\n",
"new_path": "packages/rstream-query/src/graph.ts",
"old_path": "packages/rstream-query/src/graph.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
refactor(rstream-query): simplify query handling, optimize addFact()
| 1
|
refactor
|
rstream-query
|
679,913
|
23.04.2018 15:30:43
| -3,600
|
16fabb8ceda653d04b34a339ed869b005521853d
|
refactor(rstream-query): simplify addQuery()
|
[
{
"change_type": "MODIFY",
"diff": "import { equiv } from \"@thi.ng/api/equiv\";\n-// import { SortedMap } from \"@thi.ng/associative/sorted-map\";\nimport { intersection } from \"@thi.ng/associative/intersection\";\nimport { Stream, trace, Subscription, sync } from \"@thi.ng/rstream\";\nimport { Transducer, Reducer } from \"@thi.ng/transducers/api\";\n@@ -60,15 +59,9 @@ export class FactGraph {\n}\naddQuery(id: string, [s, p, o]: Pattern) {\n- const qs: Subscription<any, Set<number>> = s != null ?\n- this.streamS.transform(indexSel(s), \"s\") :\n- this.streamAll.subscribe(null, \"s\");\n- const qp: Subscription<any, Set<number>> = p != null ?\n- this.streamP.transform(indexSel(p), \"p\") :\n- this.streamAll.subscribe(null, \"p\");\n- const qo: Subscription<any, Set<number>> = o != null ?\n- this.streamO.transform(indexSel(o), \"o\") :\n- this.streamAll.subscribe(null, \"o\");\n+ const qs: Subscription<any, Set<number>> = this.getIndexSelection(this.streamS, s, \"s\");\n+ const qp: Subscription<any, Set<number>> = this.getIndexSelection(this.streamP, p, \"p\");\n+ const qo: Subscription<any, Set<number>> = this.getIndexSelection(this.streamO, o, \"o\");\nconst results = sync<Set<number>, Set<Fact>>({\nid,\nsrc: [qs, qp, qo],\n@@ -111,6 +104,12 @@ export class FactGraph {\n}\nreturn -1;\n}\n+\n+ protected getIndexSelection(stream: Stream<Edit>, key: any, id: string): Subscription<any, Set<number>> {\n+ return key != null ?\n+ stream.transform(indexSel(key), id) :\n+ this.streamAll.subscribe(null, id);\n+ }\n}\nexport const indexSel = (key: any): Transducer<Edit, Set<number>> =>\n",
"new_path": "packages/rstream-query/src/graph.ts",
"old_path": "packages/rstream-query/src/graph.ts"
}
] |
TypeScript
|
Apache License 2.0
|
thi-ng/umbrella
|
refactor(rstream-query): simplify addQuery()
| 1
|
refactor
|
rstream-query
|
791,834
|
23.04.2018 16:24:49
| 25,200
|
16419e7ac8ac6606005e0657a79631d042fd6faf
|
core(tsc): gather type-checking cleanup
|
[
{
"change_type": "MODIFY",
"diff": "@@ -18,15 +18,13 @@ const compressionTypes = ['gzip', 'br', 'deflate'];\nconst binaryMimeTypes = ['image', 'audio', 'video'];\nconst CHROME_EXTENSION_PROTOCOL = 'chrome-extension:';\n-/** @typedef {{requestId: string, url: string, mimeType: string, transferSize: number, resourceSize: number, gzipSize: number}} ResponseInfo */\n-\nclass ResponseCompression extends Gatherer {\n/**\n* @param {Array<LH.WebInspector.NetworkRequest>} networkRecords\n- * @return {Array<ResponseInfo>}\n+ * @return {LH.Artifacts['ResponseCompression']}\n*/\nstatic filterUnoptimizedResponses(networkRecords) {\n- /** @type {Array<ResponseInfo>} */\n+ /** @type {LH.Artifacts['ResponseCompression']} */\nconst unoptimizedResponses = [];\nnetworkRecords.forEach(record => {\n@@ -66,6 +64,7 @@ class ResponseCompression extends Gatherer {\n/**\n* @param {LH.Gatherer.PassContext} passContext\n* @param {LH.Gatherer.LoadData} loadData\n+ * @return {Promise<LH.Artifacts['ResponseCompression']>}\n*/\nafterPass(passContext, loadData) {\nconst networkRecords = loadData.networkRecords;\n",
"new_path": "lighthouse-core/gather/gatherers/dobetterweb/response-compression.js",
"old_path": "lighthouse-core/gather/gatherers/dobetterweb/response-compression.js"
},
{
"change_type": "MODIFY",
"diff": "* Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n*/\n-// @ts-nocheck\n/**\n* @fileoverview Gathers all images used on the page with their src, size,\n* and attribute information. Executes script in the context of the page.\nconst Gatherer = require('./gatherer');\nconst DOMHelpers = require('../../lib/dom-helpers.js');\n+const Driver = require('../driver.js'); // eslint-disable-line no-unused-vars\n/* global window, getElementsInDocument, Image */\n+/** @typedef {MakeOptional<LH.Artifacts.SingleImageUsage, 'networkRecord'>} ImageSizeInfo */\n+\n+/** @return {Array<ImageSizeInfo>} */\n/* istanbul ignore next */\nfunction collectImageElementInfo() {\n+ /** @param {Element} element */\nfunction getClientRect(element) {\nconst clientRect = element.getBoundingClientRect();\nreturn {\n@@ -28,9 +32,14 @@ function collectImageElementInfo() {\n};\n}\n+ /** @type {Array<Element>} */\n+ // @ts-ignore - added by getElementsInDocumentFnString\nconst allElements = getElementsInDocument();\n- const allImageElements = allElements.filter(element => element.localName === 'img');\n+ const allImageElements = /** @type {Array<HTMLImageElement>} */ (allElements.filter(element => {\n+ return element.localName === 'img';\n+ }));\n+ /** @type {Array<ImageSizeInfo>} */\nconst htmlImages = allImageElements.map(element => {\nconst computedStyle = window.getComputedStyle(element);\nreturn {\n@@ -59,12 +68,13 @@ function collectImageElementInfo() {\nconst cssImages = allElements.reduce((images, element) => {\nconst style = window.getComputedStyle(element);\n- if (!CSS_URL_REGEX.test(style.backgroundImage) ||\n- !CSS_SIZE_REGEX.test(style.backgroundSize)) {\n+ if (!style.backgroundImage || !CSS_URL_REGEX.test(style.backgroundImage) ||\n+ !style.backgroundSize || !CSS_SIZE_REGEX.test(style.backgroundSize)) {\nreturn images;\n}\nconst imageMatch = style.backgroundImage.match(CSS_URL_REGEX);\n+ // @ts-ignore test() above ensures that there is a match.\nconst url = imageMatch[1];\n// Heuristic to filter out sprite sheets\n@@ -87,11 +97,15 @@ function collectImageElementInfo() {\n});\nreturn images;\n- }, []);\n+ }, /** @type {Array<ImageSizeInfo>} */ ([]));\nreturn htmlImages.concat(cssImages);\n}\n+/**\n+ * @param {string} url\n+ * @return {Promise<{naturalWidth: number, naturalHeight: number}>}\n+ */\n/* istanbul ignore next */\nfunction determineNaturalSize(url) {\nreturn new Promise((resolve, reject) => {\n@@ -110,62 +124,69 @@ function determineNaturalSize(url) {\nclass ImageUsage extends Gatherer {\n/**\n- * @param {{src: string}} element\n- * @return {!Promise<!Object>}\n+ * @param {Driver} driver\n+ * @param {ImageSizeInfo} element\n+ * @return {Promise<ImageSizeInfo>}\n*/\n- fetchElementWithSizeInformation(element) {\n+ async fetchElementWithSizeInformation(driver, element) {\nconst url = JSON.stringify(element.src);\n- return this.driver.evaluateAsync(`(${determineNaturalSize.toString()})(${url})`)\n- .then(size => {\n+ try {\n+ /** @type {{naturalWidth: number, naturalHeight: number}} */\n+ const size = await driver.evaluateAsync(`(${determineNaturalSize.toString()})(${url})`);\nreturn Object.assign(element, size);\n- }).catch(_ => {\n+ } catch (_) {\n// determineNaturalSize fails on invalid images, which we treat as non-visible\nreturn Object.assign(element, {naturalWidth: 0, naturalHeight: 0});\n- });\n+ }\n}\n- afterPass(options, traceData) {\n- const driver = this.driver = options.driver;\n- const indexedNetworkRecords = traceData.networkRecords.reduce((map, record) => {\n+ /**\n+ * @param {LH.Gatherer.PassContext} passContext\n+ * @param {LH.Gatherer.LoadData} loadData\n+ * @return {Promise<LH.Artifacts['ImageUsage']>}\n+ */\n+ afterPass(passContext, loadData) {\n+ const driver = passContext.driver;\n+ const indexedNetworkRecords = loadData.networkRecords.reduce((map, record) => {\nif (/^image/.test(record._mimeType) && record.finished) {\nmap[record._url] = {\nurl: record.url,\n- resourceSize: Math.min(record.resourceSize, record.transferSize),\n+ resourceSize: Math.min(record._resourceSize || 0, record.transferSize),\nstartTime: record.startTime,\nendTime: record.endTime,\n- responseReceivedTime: record.responseReceivedTime,\n+ responseReceivedTime: record._responseReceivedTime,\nmimeType: record._mimeType,\n};\n}\nreturn map;\n- }, {});\n+ }, /** @type {Object<string, LH.Artifacts.SingleImageUsage['networkRecord']>} */ ({}));\nconst expression = `(function() {\n${DOMHelpers.getElementsInDocumentFnString}; // define function on page\nreturn (${collectImageElementInfo.toString()})();\n})()`;\n- return driver.evaluateAsync(expression)\n- .then(elements => {\n+ /** @type {Promise<Array<ImageSizeInfo>>} */\n+ const evaluatePromise = driver.evaluateAsync(expression);\n+ return evaluatePromise.then(elements => {\nreturn elements.reduce((promise, element) => {\nreturn promise.then(collector => {\n- // link up the image with its network record\n- element.networkRecord = indexedNetworkRecords[element.src];\n-\n// Images within `picture` behave strangely and natural size information isn't accurate,\n// CSS images have no natural size information at all.\n// Try to get the actual size if we can.\nconst elementPromise = (element.isPicture || element.isCss) && element.networkRecord ?\n- this.fetchElementWithSizeInformation(element) :\n+ this.fetchElementWithSizeInformation(driver, element) :\nPromise.resolve(element);\nreturn elementPromise.then(element => {\n- collector.push(element);\n+ // link up the image with its network record\n+ element.networkRecord = indexedNetworkRecords[element.src];\n+ collector.push(/** @type {LH.Artifacts.SingleImageUsage} */ (element));\nreturn collector;\n});\n});\n- }, Promise.resolve([]));\n+ }, Promise.resolve(/** @type {LH.Artifacts['ImageUsage']} */ ([])));\n});\n}\n}\n",
"new_path": "lighthouse-core/gather/gatherers/image-usage.js",
"old_path": "lighthouse-core/gather/gatherers/image-usage.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -21,7 +21,7 @@ class JsUsage extends Gatherer {\n/**\n* @param {LH.Gatherer.PassContext} passContext\n- * @return {Promise<LH.Artifacts['JsUsageArtifact']>}\n+ * @return {Promise<LH.Artifacts['JsUsage']>}\n*/\nasync afterPass(passContext) {\nconst driver = passContext.driver;\n",
"new_path": "lighthouse-core/gather/gatherers/js-usage.js",
"old_path": "lighthouse-core/gather/gatherers/js-usage.js"
},
{
"change_type": "MODIFY",
"diff": "* Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n*/\n-// @ts-nocheck\n'use strict';\nconst Gatherer = require('./gatherer');\nconst manifestParser = require('../../lib/manifest-parser');\n+const Driver = require('../driver.js'); // eslint-disable-line no-unused-vars\nclass StartUrl extends Gatherer {\n/**\n* Grab the manifest, extract it's start_url, attempt to `fetch()` it while offline\n- * @param {*} options\n- * @return {{statusCode: number, debugString?: string}}\n+ * @param {LH.Gatherer.PassContext} passContext\n+ * @return {Promise<LH.Artifacts['StartUrl']>}\n*/\n- afterPass(options) {\n- const driver = options.driver;\n- return driver.goOnline(options)\n+ afterPass(passContext) {\n+ const driver = passContext.driver;\n+ return driver.goOnline(passContext)\n.then(() => driver.getAppManifest())\n- .then(response => driver.goOffline(options).then(() => response))\n- .then(response => response && manifestParser(response.data, response.url, options.url))\n+ .then(response => driver.goOffline().then(() => response))\n+ .then(response => response && manifestParser(response.data, response.url, passContext.url))\n.then(manifest => {\n- const {isReadFailure, reason, startUrl} = this._readManifestStartUrl(manifest);\n- if (isReadFailure) {\n- return {statusCode: -1, debugString: reason};\n+ const startUrlInfo = this._readManifestStartUrl(manifest);\n+ if (startUrlInfo.isReadFailure) {\n+ return {statusCode: -1, debugString: startUrlInfo.reason};\n}\n- return this._attemptManifestFetch(options.driver, startUrl);\n+ return this._attemptManifestFetch(passContext.driver, startUrlInfo.startUrl);\n}).catch(() => {\nreturn {statusCode: -1, debugString: 'Unable to fetch start URL via service worker'};\n});\n@@ -35,7 +35,7 @@ class StartUrl extends Gatherer {\n/**\n* Read the parsed manifest and return failure reasons or the startUrl\n- * @param {Manifest} manifest\n+ * @param {?{value?: {start_url: {value?: string, debugString?: string}}, debugString?: string}} manifest\n* @return {{isReadFailure: true, reason: string}|{isReadFailure: false, startUrl: string}}\n*/\n_readManifestStartUrl(manifest) {\n@@ -55,15 +55,16 @@ class StartUrl extends Gatherer {\nreturn {isReadFailure: true, reason: manifest.value.start_url.debugString};\n}\n+ // @ts-ignore - TODO(bckenny): should actually be testing value above, not debugString\nreturn {isReadFailure: false, startUrl: manifest.value.start_url.value};\n}\n/**\n* Try to `fetch(start_url)`, return true if fetched by SW\n* Resolves when we have a matched network request\n- * @param {!Driver} driver\n- * @param {!string} startUrl\n- * @return {Promise<{statusCode: ?number, debugString: ?string}>}\n+ * @param {Driver} driver\n+ * @param {string} startUrl\n+ * @return {Promise<{statusCode: number, debugString: string}>}\n*/\n_attemptManifestFetch(driver, startUrl) {\n// Wait up to 3s to get a matched network request from the fetch() to work\n@@ -77,7 +78,9 @@ class StartUrl extends Gatherer {\nconst fetchPromise = new Promise(resolve => {\ndriver.on('Network.responseReceived', onResponseReceived);\n- function onResponseReceived({response}) {\n+ /** @param {LH.Crdp.Network.ResponseReceivedEvent} responseEvent */\n+ function onResponseReceived(responseEvent) {\n+ const {response} = responseEvent;\n// ignore mismatched URLs\nif (response.url !== startUrl) return;\ndriver.off('Network.responseReceived', onResponseReceived);\n",
"new_path": "lighthouse-core/gather/gatherers/start-url.js",
"old_path": "lighthouse-core/gather/gatherers/start-url.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -17,18 +17,22 @@ declare global {\ndevtoolsLogs: {[passName: string]: DevtoolsLog};\nsettings: Config.Settings;\n- // Remaining are provided by gatherers\n+ // Remaining are provided by default gatherers.\n+ /** The results of running the aXe accessibility tests on the page. */\nAccessibility: Artifacts.Accessibility;\n/** Information on all anchors in the page that aren't nofollow or noreferrer. */\nAnchorsWithNoRelNoopener: {href: string; rel: string; target: string}[];\n/** The value of the page's <html> manifest attribute, or null if not defined */\nAppCacheManifest: string | null;\n+ /** Array of all URLs cached in CacheStorage. */\nCacheContents: string[];\n/** Href values of link[rel=canonical] nodes found in HEAD (or null, if no href attribute). */\nCanonical: (string | null)[];\n+ /** Console deprecation and intervention warnings logged by Chrome during page load. */\nChromeConsoleMessages: Crdp.Log.EntryAddedEvent[];\n/** The href and innerText of all non-nofollow anchors in the page. */\nCrawlableLinks: {href: string, text: string}[];\n+ /** CSS coverage information for styles used by page's final state. */\nCSSUsage: {rules: Crdp.CSS.RuleUsage[], stylesheets: Artifacts.CSSStyleSheetInfo[]};\n/** Information on the size of all DOM nodes in the page and the most extreme members. */\nDOMStats: Artifacts.DOMStats;\n@@ -38,31 +42,53 @@ declare global {\nEventListeners: {url: string, type: string, handler?: {description?: string}, objectName: string, line: number, col: number}[];\n/** Information for font faces used in the page. */\nFonts: Artifacts.Font[];\n+ /** Information on poorly sized font usage and the text affected by it. */\nFontSize: Artifacts.FontSize;\n/** The hreflang and href values of all link[rel=alternate] nodes found in HEAD. */\nHreflang: {href: string, hreflang: string}[];\n+ /** The page's document body innerText if loaded with JavaScript disabled. */\nHTMLWithoutJavaScript: {value: string};\n+ /** Whether the page ended up on an HTTPS page after attempting to load the HTTP version. */\nHTTPRedirect: {value: boolean};\n+ /** Information on size and loading for all the images in the page. */\n+ ImageUsage: Artifacts.SingleImageUsage[];\n+ /** Information on JS libraries and versions used by the page. */\nJSLibraries: {name: string, version: string, npmPkgName: string}[];\n- JsUsageArtifact: Crdp.Profiler.ScriptCoverage[];\n+ /** JS coverage information for code used during page load. */\n+ JsUsage: Crdp.Profiler.ScriptCoverage[];\n+ /** Parsed version of the page's Web App Manifest, or null if none found. */\nManifest: ReturnType<typeof parseManifest> | null;\n/** The value of the <meta name=\"description\">'s content attribute, or null. */\nMetaDescription: string|null;\n/** The value of the <meta name=\"robots\">'s content attribute, or null. */\nMetaRobots: string|null;\n+ /** The status code of the attempted load of the page while network access is disabled. */\nOffline: number;\n+ /** Size and compression opportunity information for all the images in the page. */\nOptimizedImages: Artifacts.OptimizedImage[];\n+ /** HTML snippets from any password inputs that prevent pasting. */\nPasswordInputsWithPreventedPaste: {snippet: string}[];\n+ /** Size info of all network records sent without compression and their size after gzipping. */\n+ ResponseCompression: {requestId: string, url: string, mimeType: string, transferSize: number, resourceSize: number, gzipSize: number}[];\n/** Information on fetching and the content of the /robots.txt file. */\nRobotsTxt: {status: number|null, content: string|null};\n+ /** Set of exceptions thrown during page load. */\nRuntimeExceptions: Crdp.Runtime.ExceptionThrownEvent[];\n+ /** The content of all scripts loaded by the page, keyed by networkRecord requestId. */\nScripts: Record<string, string>;\n+ /** Version information for all ServiceWorkers active after the first page load. */\nServiceWorker: {versions: Crdp.ServiceWorker.ServiceWorkerVersion[]};\n+ /** The status of an offline fetch of the page's start_url. -1 and a debugString if missing or there was an error. */\n+ StartUrl: {statusCode: number, debugString?: string};\n/** Information on <script> and <link> tags blocking first paint. */\nTagsBlockingFirstPaint: Artifacts.TagBlockingFirstPaint[];\n+ /** The value of the <meta name=\"theme=color\">'s content attribute, or null. */\nThemeColor: string|null;\n+ /** The URL initially supplied to be loaded and the post-redirects URL that was loaded. */\nURL: {initialUrl: string, finalUrl: string};\n+ /** The value of the <meta name=\"viewport\">'s content attribute, or null. */\nViewport: string|null;\n+ /** The dimensions and devicePixelRatio of the loaded viewport. */\nViewportDimensions: Artifacts.ViewportDimensions;\n/** WebSQL database information for the page or null if none was found. */\nWebSQL: Crdp.Database.Database | null;\n@@ -144,6 +170,31 @@ declare global {\n}\n}\n+ export interface SingleImageUsage {\n+ src: string;\n+ clientWidth: number;\n+ clientHeight: number;\n+ naturalWidth: number;\n+ naturalHeight: number;\n+ isCss: boolean;\n+ isPicture: boolean;\n+ usesObjectFit: boolean;\n+ clientRect: {\n+ top: number;\n+ bottom: number;\n+ left: number;\n+ right: number;\n+ };\n+ networkRecord: {\n+ url: string;\n+ resourceSize: number;\n+ startTime: number;\n+ endTime: number;\n+ responseReceivedTime: number;\n+ mimeType: string;\n+ }\n+ }\n+\nexport interface OptimizedImage {\nisSameOrigin: boolean;\nisBase64DataUri: boolean;\n",
"new_path": "typings/artifacts.d.ts",
"old_path": "typings/artifacts.d.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -15,6 +15,13 @@ declare global {\ncode?: string;\n}\n+ /** Make properties K in T optional. */\n+ type MakeOptional<T, K extends keyof T> = {\n+ [P in Exclude<keyof T, K>]: T[P]\n+ } & {\n+ [P in K]+?: T[P]\n+ }\n+\nmodule LH {\n// re-export useful type modules under global LH module.\nexport import Crdp = _Crdp;\n",
"new_path": "typings/externs.d.ts",
"old_path": "typings/externs.d.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -22,6 +22,7 @@ declare global {\nstartTime: number;\nendTime: number;\n+ _responseReceivedTime: number;\ntransferSize: number;\n_transferSize?: number;\n",
"new_path": "typings/web-inspector.d.ts",
"old_path": "typings/web-inspector.d.ts"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
core(tsc): gather type-checking cleanup (#5019)
| 1
|
core
|
tsc
|
743,913
|
23.04.2018 17:11:21
| 14,400
|
744d29926ab95b879f949aceb9d205c5e49f4c44
|
docs: update api.md
|
[
{
"change_type": "MODIFY",
"diff": "@@ -602,7 +602,7 @@ Should yargs attempt to detect the os' locale? Defaults to `true`.\nTell yargs to parse environment variables matching the given prefix and apply\nthem to argv as though they were command line arguments.\n-Use the \"__\" separator in the environment variable to indicate nested options.\n+Use the \"\\_\\_\" separator in the environment variable to indicate nested options.\n(e.g. prefix_nested__foo => nested.foo)\nIf this method is called with no argument or with an empty string or with `true`,\n",
"new_path": "docs/api.md",
"old_path": "docs/api.md"
}
] |
JavaScript
|
MIT License
|
yargs/yargs
|
docs: update api.md (#1113)
| 1
|
docs
| null |
724,000
|
23.04.2018 18:27:31
| -3,600
|
d27f8b65966b9b8183f1b33a67c0f345cec64220
|
build: 1.0.0-beta.15
|
[
{
"change_type": "MODIFY",
"diff": "{\n\"name\": \"@vue/test-utils\",\n- \"version\": \"1.0.0-beta.14\",\n+ \"version\": \"1.0.0-beta.15\",\n\"description\": \"Utilities for testing Vue components.\",\n\"main\": \"dist/vue-test-utils.js\",\n\"types\": \"types/index.d.ts\",\n",
"new_path": "packages/test-utils/package.json",
"old_path": "packages/test-utils/package.json"
}
] |
JavaScript
|
MIT License
|
vuejs/vue-test-utils
|
build: 1.0.0-beta.15
| 1
|
build
| null |
724,000
|
23.04.2018 18:32:06
| -3,600
|
319ab1b97cad849081db32fdb4c13ed3bcd2c83a
|
chore: bump to 1.0.0-beta.15
|
[
{
"change_type": "MODIFY",
"diff": "],\n\"npmClient\": \"yarn\",\n\"useWorkspaces\": true,\n- \"version\": \"1.0.0-beta.14\"\n+ \"version\": \"1.0.0-beta.15\"\n}\n",
"new_path": "lerna.json",
"old_path": "lerna.json"
},
{
"change_type": "MODIFY",
"diff": "{\n\"name\": \"vue-test-utils\",\n\"private\": true,\n- \"version\": \"1.0.0-beta.14\",\n+ \"version\": \"1.0.0-beta.15\",\n\"workspaces\": [\n\"packages/*\"\n],\n",
"new_path": "package.json",
"old_path": "package.json"
},
{
"change_type": "MODIFY",
"diff": "{\n\"name\": \"@vue/server-test-utils\",\n- \"version\": \"1.0.0-beta.14\",\n+ \"version\": \"1.0.0-beta.15\",\n\"description\": \"Utilities for testing Vue components.\",\n\"main\": \"dist/vue-server-test-utils.js\",\n\"types\": \"types/index.d.ts\",\n},\n\"homepage\": \"https://github.com/vuejs/vue-test-utils#readme\",\n\"dependencies\": {\n- \"@vue/test-utils\": \"^1.0.0-beta.12\",\n- \"cheerio\": \"0.22.0\"\n+ \"@vue/test-utils\": \"1.0.0-beta.15\"\n},\n\"devDependencies\": {\n\"chalk\": \"^2.1.0\",\n\"rollup-plugin-node-resolve\": \"^3.0.3\",\n\"typescript\": \"^2.6.2\"\n},\n- \"dependencies\": {\n- \"@vue/test-utils\": \"1.0.0-beta.14\"\n- },\n\"peerDependencies\": {\n\"vue\": \"2.x\",\n\"vue-server-renderer\": \"2.x\",\n",
"new_path": "packages/server-test-utils/package.json",
"old_path": "packages/server-test-utils/package.json"
}
] |
JavaScript
|
MIT License
|
vuejs/vue-test-utils
|
chore: bump to 1.0.0-beta.15
| 1
|
chore
| null |
217,922
|
23.04.2018 18:47:39
| -7,200
|
3d223dfe0256939c0cf7831d618f5f8a8cdd4318
|
docs: added wiki page for list-details
|
[
{
"change_type": "MODIFY",
"diff": "@@ -14,6 +14,7 @@ Below you'll find a summary of all pages you can find on this wiki.\n* [Lists](/wiki/lists), how to create a list, add items to it.\n* [Favourites](/wiki/favourites), describing how favourite list/workshop system works\n* [Books](/wiki/books), how to link your ingame mastercraft books (and folklore books) to your profile.\n+ * [List details](/wiki/list-details), how to get all the details you need on a list view.\n## Advanced features\n@@ -28,3 +29,6 @@ Each page is shown in english if it doesn't exist in your current language.\n### Requirements\nTo contribute to this wiki, there isn't a lot of requirements, a basic knowledge of Markdown is required, and some rules have to be followed to ensure the format fits this wiki system.\n+\n+[github repository]:https://github.com/supamiu/ffxiv-teamcraft\n+[Discord]:https://discord.gg/r6qxt6P\n",
"new_path": "src/assets/wiki/en/home.md",
"old_path": "src/assets/wiki/en/home.md"
},
{
"change_type": "ADD",
"diff": "+# List Details\n+\n+This page aims to provide some help on how to use a list to get the maximum informations from it, it will cover all of the features available on a list details page,\n+explaining why they are here and how to use them properly\n+\n+## Gathering\n+\n+When filtering (see [Layouts]) for gatherings, you can see items with different icons in the right side of the item row, these icons are:\n+\n+ *  For rocky outcroping.\n+ *  For mineral deposit.\n+ *  For lush vegetation patch.\n+ *  Foor mature tree.\n+\n+### Gathering details\n+\n+When you click on the gathering icon, you can see more details about the item and how to obtain it, let's use this image as example:\n+\n+\n+\n+ 1. This section gives you informations about where to find the item, in which map with coords available. Clicking on the ![]() button will open you a map with a marker on it and aetherytes shown so you can find the item easily.\n+ The last line contains an aetheryte icon and the name of the closest aetheryte so you can easily TP without having to open the map just to see where you should TP.\n+ 2. This section is only here if the node is not a \"standard\" one, meaning that it's a timed one.\n+ 3. This section shows details for timed nodes, giving the slot if it's known and spawn times.\n+\n+\n+### Register alarm for timed nodes\n+\n+If a gatherable item is timed, you'll see a button appear on its row:\n+\n+\n+\n+This button changes color depending on the state of the timer:\n+\n+ * Primary color (orange in default theme) if the node is spawned, the time inside of the button will then become the remaining time before despawn.\n+ * Secondary color (blue in default theme) if the node is about to spawn according to your alarms settings.\n+ * Default color (as it is on screenshot) if the node isn't spawned, the timer shown is the time before spawn.\n+\n+\n+### Navigation Map\n+\n+When you're using zone breakdown (See [Layouts] fore more details), some zone will contain a small map icon ().\n+This icons means that a navigation map is available for this area, the conditions for this map to appear are:\n+\n+ * At least 3 items should be in this zone.\n+ * All of the 3 (or more) items have to have location informations available.\n+\n+This navigation map shows an optimized path for your gatherings, with a detailed step-by-step guide below the map:\n+\n+ \n+ \n+\n+The legend for the map is:\n+\n+ * Red arrows mean that you have to go using a mount.\n+ * Blue arrows mean that you should TP because it's faster.\n+\n+\n+## Trading\n+\n+Item details sometimes have informations about trading, from gils to beast tokens, everything is detailed in a simple way to help you buy items instead of farming if you want to.\n+\n+### Buying from NPC\n+\n+Items sometimes have a gil icon in the right part of the row, meaning that they can be bough to a NPC using gils.\n+\n+As for a lot of details icons, you can click on it to see details about it, this dialog box will then appear:\n+\n+\n+\n+This shows the name of the NPC, the map where he can be found and a map marker in case you want to see the exact position.\n+\n+Some NPCs like Housing NPCs sometimes don't have location informations, the coordinates and the map marker will then be removed from the dialog box.\n+\n+The amount at which you can buy the item is shown in the dialog box to help you see how much it'll cost.\n+\n+### Trading with other currencies\n+\n+Some items cannot be bought using gils, instead you can trade them using spoils, scripts, etc.\n+\n+For these items, the most interesting currency to buy the item is shown (the order being determined in the code with priorities, more details [here](https://github.com/Supamiu/ffxiv-teamcraft/blob/master/src/app/modules/item/item/item.component.ts#L58-L216).\n+\n+As always, clicking on the icon will show you location details and the amount of currencies to use to buy the desired item, with the total needed to buy all you need to reach total needed.\n+\n+\n+## Hunting\n+\n+Some items can be obtained by slaying monsters, you can filter them in [Layouts] using `IS_MONSTER_DROP` filter. They can be recognized by the  icon.\n+\n+### Monsters with location informations\n+\n+When clicking the details icon, you'll see a details dialog box:\n+\n+\n+\n+This dialog box sometimes contains location informations, provided by [xivdb](https://xivdb.com), clicking on the location icon will show you a map with a marker on it tho show you where to find this monster easily.\n+\n+## Crafting\n+\n+When you're in the Precrafts or Items category, items have icons for each job able to craft . Hovering these icons will show you the level required, and the amount of stars if there's some.\n+\n+### See recipe details\n+\n+Each item in the list details has a little icon for recipe details (), it can also show you where this item is used in your list.\n+\n+Example:\n+\n+\n+\n+### Item name color\n+\n+Item names can be colored in different colors, here is the legend for these colors:\n+\n+ * Blue if the item is a recipe and it's ready to be crafted, meaning that you have all ingredients for it.\n+ * Green if the item is finished (you gathered/crafted everything).\n+ * Default one (black or white depending on the theme) if none of the above matches.\n+\n+### Simulator link\n+\n+Clicking on the recipe icon will open a new tab on a crafting simulator (You can choose which simulator in [Settings](/settings) page).\n+\n+## Other\n+\n+### Copy item name for recipe search\n+\n+If you click on an item name inside a list, the name will be copied in your clipboard, this is useful to easily find an item in your recipe book ingame.\n+\n+### Get isearch macro for an item\n+\n+Next to each item, a magnifying glass icon is available as an icon button, clicking on it will copy `/isearch ` and the item name in your clipboard, useful to quickly search for items in your inventory.\n+\n+### Tag an item as working on it\n+\n+Each item has an icon to show that you're working on it (),\n+clicking on it will add your profil picture to the row to say to everybody that you're the one working on it.\n+\n+Once you clicked, you can remove your picture by clicking the remove button next to it to update the list by removing you as the person in charge of this item.\n+\n+\n+[Layouts]:/wiki/layouts\n+\n+---\n+`Written by: Miu Asakura`\n",
"new_path": "src/assets/wiki/en/list-details.md",
"old_path": null
}
] |
TypeScript
|
MIT License
|
ffxiv-teamcraft/ffxiv-teamcraft
|
docs: added wiki page for list-details
| 1
|
docs
| null |
217,922
|
23.04.2018 18:48:43
| -7,200
|
880a3885a56e349d7326f5be9bb9fa871b8a17f5
|
docs: added contributing wiki page
|
[
{
"change_type": "ADD",
"diff": "+# Contributing\n+\n+First of all, come on [Discord] and poke @Miu to tell him that you would like to contribute to the wiki, with the language you want to contribute on.\n+\n+## References\n+\n+ * [Markdown cheat sheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet).\n+ * [Github repository].\n+ * [StackEdit](https://stackedit.io/), in-browser markdown editor.\n+ * [Haroopad](http://pad.haroopress.com/user.html), cross-OS markdown editor.\n+\n+## Guidelines\n+\n+ * Links to internal urls (teamcraft pages) have to be relative from teamcraft's url in order to ensure the navigation is handled properly.\n+ * Example: `https://ffxivteamcraft.com/lists` has to be linked as `/lists`.\n+ * Titles from 1 (`#`) to 3 (`###`) will be shown in the table of contents in right part of the screen.\n+\n+## With github\n+\n+ 1. Create your file in `src/assets/<language code>/`.\n+ * The file has to be named in english, and has to end with `.md`\n+ 2. Write your content inside the file.\n+ 3. Commit your work with a message following this format: `docs: added wiki page for ...`\n+ 4. Create a Pull Request once you have added everything you wanted to add.\n+\n+## Without github\n+\n+ 1. Create a file using one of the editors linked below.\n+ 2. Send me the file on discord.\n+\n+## Credits\n+\n+You can (and probably should) add credits to your wiki page by following this format:\n+\n+```\n+---\n+`Written by: Your Name`\n+```\n+\n+This message has to be placed at the bottom of the document.\n+\n+\n+[Github repository]:https://github.com/supamiu/ffxiv-teamcraft\n+[Discord]:https://discord.gg/r6qxt6P\n+\n+---\n+`Written by: Miu Asakura`\n",
"new_path": "src/assets/wiki/en/contributing.md",
"old_path": null
},
{
"change_type": "MODIFY",
"diff": "@@ -23,8 +23,7 @@ Below you'll find a summary of all pages you can find on this wiki.\n## I want to contribute to the wiki\n-To contribute to this wiki, you can either fork the [github repository] or simply whisp Miu on [Discord] to talk about it.\n-Each page is shown in english if it doesn't exist in your current language.\n+To contribute to this wiki, check [contributing](/wiki/contributing) page.\n### Requirements\n",
"new_path": "src/assets/wiki/en/home.md",
"old_path": "src/assets/wiki/en/home.md"
}
] |
TypeScript
|
MIT License
|
ffxiv-teamcraft/ffxiv-teamcraft
|
docs: added contributing wiki page
| 1
|
docs
| null |
217,922
|
23.04.2018 18:59:07
| -7,200
|
0e33355c4bbc8b1f2d378636ac768a1532fb6670
|
chore: wiki table of contents fix
|
[
{
"change_type": "MODIFY",
"diff": "</mat-list-item>\n<mat-list-item routerLink=\"/wiki\" (click)=\"mobile ? sidenav.close() : null\"\nmatTooltipPosition=\"right\"\n- matTooltip=\"{{'HOME_PAGE.Wiki' | translate}}\"\n+ matTooltip=\"{{'WIKI.Title' | translate}}\"\n[matTooltipDisabled]=\"!settings.compactSidebar\">\n<mat-icon matListIcon>library_books</mat-icon>\n<span matLine *ngIf=\"!settings.compactSidebar\">{{'WIKI.Title' | translate}}</span>\n",
"new_path": "src/app/app.component.html",
"old_path": "src/app/app.component.html"
},
{
"change_type": "MODIFY",
"diff": "@@ -28,7 +28,7 @@ export class WikiComponent implements OnInit {\nprivate readonly reloader$: BehaviorSubject<void> = new BehaviorSubject<void>(null);\n- private readonly tocReloader$: ReplaySubject<void> = new ReplaySubject<void>(1);\n+ private readonly tocReloader$: BehaviorSubject<void> = new BehaviorSubject<void>(null);\npublic markdownContent: Observable<string>;\n@@ -89,7 +89,9 @@ export class WikiComponent implements OnInit {\n})\n.filter(markdown => markdown !== null)\n.do(() => {\n+ setTimeout(() => {\nthis.tocReloader$.next(null);\n+ }, 100);\n});\nthis.tableOfContent =\n",
"new_path": "src/app/pages/wiki/wiki/wiki.component.ts",
"old_path": "src/app/pages/wiki/wiki/wiki.component.ts"
}
] |
TypeScript
|
MIT License
|
ffxiv-teamcraft/ffxiv-teamcraft
|
chore: wiki table of contents fix
| 1
|
chore
| null |
791,676
|
23.04.2018 18:59:23
| -7,200
|
6465d275db5e306065762fda5735156a016ecf6c
|
core(critical-request-chains): exclude preloaded requests from crc
|
[
{
"change_type": "MODIFY",
"diff": "@@ -23,6 +23,12 @@ class CriticalRequestChains extends ComputedArtifact {\n*/\nstatic isCritical(request, mainResource) {\nassert.ok(mainResource, 'mainResource not provided');\n+\n+ // Treat any preloaded resource as non-critical\n+ if (request._isLinkPreload) {\n+ return false;\n+ }\n+\nconst resourceTypeCategory = request._resourceType && request._resourceType._category;\n// Iframes are considered High Priority but they are not render blocking\n",
"new_path": "lighthouse-core/gather/computed/critical-request-chains.js",
"old_path": "lighthouse-core/gather/computed/critical-request-chains.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -355,4 +355,22 @@ describe('CriticalRequestChain gatherer: extractChain function', () => {\n},\n});\n});\n+\n+ it('returns correct data for chain with preload',\n+ () => {\n+ const networkRecords = mockTracingData(\n+ [HIGH, HIGH],\n+ [[0, 1]]\n+ );\n+ networkRecords[1]._isLinkPreload = true;\n+ const mainResource = networkRecords[0];\n+ const criticalChains = CriticalRequestChains.extractChain([networkRecords, mainResource]);\n+ assert.deepEqual(criticalChains, {\n+ 0: {\n+ request: networkRecords[0],\n+ children: {},\n+ },\n+ });\n+ }\n+ );\n});\n",
"new_path": "lighthouse-core/test/gather/computed/critical-request-chains-test.js",
"old_path": "lighthouse-core/test/gather/computed/critical-request-chains-test.js"
},
{
"change_type": "MODIFY",
"diff": "},\n\"critical-request-chains\": {\n\"score\": 0,\n- \"displayValue\": \"13 chains found\",\n+ \"displayValue\": \"12 chains found\",\n\"rawValue\": false,\n\"extendedInfo\": {\n\"value\": {\n\"transferSize\": 12640\n},\n\"children\": {\n- \"75994.2\": {\n- \"request\": {\n- \"url\": \"http://localhost:10200/dobetterweb/dbw_tester.css?delay=2000&async=true\",\n- \"startTime\": 185603.951516,\n- \"endTime\": 185605.956256,\n- \"responseReceivedTime\": 185605.955291,\n- \"transferSize\": 821\n- },\n- \"children\": {}\n- },\n\"75994.3\": {\n\"request\": {\n\"url\": \"http://localhost:10200/dobetterweb/dbw_tester.css?delay=100\",\n\"transferSize\": 12640\n},\n\"children\": {\n- \"75994.2\": {\n- \"request\": {\n- \"url\": \"http://localhost:10200/dobetterweb/dbw_tester.css?delay=2000&async=true\",\n- \"startTime\": 185603.951516,\n- \"endTime\": 185605.956256,\n- \"responseReceivedTime\": 185605.955291,\n- \"transferSize\": 821\n- },\n- \"children\": {}\n- },\n\"75994.3\": {\n\"request\": {\n\"url\": \"http://localhost:10200/dobetterweb/dbw_tester.css?delay=100\",\n}\n},\n\"timing\": {\n- \"total\": 830\n+ \"total\": 1709\n}\n}\n\\ No newline at end of file\n",
"new_path": "lighthouse-core/test/results/sample_v2.json",
"old_path": "lighthouse-core/test/results/sample_v2.json"
}
] |
JavaScript
|
Apache License 2.0
|
googlechrome/lighthouse
|
core(critical-request-chains): exclude preloaded requests from crc (#5011)
| 1
|
core
|
critical-request-chains
|
217,922
|
23.04.2018 19:20:17
| -7,200
|
531d5f90045dced897a3754d0b5f963226d3aae2
|
feat: folklore book now shown (to know which book to buy)
|
[
{
"change_type": "MODIFY",
"diff": "@@ -13,5 +13,5 @@ export const folklores: { [index: number]: number[] } = {\n12702: [14211, 14220, 12836, 12832, 12830, 15631, 14214, 15629, 15630, 15634],\n12703: [15638, 12827, 17580, 16753, 15635, 14218, 12825, 15636],\n17842: [21174, 21175, 20040],\n- 17843: [21178, 20030, 20048, 20018, 20121, 20051, 20024, 20100, 21177]\n+ 17843: [21178, 20030, 20048, 20018, 20121, 20051, 20024, 20100, 21177, 22393]\n};\n",
"new_path": "src/app/core/data/sources/folklores.ts",
"old_path": "src/app/core/data/sources/folklores.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -4,4 +4,5 @@ export interface Fish {\nguide: string;\nicon: number;\nspots: FishingSpot[];\n+ folklore?: number;\n}\n",
"new_path": "src/app/model/garland-tools/fish.ts",
"old_path": "src/app/model/garland-tools/fish.ts"
},
{
"change_type": "MODIFY",
"diff": "@@ -6,4 +6,5 @@ export interface GatheredBy {\nlevel: number;\nnodes: StoredNode[];\nstars_tooltip: string;\n+ folklore?: number;\n}\n",
"new_path": "src/app/model/list/gathered-by.ts",
"old_path": "src/app/model/list/gathered-by.ts"
},
{
"change_type": "MODIFY",
"diff": "matTooltipPosition=\"above\"\nalt=\"{{masterbook.id | itemName | i18n}}\">\n</div>\n+ <div *ngIf=\"folkloreId\" [ngClass]=\"{'masterbook':true, 'compact': settings.compactLists}\">\n+ <img matListAvatar\n+ src=\"https://ffxiv.consolegameswiki.com/mediawiki/images/5/53/Tome_of_ichthyological_folklore_-_coerthas_icon1.png\"\n+ matTooltip=\"{{folkloreId | itemName | i18n}}\"\n+ matTooltipPosition=\"above\"\n+ alt=\"{{folkloreId | itemName | i18n}}\">\n+ </div>\n<div class=\"done\">\n<div class=\"done-first-row\">\n<button mat-icon-button (click)=\"expanded=!expanded\" matTooltipPosition=\"above\"\n",
"new_path": "src/app/modules/item/item/item.component.html",
"old_path": "src/app/modules/item/item/item.component.html"
},
{
"change_type": "MODIFY",
"diff": "@@ -267,6 +267,8 @@ export class ItemComponent extends ComponentWithSubscriptions implements OnInit,\nmasterbooks: CompactMasterbook[] = [];\n+ folkloreId: number;\n+\nisMobile = this.media.asObservable().map(mediaChange => mediaChange.mqAlias === 'xs' || mediaChange.mqAlias === 'sm');\npublic timers: Observable<Timer[]>;\n@@ -510,20 +512,16 @@ export class ItemComponent extends ComponentWithSubscriptions implements OnInit,\nthis.hasBook = false;\nreturn;\n}\n- // If this is a gathering\n+ // If this is a gathering (BTN/MIN)\nif (this.item.gatheredBy !== undefined && this.item.gatheredBy.nodes.length > 0) {\n- // For each node\n- for (const node of this.item.gatheredBy.nodes) {\n// If it has a limit set to legendary\n- if (node.limitType !== undefined) {\nconst folkloreId = Object.keys(folklores).find(id => folklores[id].indexOf(this.item.id) > -1);\nif (folkloreId !== undefined) {\nthis.hasBook = (this.user.masterbooks || []).indexOf(+folkloreId) > -1;\n+ this.folkloreId = +folkloreId;\nreturn;\n}\n}\n- }\n- }\nthis.hasBook = true;\nreturn;\n}\n",
"new_path": "src/app/modules/item/item/item.component.ts",
"old_path": "src/app/modules/item/item/item.component.ts"
}
] |
TypeScript
|
MIT License
|
ffxiv-teamcraft/ffxiv-teamcraft
|
feat: folklore book now shown (to know which book to buy)
| 1
|
feat
| null |
217,922
|
23.04.2018 19:31:55
| -7,200
|
a1aa75336b0461353a597072c36a360df23f3faf
|
chore: remove table of contents in mobile wiki view
|
[
{
"change_type": "MODIFY",
"diff": "<mat-error *ngIf=\"notFoundInCurrentLang && !notFound\">{{'WIKI.Not_found_in_current_lang' | translate}}</mat-error>\n<h1 class=\"page-not-found\" *ngIf=\"notFound\">{{\"WIKI.Not_found\" | translate}}</h1>\n<div class=\"wiki-container\" #markdown>\n- <div markdown class=\"markdown\" (click)=\"interceptLinks($event)\" [data]=\"markdownContent | async\"></div>\n- <div class=\"toc\" *ngIf=\"!notFound\">\n+ <div markdown class=\"markdown\" [class.mobile]=\"isMobile()\" (click)=\"interceptLinks($event)\" [data]=\"markdownContent | async\"></div>\n+ <div class=\"toc\" *ngIf=\"!notFound && !isMobile()\">\n<ul>\n<li *ngFor=\"let row of tableOfContent | async; let i = index\"\n(click)=\"scrollTo(row.element, i)\"\n",
"new_path": "src/app/pages/wiki/wiki/wiki.component.html",
"old_path": "src/app/pages/wiki/wiki/wiki.component.html"
},
{
"change_type": "MODIFY",
"diff": "div.wiki-container {\ndiv.markdown {\nwidth: 70%;\n+ &.mobile{\n+ width: 100%;\n+ }\nimg {\nmax-width: 100%;\n}\n",
"new_path": "src/app/pages/wiki/wiki/wiki.component.scss",
"old_path": "src/app/pages/wiki/wiki/wiki.component.scss"
},
{
"change_type": "MODIFY",
"diff": "@@ -8,6 +8,7 @@ import {ScrollService} from '../services/scroll.service';\nimport {MarkdownSection} from '../markdown-section';\nimport {ScrollSpyInfo, ScrollSpyService} from '../services/scroll-spy.service';\nimport {ReplaySubject} from 'rxjs/ReplaySubject';\n+import {ObservableMedia} from '@angular/flex-layout';\n@Component({\nselector: 'app-wiki',\n@@ -39,7 +40,7 @@ export class WikiComponent implements OnInit {\nprivate activeSectionIndex = new ReplaySubject<number | null>(1);\nconstructor(private translator: TranslateService, private route: ActivatedRoute, private http: HttpClient, private router: Router,\n- private scrollService: ScrollService, private scrollSpyService: ScrollSpyService) {\n+ private scrollService: ScrollService, private scrollSpyService: ScrollSpyService, private media: ObservableMedia) {\ntranslator.onLangChange.subscribe(() => {\nthis.reloader$.next(null);\nthis.tocReloader$.next(null);\n@@ -133,4 +134,8 @@ export class WikiComponent implements OnInit {\n});\n});\n}\n+\n+ isMobile(): boolean {\n+ return this.media.isActive('xs') || this.media.isActive('sm');\n+ }\n}\n",
"new_path": "src/app/pages/wiki/wiki/wiki.component.ts",
"old_path": "src/app/pages/wiki/wiki/wiki.component.ts"
}
] |
TypeScript
|
MIT License
|
ffxiv-teamcraft/ffxiv-teamcraft
|
chore: remove table of contents in mobile wiki view
| 1
|
chore
| null |
217,935
|
23.04.2018 19:35:16
| -3,600
|
57374cf0f189243e8c0c2ff3a0306f944d346f7e
|
docs: updated video, line breaks, new image.
|
[
{
"change_type": "MODIFY",
"diff": "# Layouts Guide\n-### Video\n-\n-\n+\n+___\n### What are Layouts?\nLayouts allow you to customize how the recipe is displayed to you, i.e: Gathering, Other, Crafted. Using Layouts, you will be able to generate more filters to customize your experience to your liking.\nLayouts work by panels that work through trickle-down, this means that the top panel applies the filter, passing the remaining items down to the next filter, this continues, until all filters have been run, any remaining items will fall into the **Other** filter, which is the catch-all.\n+___\n## Layout Functions\n* **Area Breakdown** - Shows area/s of gatherable items.\n* **Display Crafting Tiers** - Breaks down crafting panel to show tiers of crafting, showing pre-crafts and final crafting steps.\n* **Hide when Empty** - Will hide the panel when all items in this panel have been gathered/crafted.\n* **Not** - Selecting this will apply a filter that causes current panel to ignore items that the filter is set to.\n>*i.e*: **IS_GATHERED_BY_FSH** will cause all fish to not appear in this panel, even if **IS_GATHERING** is set.\n-\n+___\n## Creating/Changing a Layout\n1. Load up any list you have created.\n-2. Look for this icon  in the top left of the screen.\n+2. Look for this icon  in the top left of the screen.\n3. At the top of the new window, there are 2 input areas, these are **Layout** & **Layout Name**\n> **Layout** is your currently selected Layout and **Layout name** is the box that allows you to name the current layout.\n4. Once you have named your layout, its time to start adding some panels.\n-\n+___\n## Adding a Panel\n1. Use the **Add Panel** button to create a new filter.\n2. Replace the *New Filter* with your own Filter name.\n@@ -32,13 +32,13 @@ Layouts work by panels that work through trickle-down, this means that the top p\n4. Use the white arrow keys to move the new panel up until you have it set to the priority you require.\n5. Continue to create and move panels to create your ideal layout.\n6. Once all panels have been created and moved, simply press **Save**.\n-\n+___\n## Import / Export\n* As well as being able to save layouts to your profile, you are able to share your profiles with others, this is where the import/export function comes in handy.\n* **Export** - Pressing **Export** will generate a block of text, sharing this *code* will allow others to import your layouts to use.\n* **Import** - Simply copy the *code* given to you into a box and press **Import**\n-\n+___\n## Switching between saved Layouts\n1. Open up your layouts.\n",
"new_path": "src/assets/wiki/en/layouts.md",
"old_path": "src/assets/wiki/en/layouts.md"
}
] |
TypeScript
|
MIT License
|
ffxiv-teamcraft/ffxiv-teamcraft
|
docs: updated video, line breaks, new image.
| 1
|
docs
| null |
807,911
|
23.04.2018 19:54:40
| 14,400
|
2838260b7d0058249b2f0aee61e41d7de6bbe228
|
feat(filters): Add `--include-filtered-dependents` flag
|
[
{
"change_type": "MODIFY",
"diff": "@@ -60,6 +60,11 @@ exports[`LsCommand with --include-filtered-dependencies should list packages, in\n@test/package-1 v1.0.0\"\n`;\n+exports[`LsCommand with --include-filtered-dependents should list packages, including filtered ones 1`] = `\n+\"@test/package-1 v1.0.0\n+@test/package-2 v1.0.0\"\n+`;\n+\nexports[`LsCommand with --json should list packages as json objects 1`] = `\nArray [\nObject {\n",
"new_path": "commands/list/__tests__/__snapshots__/list-command.test.js.snap",
"old_path": "commands/list/__tests__/__snapshots__/list-command.test.js.snap"
},
{
"change_type": "MODIFY",
"diff": "@@ -50,6 +50,14 @@ describe(\"LsCommand\", () => {\n});\n});\n+ describe(\"with --include-filtered-dependents\", () => {\n+ it(\"should list packages, including filtered ones\", async () => {\n+ const testDir = await initFixture(\"include-filtered-dependencies\");\n+ await lernaLs(testDir)(\"--scope\", \"@test/package-1\", \"--include-filtered-dependents\");\n+ expect(consoleOutput()).toMatchSnapshot();\n+ });\n+ });\n+\ndescribe(\"with an undefined version\", () => {\nit(\"should list packages\", async () => {\nconst testDir = await initFixture(\"undefined-version\");\n",
"new_path": "commands/list/__tests__/list-command.test.js",
"old_path": "commands/list/__tests__/list-command.test.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -223,6 +223,12 @@ class Command {\n});\n}\n+ if (this.options.includeFilteredDependents) {\n+ chain = chain.then(() => {\n+ this.filteredPackages = this.packageGraph.addDependents(this.filteredPackages);\n+ });\n+ }\n+\nif (this.options.includeFilteredDependencies) {\nchain = chain.then(() => {\nthis.filteredPackages = this.packageGraph.addDependencies(this.filteredPackages);\n",
"new_path": "core/command/index.js",
"old_path": "core/command/index.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -27,6 +27,13 @@ function filterOptions(yargs) {\n`,\ntype: \"string\",\n},\n+ \"include-filtered-dependents\": {\n+ describe: dedent`\n+ Include all transitive dependents when running a command,\n+ regardless of --include, --exclude or --since.\n+ `,\n+ boolean: true,\n+ },\n\"include-filtered-dependencies\": {\ndescribe: dedent`\nInclude all transitive dependencies when running a command,\n",
"new_path": "core/filter-options/index.js",
"old_path": "core/filter-options/index.js"
},
{
"change_type": "MODIFY",
"diff": "@@ -107,8 +107,33 @@ class PackageGraph extends Map {\n* @return {Array.<Package>} The packages with any dependencies that weren't already included.\n*/\naddDependencies(filteredPackages) {\n+ return this.extendList(filteredPackages, \"localDependencies\");\n+ }\n+\n+ /**\n+ * Takes a list of Packages and returns a list of those same Packages with any Packages\n+ * that depend on them. i.e if packageC depended on packageD `graph.addDependents([packageD])`\n+ * would return [packageD, packageC].\n+ *\n+ * @param {!Array.<Package>} filteredPackages The packages to include dependents for.\n+ * @return {Array.<Package>} The packages with any dependents that weren't already included.\n+ */\n+ addDependents(filteredPackages) {\n+ return this.extendList(filteredPackages, \"localDependents\");\n+ }\n+\n+ /**\n+ * Extends a list of packages by traversing on a given property, which must refer to a\n+ * `PackageGraphNode` property that is a collection of `PackageGraphNode`s\n+ *\n+ * @param {!Array.<Package>} packageList The list of packages to extend\n+ * @param {!String} nodeProp The property on `PackageGraphNode` used to traverse\n+ * @return {Array.<Package>} The packages with any additional packages found by traversing\n+ * nodeProp\n+ */\n+ extendList(packageList, nodeProp) {\n// the current list of packages we are expanding using breadth-first-search\n- const search = new Set(filteredPackages.map(({ name }) => this.get(name)));\n+ const search = new Set(packageList.map(({ name }) => this.get(name)));\n// an intermediate list of matched PackageGraphNodes\nconst result = [];\n@@ -117,7 +142,7 @@ class PackageGraph extends Map {\n// anything searched for is always a result\nresult.push(currentNode);\n- currentNode.localDependencies.forEach((meta, depName) => {\n+ currentNode[nodeProp].forEach((meta, depName) => {\nconst depNode = this.get(depName);\nif (depNode !== currentNode && !search.has(depNode)) {\n",
"new_path": "core/package-graph/index.js",
"old_path": "core/package-graph/index.js"
}
] |
JavaScript
|
MIT License
|
lerna/lerna
|
feat(filters): Add `--include-filtered-dependents` flag (#1393)
| 1
|
feat
|
filters
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.