@certd/plugin-cert 1.21.2 → 1.22.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/access/eab-access.d.ts +4 -0
  3. package/dist/access/eab-access.js +46 -0
  4. package/dist/access/index.d.ts +1 -0
  5. package/dist/access/index.js +2 -0
  6. package/dist/bundle.js +1 -1
  7. package/dist/d/plugin/cert-plugin/acme.d.ts +0 -2
  8. package/dist/d/plugin/cert-plugin/index.d.ts +0 -1
  9. package/dist/dns-provider/api.d.ts +27 -0
  10. package/dist/dns-provider/api.js +2 -0
  11. package/dist/dns-provider/base.d.ts +8 -0
  12. package/dist/dns-provider/base.js +7 -0
  13. package/dist/dns-provider/decorator.d.ts +3 -0
  14. package/dist/dns-provider/decorator.js +26 -0
  15. package/dist/dns-provider/index.d.ts +4 -0
  16. package/dist/dns-provider/index.js +5 -0
  17. package/dist/dns-provider/registry.d.ts +2 -0
  18. package/dist/dns-provider/registry.js +3 -0
  19. package/dist/index.d.ts +3 -0
  20. package/dist/index.js +4 -0
  21. package/dist/plugin/cert-plugin/acme.d.ts +54 -0
  22. package/dist/plugin/cert-plugin/acme.js +203 -0
  23. package/dist/plugin/cert-plugin/base.d.ts +49 -0
  24. package/dist/plugin/cert-plugin/base.js +259 -0
  25. package/dist/plugin/cert-plugin/cert-reader.d.ts +16 -0
  26. package/dist/plugin/cert-plugin/cert-reader.js +45 -0
  27. package/dist/plugin/cert-plugin/index.d.ts +16 -0
  28. package/dist/plugin/cert-plugin/index.js +171 -0
  29. package/dist/plugin/cert-plugin/lego.d.ts +16 -0
  30. package/dist/plugin/cert-plugin/lego.js +153 -0
  31. package/dist/plugin/index.d.ts +2 -0
  32. package/dist/plugin/index.js +3 -0
  33. package/dist/plugin-cert.mjs +11786 -0
  34. package/dist/plugin-cert.umd.js +28 -0
  35. package/fix-esm-import-paths.js +96 -0
  36. package/package.json +10 -10
  37. package/rollup.config.js +1 -1
  38. package/stats.html +6177 -0
  39. package/test/user.secret.js +7 -0
  40. package/test/user.secret.ts +4 -0
  41. package/tsconfig.json +33 -10
  42. package/tsconfig.tsbuildinfo +1 -0
  43. package/vite.config.ts +1 -1
