-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
410 changed files
with
12,629 additions
and
5,944 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// @ts-check | ||
const {getOptions} = require('loader-utils'); | ||
const {transform} = require('@workday/canvas-kit-styling-transform/testing'); | ||
|
||
/** @typedef {import('webpack').loader.Loader} Loader */ | ||
/** @typedef {import('webpack').loader.LoaderContext} LoaderContext */ | ||
|
||
// Tracks files that have been processed. If a file is already processed, it | ||
// means the file has been updated and we need to update the Typescript program | ||
// so the changes are reflected in our doc output. If we don't update the TS | ||
// program, the docs will be processed with the outdated cache of the file | ||
// contents. | ||
const filesProcessedMap = new Map(); | ||
|
||
/** | ||
* @this {LoaderContext} | ||
* @param {Parameters<Loader>[0]} source | ||
*/ | ||
function styleTransformLoader(source) { | ||
const { | ||
/** @type {any} */ | ||
Doc, | ||
} = getOptions(this); | ||
|
||
if (filesProcessedMap.has(this.resourcePath)) { | ||
Doc.update(); | ||
} | ||
filesProcessedMap.set(this.resourcePath, true); | ||
|
||
return transform(Doc.program, this.resourcePath); | ||
} | ||
|
||
module.exports = styleTransformLoader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.