docus 1.0.7 → 2.1.0

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 (160) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +9 -24
  3. package/dist/index.cjs +549 -0
  4. package/dist/index.d.ts +25 -0
  5. package/dist/index.mjs +523 -0
  6. package/dist/runtime/app/components/DocusContent.vue +215 -0
  7. package/dist/runtime/app/components/DocusContent.vue.d.ts +25 -0
  8. package/dist/runtime/app/components/Error.vue +19 -0
  9. package/dist/runtime/app/components/Error.vue.d.ts +9 -0
  10. package/dist/runtime/app/components/Markdown.vue +56 -0
  11. package/dist/runtime/app/components/Markdown.vue.d.ts +25 -0
  12. package/dist/runtime/app/components/Page.vue +29 -0
  13. package/dist/runtime/app/components/Page.vue.d.ts +2 -0
  14. package/dist/runtime/app/components/Props.vue +130 -0
  15. package/dist/runtime/app/components/Props.vue.d.ts +80 -0
  16. package/dist/runtime/app/components/prose/ProseA.vue +41 -0
  17. package/dist/runtime/app/components/prose/ProseA.vue.d.ts +23 -0
  18. package/dist/runtime/app/components/prose/ProseBlockquote.vue +5 -0
  19. package/dist/runtime/app/components/prose/ProseCode.vue +5 -0
  20. package/dist/runtime/app/components/prose/ProseCodeInline.vue +5 -0
  21. package/dist/runtime/app/components/prose/ProseEm.vue +5 -0
  22. package/dist/runtime/app/components/prose/ProseH1.vue +3 -0
  23. package/dist/runtime/app/components/prose/ProseH2.vue +3 -0
  24. package/dist/runtime/app/components/prose/ProseH3.vue +3 -0
  25. package/dist/runtime/app/components/prose/ProseH4.vue +3 -0
  26. package/dist/runtime/app/components/prose/ProseH5.vue +3 -0
  27. package/dist/runtime/app/components/prose/ProseH6.vue +3 -0
  28. package/dist/runtime/app/components/prose/ProseHr.vue +3 -0
  29. package/dist/runtime/app/components/prose/ProseImg.vue +32 -0
  30. package/dist/runtime/app/components/prose/ProseImg.vue.d.ts +21 -0
  31. package/dist/runtime/app/components/prose/ProseLi.vue +3 -0
  32. package/dist/runtime/app/components/prose/ProseOl.vue +5 -0
  33. package/dist/runtime/app/components/prose/ProseParagraph.vue +3 -0
  34. package/dist/runtime/app/components/prose/ProseStrong.vue +5 -0
  35. package/dist/runtime/app/components/prose/ProseTable.vue +5 -0
  36. package/dist/runtime/app/components/prose/ProseTbody.vue +5 -0
  37. package/dist/runtime/app/components/prose/ProseTd.vue +5 -0
  38. package/dist/runtime/app/components/prose/ProseTh.vue +5 -0
  39. package/dist/runtime/app/components/prose/ProseThead.vue +5 -0
  40. package/dist/runtime/app/components/prose/ProseTr.vue +5 -0
  41. package/dist/runtime/app/components/prose/ProseUl.vue +5 -0
  42. package/dist/runtime/app/composables/helpers.d.ts +4 -0
  43. package/dist/runtime/app/composables/helpers.js +66 -0
  44. package/dist/runtime/app/composables/helpers.mjs +40 -0
  45. package/dist/runtime/app/composables/index.d.ts +90 -0
  46. package/dist/runtime/app/composables/index.js +108 -0
  47. package/dist/runtime/app/composables/index.mjs +63 -0
  48. package/dist/runtime/app/composables/navigation.d.ts +37 -0
  49. package/dist/runtime/app/composables/navigation.js +227 -0
  50. package/dist/runtime/app/composables/navigation.mjs +148 -0
  51. package/dist/runtime/app/composables/store.d.ts +7 -0
  52. package/dist/runtime/app/composables/store.js +52 -0
  53. package/dist/runtime/app/composables/store.mjs +35 -0
  54. package/dist/runtime/app/composables/style.d.ts +11 -0
  55. package/dist/runtime/app/composables/style.js +117 -0
  56. package/dist/runtime/app/composables/style.mjs +71 -0
  57. package/dist/runtime/app/composables/theme-colors.d.ts +30 -0
  58. package/dist/runtime/app/composables/theme-colors.js +80 -0
  59. package/dist/runtime/app/composables/theme-colors.mjs +48 -0
  60. package/dist/runtime/app/composables/websocket.d.ts +3 -0
  61. package/dist/runtime/app/composables/websocket.js +79 -0
  62. package/dist/runtime/app/composables/websocket.mjs +63 -0
  63. package/dist/runtime/app/layouts/default.vue +5 -0
  64. package/dist/runtime/app/layouts/error.vue +33 -0
  65. package/dist/runtime/app/layouts/error.vue.d.ts +21 -0
  66. package/dist/runtime/app/pages/_.vue +222 -0
  67. package/dist/runtime/app/pages/_.vue.d.ts +2 -0
  68. package/dist/runtime/context.d.ts +1 -0
  69. package/dist/runtime/context.js +17 -0
  70. package/dist/runtime/context.mjs +5 -0
  71. package/dist/runtime/database/Query.d.ts +18 -0
  72. package/dist/runtime/database/Query.js +68 -0
  73. package/dist/runtime/database/Query.mjs +49 -0
  74. package/dist/runtime/database/index.d.ts +4 -0
  75. package/dist/runtime/database/index.js +45 -0
  76. package/dist/runtime/database/index.mjs +25 -0
  77. package/dist/runtime/database/providers/local/Query.d.ts +14 -0
  78. package/dist/runtime/database/providers/local/Query.js +85 -0
  79. package/dist/runtime/database/providers/local/Query.mjs +60 -0
  80. package/dist/runtime/database/providers/local/index.d.ts +3 -0
  81. package/dist/runtime/database/providers/local/index.js +63 -0
  82. package/dist/runtime/database/providers/local/index.mjs +39 -0
  83. package/dist/runtime/database/providers/local/operations.d.ts +2 -0
  84. package/dist/runtime/database/providers/local/operations.js +83 -0
  85. package/dist/runtime/database/providers/local/operations.mjs +53 -0
  86. package/dist/runtime/database/providers/local/utils.d.ts +8 -0
  87. package/dist/runtime/database/providers/local/utils.js +28 -0
  88. package/dist/runtime/database/providers/local/utils.mjs +17 -0
  89. package/dist/runtime/index.d.ts +3 -0
  90. package/dist/runtime/index.js +44 -0
  91. package/dist/runtime/index.mjs +3 -0
  92. package/dist/runtime/navigation.d.ts +4 -0
  93. package/dist/runtime/navigation.js +176 -0
  94. package/dist/runtime/navigation.mjs +137 -0
  95. package/dist/runtime/server/api/get.d.ts +10 -0
  96. package/dist/runtime/server/api/get.js +24 -0
  97. package/dist/runtime/server/api/get.mjs +13 -0
  98. package/dist/runtime/server/api/list.d.ts +9 -0
  99. package/dist/runtime/server/api/list.js +34 -0
  100. package/dist/runtime/server/api/list.mjs +18 -0
  101. package/dist/runtime/server/api/navigation.d.ts +7 -0
  102. package/dist/runtime/server/api/navigation.js +20 -0
  103. package/dist/runtime/server/api/navigation.mjs +10 -0
  104. package/dist/runtime/server/api/preview.d.ts +3 -0
  105. package/dist/runtime/server/api/preview.js +54 -0
  106. package/dist/runtime/server/api/preview.mjs +31 -0
  107. package/dist/runtime/server/api/reload.d.ts +6 -0
  108. package/dist/runtime/server/api/reload.js +27 -0
  109. package/dist/runtime/server/api/reload.mjs +11 -0
  110. package/dist/runtime/server/api/search.d.ts +6 -0
  111. package/dist/runtime/server/api/search.js +27 -0
  112. package/dist/runtime/server/api/search.mjs +13 -0
  113. package/dist/runtime/server/content.d.ts +46 -0
  114. package/dist/runtime/server/content.js +175 -0
  115. package/dist/runtime/server/content.mjs +114 -0
  116. package/dist/runtime/server/socket.d.ts +9 -0
  117. package/dist/runtime/server/socket.js +33 -0
  118. package/dist/runtime/server/socket.mjs +20 -0
  119. package/dist/runtime/server/utils/cache.d.ts +19 -0
  120. package/dist/runtime/server/utils/cache.js +110 -0
  121. package/dist/runtime/server/utils/cache.mjs +75 -0
  122. package/dist/runtime/server/utils/index.d.ts +4 -0
  123. package/dist/runtime/server/utils/index.js +18 -0
  124. package/dist/runtime/server/utils/index.mjs +8 -0
  125. package/dist/runtime/transformers/index.d.ts +1 -0
  126. package/dist/runtime/transformers/index.js +26 -0
  127. package/dist/runtime/transformers/index.mjs +11 -0
  128. package/dist/runtime/transformers/json.d.ts +3 -0
  129. package/dist/runtime/transformers/json.js +15 -0
  130. package/dist/runtime/transformers/json.mjs +5 -0
  131. package/dist/runtime/transformers/markdown/index.d.ts +8 -0
  132. package/dist/runtime/transformers/markdown/index.js +25 -0
  133. package/dist/runtime/transformers/markdown/index.mjs +16 -0
  134. package/dist/runtime/transformers/utils/index.d.ts +1 -0
  135. package/dist/runtime/transformers/utils/index.js +18 -0
  136. package/dist/runtime/transformers/utils/index.mjs +1 -0
  137. package/dist/runtime/transformers/utils/path.d.ts +26 -0
  138. package/dist/runtime/transformers/utils/path.js +88 -0
  139. package/dist/runtime/transformers/utils/path.mjs +56 -0
  140. package/dist/runtime/utils/index.d.ts +1 -0
  141. package/dist/runtime/utils/index.js +18 -0
  142. package/dist/runtime/utils/index.mjs +1 -0
  143. package/dist/runtime/utils/log.d.ts +1 -0
  144. package/dist/runtime/utils/log.js +14 -0
  145. package/dist/runtime/utils/log.mjs +2 -0
  146. package/dist/runtime/utils/object.d.ts +9 -0
  147. package/dist/runtime/utils/object.js +22 -0
  148. package/dist/runtime/utils/object.mjs +4 -0
  149. package/dist/templates/content.mjs +50 -0
  150. package/dist/templates/docus.mjs +13 -0
  151. package/dist/templates/hot.mjs +16 -0
  152. package/dist/templates/i18n.mjs +23 -0
  153. package/dist/templates/options.mjs +46 -0
  154. package/package.json +78 -59
  155. package/shims.d.ts +24 -0
  156. package/types.d.ts +397 -0
  157. package/dist/create-docus/create-docus.js +0 -7
  158. package/dist/create-docus/helpers.js +0 -244
  159. package/dist/create-docus/index.js +0 -87
  160. package/dist/index.js +0 -10
