load-populate-files 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +5 -0
- package/dist/index.js +9 -0
- package/dist/lib/loader.d.ts +3 -0
- package/dist/lib/loader.js +7 -0
- package/dist/lib/normalize.d.ts +3 -0
- package/dist/lib/normalize.js +14 -0
- package/dist/lib/types.d.ts +18 -0
- package/dist/lib/types.js +2 -0
- package/package.json +39 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PopulationResponse } from 'populate-files';
|
|
2
|
+
import type { RawOptions, RawParams } from './lib/types.js';
|
|
3
|
+
export type { FileContent, PopulateFileParams } from 'populate-files';
|
|
4
|
+
export declare const loadAndPopulateFiles: (params: RawParams, options?: RawOptions) => Promise<PopulationResponse[]>;
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { populateFiles } from 'populate-files';
|
|
2
|
+
import { loadFile } from './lib/loader.js';
|
|
3
|
+
import { normalizeParams } from './lib/normalize.js';
|
|
4
|
+
export const loadAndPopulateFiles = async (params, options) => {
|
|
5
|
+
const normalized = await normalizeParams(params, options);
|
|
6
|
+
const files = await loadFile(normalized.filePath);
|
|
7
|
+
return populateFiles(files, normalized.options);
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { resolve } from 'node:path';
|
|
2
|
+
import { parseCwd } from 'npm-parse-cwd';
|
|
3
|
+
export const normalizeParams = async (params, options = {}) => {
|
|
4
|
+
const cwd = await parseCwd(options.cwd);
|
|
5
|
+
return {
|
|
6
|
+
filePath: resolve(cwd, params.filePath),
|
|
7
|
+
options: {
|
|
8
|
+
cwd,
|
|
9
|
+
check: options.check,
|
|
10
|
+
dryRun: options.dryRun,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=normalize.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Directory } from 'npm-parse-cwd';
|
|
2
|
+
export interface RawParams {
|
|
3
|
+
filePath: string;
|
|
4
|
+
}
|
|
5
|
+
export interface RawOptions {
|
|
6
|
+
cwd?: Directory;
|
|
7
|
+
check?: boolean | undefined;
|
|
8
|
+
dryRun?: boolean | undefined;
|
|
9
|
+
}
|
|
10
|
+
export interface NormalizedParams {
|
|
11
|
+
filePath: string;
|
|
12
|
+
options: {
|
|
13
|
+
cwd: string;
|
|
14
|
+
check?: boolean | undefined;
|
|
15
|
+
dryRun?: boolean | undefined;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=types.d.ts.map
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "load-populate-files",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Load and dynamically populate file content",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=18"
|
|
7
|
+
},
|
|
8
|
+
"type": "module",
|
|
9
|
+
"author": "jacobley",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"repository": "jacobley/jacobley",
|
|
12
|
+
"homepage": "https://github.com/JacobLey/jacobley/tree/main/apps/populate-files/load-populate-files/nx-tsc#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/jacobley/jacobley/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"content",
|
|
18
|
+
"write",
|
|
19
|
+
"build"
|
|
20
|
+
],
|
|
21
|
+
"sideEffects": false,
|
|
22
|
+
"exports": {
|
|
23
|
+
".": "./dist/index.js"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"npm-parse-cwd": "npm:parse-cwd@^1.0.8",
|
|
27
|
+
"populate-files": "^0.0.1",
|
|
28
|
+
"default-import": "^1.1.5"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/chai": "^4.3.5",
|
|
32
|
+
"@types/mocha": "^10.0.1",
|
|
33
|
+
"@types/node": "^20.4.10",
|
|
34
|
+
"chai": "^4.3.7",
|
|
35
|
+
"mocha": "^10.2.0",
|
|
36
|
+
"nyc": "^15.1.0",
|
|
37
|
+
"typescript": "^5.1.6"
|
|
38
|
+
}
|
|
39
|
+
}
|