@@ -0,0 +1,96 @@
1
+ import * as fs from "fs";
2
+ import * as path from "path";
3
+
4
+ // https://gist.github.com/lovasoa/8691344
5
+ async function* walk(dir) {
6
+ for await (const d of await fs.promises.opendir(dir)) {
7
+ const entry = path.join(dir, d.name);
8
+ if (d.isDirectory()) {
9
+ yield* walk(entry);
10
+ } else if (d.isFile()) {
11
+ yield entry;
12
+ }
13
+ }
14
+ }
15
+
16
+ function resolveImportPath(sourceFile, importPath, options) {
17
+ const sourceFileAbs = path.resolve(process.cwd(), sourceFile);
18
+ const root = path.dirname(sourceFileAbs);
19
+ const { moduleFilter = defaultModuleFilter } = options;
20
+
21
+ if (moduleFilter(importPath)) {
22
+ const importPathAbs = path.resolve(root, importPath);
23
+ let possiblePath = [path.resolve(importPathAbs, "./index.ts"), path.resolve(importPathAbs, "./index.js"), importPathAbs + ".ts", importPathAbs + ".js"];
24
+
25
+ if (possiblePath.length) {
26
+ for (let i = 0; i < possiblePath.length; i++) {
27
+ let entry = possiblePath[i];
28
+ if (fs.existsSync(entry)) {
29
+ const resolved = path.relative(root, entry.replace(/\.ts$/, ".js"));
30
+
31
+ if (!resolved.startsWith(".")) {
32
+ return "./" + resolved;
33
+ }
34
+
35
+ return resolved;
36
+ }
37
+ }
38
+ }
39
+ }
40
+
41
+ return null;
42
+ }
43
+
44
+ function replace(filePath, outFilePath, options) {
45
+ const code = fs.readFileSync(filePath).toString();
46
+ const newCode = code.replace(/(import|export) (.+?) from ('[^\n']+'|"[^\n"]+");/gs, function (found, action, imported, from) {
47
+ const importPath = from.slice(1, -1);
48
+ let resolvedPath = resolveImportPath(filePath, importPath, options);
49
+
50
+ if (resolvedPath) {
51
+ resolvedPath = resolvedPath.replaceAll("\\", "/");
52
+ console.log("\t", importPath, resolvedPath);
53
+ return `${action} ${imported} from "${resolvedPath}";`;
54
+ }
55
+
56
+ return found;
57
+ });
58
+
59
+ if (code !== newCode) {
60
+ fs.writeFileSync(outFilePath, newCode);
61
+ }
62
+ }
63
+
64
+ // Then, use it with a simple async for loop
65
+ async function run(srcDir, options = defaultOptions) {
66
+ const { sourceFileFilter = defaultSourceFileFilter } = options;
67
+
68
+ for await (const entry of walk(srcDir)) {
69
+ if (sourceFileFilter(entry)) {
70
+ console.log(entry);
71
+ replace(entry, entry, options);
72
+ }
73
+ }
74
+ }
75
+
76
+ const defaultSourceFileFilter = function (sourceFilePath) {
77
+ return /\.(js|ts)$/.test(sourceFilePath) && !/node_modules/.test(sourceFilePath);
78
+ };
79
+
80
+ const defaultModuleFilter = function (importedModule) {
81
+ return !path.isAbsolute(importedModule) && !importedModule.startsWith("@") && !importedModule.endsWith(".js");
82
+ };
83
+
84
+ const defaultOptions = {
85
+ sourceFileFilter: defaultSourceFileFilter,
86
+ moduleFilter: defaultModuleFilter,
87
+ };
88
+
89
+ // Switch this to test on one file or directly run on a directory.
90
+ const DEBUG = false;
91
+
92
+ if (DEBUG) {
93
+ replace("./src/index.ts", "./out.ts", defaultOptions);
94
+ } else {
95
+ await run("./src/", defaultOptions);
96
+ }
package/package.json CHANGED
@@ -1,19 +1,20 @@
1
1
  {
2
2
  "name": "@certd/plugin-cert",
3
3
  "private": false,
4
- "version": "1.21.2",
5
- "main": "./dist/bundle.js",
6
- "module": "./dist/bundle.mjs",
7
- "types": "./dist/d/index.d.ts",
4
+ "version": "1.22.1",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
8
  "scripts": {
9
9
  "dev": "vite",
10
- "build": "rollup -c",
10
+ "build": "tsc --skipLibCheck",
11
+ "build3": "rollup -c",
11
12
  "build2": "vue-tsc --noEmit && vite build",
12
13
  "preview": "vite preview"
13
14
  },
14
15
  "dependencies": {
15
- "@certd/acme-client": "^1.21.2",
16
- "@certd/pipeline": "^1.21.2",
16
+ "@certd/acme-client": "^1.22.1",
17
+ "@certd/pipeline": "^1.22.1",
17
18
  "jszip": "^3.10.1",
18
19
  "node-forge": "^0.10.0",
19
20
  "psl": "^1.9.0"
@@ -28,7 +29,6 @@
28
29
  "@rollup/plugin-terser": "^0.4.3",
29
30
  "@rollup/plugin-typescript": "^11.0.0",
30
31
  "@types/chai": "^4.3.3",
31
- "@types/lodash": "^4.14.186",
32
32
  "@types/mocha": "^10.0.0",
33
33
  "@types/node-forge": "^1.3.0",
34
34
  "@types/psl": "^1.1.3",
@@ -41,7 +41,7 @@
41
41
  "eslint-plugin-import": "^2.26.0",
42
42
  "eslint-plugin-node": "^11.1.0",
43
43
  "eslint-plugin-prettier": "^4.2.1",
44
- "lodash": "^4.17.21",
44
+ "lodash-es": "^4.17.21",
45
45
  "log4js": "^6.7.1",
46
46
  "mocha": "^10.1.0",
47
47
  "prettier": "^2.8.8",
@@ -53,5 +53,5 @@
53
53
  "vite": "^3.1.0",
54
54
  "vue-tsc": "^0.38.9"
55
55
  },
56
- "gitHead": "031df8fc35f60650d509b448efe1124e06ac7553"
56
+ "gitHead": "d8b3d7a6e05a01904fa49830ec376d2ed9c1ad36"
57
57
  }
package/rollup.config.js CHANGED
@@ -28,7 +28,7 @@ module.exports = {
28
28
  ],
29
29
  external: [
30
30
  "vue",
31
- "lodash",
31
+ "lodash-es",
32
32
  "dayjs",
33
33
  "@certd/acme-client",
34
34
  "@certd/pipeline",