@@ -1,244 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getProjectType = getProjectType;
7
- exports.getTemplate = getTemplate;
8
- exports.createDir = createDir;
9
- exports.getValidPackageName = getValidPackageName;
10
- exports.getTargetDir = getTargetDir;
11
- exports.createProject = createProject;
12
- exports.log = exports.pkgManager = exports.args = exports.cwd = void 0;
13
-
14
- var _package = require("../../package.json");
15
-
16
- var _fs = _interopRequireDefault(require("fs"));
17
-
18
- var _path = _interopRequireDefault(require("path"));
19
-
20
- var _kolorist = require("kolorist");
21
-
22
- var _minimist = _interopRequireDefault(require("minimist"));
23
-
24
- var _prompts = _interopRequireDefault(require("prompts"));
25
-
26
- var _degit = _interopRequireDefault(require("degit"));
27
-
28
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
-
30
- const cwd = process.cwd();
31
- exports.cwd = cwd;
32
- const args = (0, _minimist.default)(process.argv.slice(2));
33
- exports.args = args;
34
- const pkgManager = /pnpm/.test(process.env.npm_execpath || "") || /pnpm/.test(process.env.npm_config_user_agent || "") ? "pnpm" : /yarn/.test(process.env.npm_execpath || "") ? "yarn" : "npm";
35
- exports.pkgManager = pkgManager;
36
- const log = {
37
- space: () => console.log(),
38
- bold: str => (0, _kolorist.bold)(str),
39
- primary: str => (0, _kolorist.green)(str),
40
- secondary: str => (0, _kolorist.dim)(str),
41
- warning: str => (0, _kolorist.yellow)(str),
42
- error: str => (0, _kolorist.red)(str),
43
- broadcast: str => console.log(` ${str}`),
44
- motd: () => {
45
- log.space();
46
- log.broadcast(`${(0, _kolorist.bold)("Docus") + log.secondary(" CLI")} ${log.primary(`v${_package.version}`)}`);
47
- log.space();
48
- }
49
- };
50
- exports.log = log;
51
- const REPOSITORIES = {
52
- website: "git@github.com:docusgen/starter.git",
53
- theme: "git@github.com:docusgen/theme-starter.git",
54
- module: "git@github.com:docusgen/module-starter.git"
55
- };
56
-
57
- function copyDir(srcDir, destDir) {
58
- _fs.default.mkdirSync(destDir, {
59
- recursive: true
60
- });
61
-
62
- for (const file of _fs.default.readdirSync(srcDir)) {
63
- const srcFile = _path.default.resolve(srcDir, file);
64
-
65
- const destFile = _path.default.resolve(destDir, file);
66
-
67
- copy(srcFile, destFile);
68
- }
69
- }
70
-
71
- function emptyDir(dir) {
72
- if (!_fs.default.existsSync(dir)) return;
73
-
74
- for (const file of _fs.default.readdirSync(dir)) {
75
- const abs = _path.default.resolve(dir, file);
76
-
77
- if (_fs.default.lstatSync(abs).isDirectory()) {
78
- emptyDir(abs);
79
-
80
- _fs.default.rmdirSync(abs);
81
- } else {
82
- _fs.default.unlinkSync(abs);
83
- }
84
- }
85
- }
86
-
87
- function copy(src, dest) {
88
- const stat = _fs.default.statSync(src);
89
-
90
- if (stat.isDirectory()) copyDir(src, dest);else _fs.default.copyFileSync(src, dest);
91
- }
92
-
93
- function getProjectType() {
94
- switch (args["type"]) {
95
- case "theme":
96
- return "theme";
97
-
98
- case "module":
99
- return "module";
100
-
101
- default:
102
- return "website";
103
- }
104
- }
105
-
106
- async function getTemplate(projectType) {
107
- const {
108
- broadcast,
109
- primary,
110
- secondary
111
- } = log;
112
-
113
- const templateDir = _path.default.join(__dirname, "./template");
114
-
115
- broadcast([secondary("Cloning the latest"), primary(projectType === "website" ? "Docus" : projectType), secondary("template...")].join(" "));
116
- emptyDir(templateDir);
117
- const projectRepository = REPOSITORIES[projectType];
118
- const repo = (0, _degit.default)(projectRepository, {
119
- force: true,
120
- verbose: true,
121
- mode: "git"
122
- });
123
- await repo.clone(templateDir);
124
- return templateDir;
125
- }
126
-
127
- async function createDir(targetDir) {
128
- const projectPath = _path.default.join(cwd, targetDir);
129
-
130
- const {
131
- broadcast,
132
- warning,
133
- error,
134
- space,
135
- secondary
136
- } = log;
137
-
138
- if (!_fs.default.existsSync(projectPath)) {
139
- _fs.default.mkdirSync(projectPath, {
140
- recursive: true
141
- });
142
- } else {
143
- const existing = _fs.default.readdirSync(projectPath);
144
-
145
- const dir = projectPath.split("/");
146
- const dirName = dir[dir.length - 1];
147
-
148
- if (existing.length) {
149
- space();
150
- broadcast(warning(`Target directory "${dirName}" is not empty.`));
151
- space();
152
- const {
153
- yes
154
- } = await (0, _prompts.default)({
155
- type: "confirm",
156
- name: "yes",
157
- initial: "Y",
158
- message: "Remove existing files and continue?"
159
- });
160
- if (yes) emptyDir(projectPath);else {
161
- space();
162
- broadcast(warning(`Target directory is not empty and you do not want to overwrite it.`));
163
- space();
164
- broadcast(error(`Cancelling project creation.`));
165
- process.exit(1);
166
- }
167
- }
168
- }
169
-
170
- space();
171
- broadcast(secondary("Scaffolding project in ") + targetDir + secondary("..."));
172
- return projectPath;
173
- }
174
-
175
- async function getValidPackageName(projectName) {
176
- projectName = _path.default.basename(projectName);
177
- const packageNameRegExp = /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/;
178
-
179
- if (packageNameRegExp.test(projectName)) {
180
- return projectName;
181
- } else {
182
- const suggestedPackageName = projectName.trim().toLowerCase().replace(/\s+/g, "-").replace(/^[._]/, "").replace(/[^a-z0-9-~]+/g, "-");
183
- const {
184
- inputPackageName
185
- } = await (0, _prompts.default)({
186
- type: "text",
187
- name: "inputPackageName",
188
- message: "Package name:",
189
- initial: suggestedPackageName,
190
- validate: input => packageNameRegExp.test(input) ? true : "Invalid package.json name"
191
- });
192
- return inputPackageName;
193
- }
194
- }
195
-
196
- async function getTargetDir(projectType) {
197
- const {
198
- space,
199
- broadcast,
200
- error,
201
- warning
202
- } = log;
203
- let targetDir = args._[0];
204
-
205
- if (!targetDir) {
206
- const {
207
- projectName
208
- } = await (0, _prompts.default)({
209
- type: "text",
210
- name: "projectName",
211
- message: "Project name:",
212
- initial: `my-${projectType}`
213
- });
214
-
215
- if (!projectName) {
216
- space();
217
- broadcast(warning(`You must specify a project name.`));
218
- space();
219
- broadcast(error(`Cancelling project creation.`));
220
- process.exit(1);
221
- }
222
-
223
- targetDir = projectName.trim();
224
- }
225
-
226
- return targetDir;
227
- }
228
-
229
- function createProject(root, templateDir, packageName) {
230
- const write = (file, content = void 0) => {
231
- const targetPath = _path.default.join(root, file);
232
-
233
- if (content) _fs.default.writeFileSync(targetPath, content);else copy(_path.default.join(templateDir, file), targetPath);
234
- };
235
-
236
- const files = _fs.default.readdirSync(templateDir);
237
-
238
- for (const file of files.filter(f => f !== "package.json")) write(file);
239
-
240
- const pkg = require(_path.default.join(templateDir, "package.json"));
241
-
242
- pkg.name = packageName;
243
- write("package.json", JSON.stringify(pkg, null, 2));
244
- }
@@ -1,87 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createDocus = createDocus;
7
-
8
- var _path = require("path");
9
-
10
- var _prompts = _interopRequireDefault(require("prompts"));
11
-
12
- var _execa = _interopRequireDefault(require("execa"));
13
-
14
- var _helpers = require("./helpers");
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
- const {
19
- motd,
20
- primary,
21
- secondary,
22
- warning,
23
- bold,
24
- space,
25
- broadcast
26
- } = _helpers.log;
27
-
28
- async function createDocus() {
29
- motd();
30
- const projectType = (0, _helpers.getProjectType)();
31
- const targetDir = await (0, _helpers.getTargetDir)(projectType);
32
- const packageName = await (0, _helpers.getValidPackageName)(targetDir);
33
- const projectPath = await (0, _helpers.createDir)(targetDir);
34
- const templateDir = await (0, _helpers.getTemplate)(projectType);
35
- (0, _helpers.createProject)(projectPath, templateDir, packageName);
36
- broadcast(primary("Done."));
37
- space();
38
- const {
39
- yes
40
- } = await (0, _prompts.default)({
41
- type: "confirm",
42
- name: "yes",
43
- initial: "Y",
44
- message: "Install and start it now?"
45
- });
46
- if (yes) await startProject(projectPath);else startItLater(projectPath);
47
- }
48
-
49
- async function startProject(projectPath) {
50
- space();
51
- const {
52
- agent
53
- } = await (0, _prompts.default)({
54
- name: "agent",
55
- type: "select",
56
- message: "Choose the agent",
57
- choices: ["yarn", "npm", "pnpm"].map(i => ({
58
- value: i,
59
- title: i
60
- }))
61
- });
62
-
63
- if (!agent) {
64
- space();
65
- broadcast(warning(`You cancelled the agent selection!`));
66
- return startItLater(projectPath);
67
- }
68
-
69
- await (0, _execa.default)(agent, ["install"], {
70
- stdio: "inherit",
71
- cwd: projectPath
72
- });
73
- await (0, _execa.default)(agent, ["run", "dev"], {
74
- stdio: "inherit",
75
- cwd: projectPath
76
- });
77
- }
78
-
79
- function startItLater(projectPath) {
80
- space();
81
- broadcast(secondary("Start it later with:"));
82
- space();
83
- const dir = (0, _path.relative)(_helpers.cwd, projectPath);
84
- if (projectPath !== _helpers.cwd) broadcast(primary(`cd ${bold(dir)}`));
85
- broadcast(primary(`${_helpers.pkgManager === "yarn" ? "yarn" : `${_helpers.pkgManager} install`}`));
86
- broadcast(primary(`${_helpers.pkgManager === "yarn" ? "yarn dev" : `${_helpers.pkgManager} run dev`}`));
87
- }
package/dist/index.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- module.exports = void 0;
7
-
8
- var _default = () => {};
9
-
10
- module.exports = _default;