MCPcopy Create free account
hub / github.com/callstack/linaria / createCacheFor

Function createCacheFor

packages/testkit/src/babel.test.ts:3279–3316  ·  view source on GitHub ↗
(
      filename: string,
      exports: Record<string, string>
    )

Source from the content-addressed store, hash-verified

3277 });
3278
3279 const createCacheFor = async (
3280 filename: string,
3281 exports: Record<string, string>
3282 ) => {
3283 const fooContent = readFileSync(filename, 'utf-8');
3284 const cache = new TransformCacheCollection();
3285 cache.invalidateIfChanged(filename, fooContent);
3286
3287 const only = Object.keys(exports);
3288 const exportsProxy = Entrypoint.createExports(logger);
3289 only.forEach((key) => {
3290 exportsProxy[key] = exports[key];
3291 });
3292
3293 const cachedEntrypoint: IEvaluatedEntrypoint = {
3294 dependencies: new Map(),
3295 evaluated: true,
3296 evaluatedOnly: only,
3297 generation: 1,
3298 exports: exportsProxy,
3299 hasTransformResult: false,
3300 hasWywMetadata: false,
3301 ignored: false,
3302 invalidationDependencies: new Map(),
3303 invalidateOnDependencyChange: new Set(),
3304 log: logger,
3305 name: filename,
3306 only,
3307 parents: [],
3308 preevalResult: null,
3309 seqId: -1,
3310 transformResultCode: null,
3311 };
3312
3313 cache.add('entrypoints', filename, cachedEntrypoint);
3314
3315 return cache;
3316 };
3317
3318 it('should use cached value', async () => {
3319 const filename = require.resolve(

Callers 1

babel.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…