@compiiile/compiiile 2.14.3 → 2.16.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.
@@ -0,0 +1,23 @@
1
+ /* eslint-disable */
2
+ // @ts-nocheck
3
+ // Generated by unplugin-vue-components
4
+ // Read more: https://github.com/vuejs/core/pull/3399
5
+ export {}
6
+
7
+ /* prettier-ignore */
8
+ declare module 'vue' {
9
+ export interface GlobalComponents {
10
+ ClientScript: typeof import('./src/components/ClientScript.vue')['default']
11
+ ContentWrapper: typeof import('./src/components/ContentWrapper.vue')['default']
12
+ FilesTree: typeof import('./src/components/layout/navBar/FilesTree.vue')['default']
13
+ HamburgerButton: typeof import('./src/components/layout/HamburgerButton.vue')['default']
14
+ NavBar: typeof import('./src/components/layout/navBar/NavBar.vue')['default']
15
+ NavListItem: typeof import('./src/components/layout/navBar/NavListItem.vue')['default']
16
+ SearchBar: typeof import('./src/components/searchBar/SearchBar.vue')['default']
17
+ SearchResult: typeof import('./src/components/searchBar/SearchResult.vue')['default']
18
+ SlidesContent: typeof import('./src/components/SlidesContent.vue')['default']
19
+ TableOfContent: typeof import('./src/components/TableOfContent.vue')['default']
20
+ ThemeSwitcher: typeof import('./src/components/layout/ThemeSwitcher.vue')['default']
21
+ TopBar: typeof import('./src/components/layout/TopBar.vue')['default']
22
+ }
23
+ }
@@ -14,6 +14,14 @@
14
14
  console.log(this.$context)
15
15
  console.groupEnd()
16
16
  }
17
+
18
+ const activeLink = document.querySelector(".nav-list-item .link-active")
19
+ const nav = document.querySelector("body > .page > nav")
20
+
21
+ const activeLinkTop = activeLink?.getBoundingClientRect()?.y
22
+ if (activeLink && nav && activeLinkTop > window.innerHeight) {
23
+ nav.scrollTop = activeLinkTop - window.innerHeight + nav.offsetTop
24
+ }
17
25
  },
18
26
  methods: {
19
27
  async onScroll() {
@@ -6,7 +6,7 @@ import SlidesLayout from "../layouts/SlidesLayout.astro"
6
6
  import path from "node:path"
7
7
 
8
8
  export async function getStaticPaths() {
9
- const markdownFiles = await Astro.glob('@source/**/*.{md,mdx}')
9
+ const markdownFiles = Object.values(import.meta.glob('@source/**/*.{md,mdx}', { eager: true }))
10
10
 
11
11
  return routeList.map(route => {
12
12
  const md = markdownFiles.find(post => {
@@ -22,6 +22,8 @@
22
22
  --table-even-lines-background-color: #232329;
23
23
  --pre-background-color: var(--darker-background-color);
24
24
  --pre-color: #d2d7e0;
25
+ --astro-code-background: var(--darker-background-color);
26
+ --astro-code-foreground: var(--pre-color);
25
27
  --highlight-color: #9985fe;
26
28
  --slides-controls: #eeaa6f;
27
29
  /* ----------------------- */
@@ -72,11 +72,11 @@ Strikethrough uses two tildes. ~~Scratch this.~~
72
72
  To have a line break without a paragraph, you will need to use two trailing spaces.
73
73
  Note that this line is separate, but within the same paragraph.
74
74
 
75
- - Unordered list can use asterisks
75
+ - Unordered list can use asterisks
76
76
 
77
- * Or minuses
77
+ * Or minuses
78
78
 
79
- - Or pluses
79
+ - Or pluses
80
80
  ```
81
81
 
82
82
  1. First ordered list item
@@ -91,11 +91,11 @@ Strikethrough uses two tildes. ~~Scratch this.~~
91
91
  To have a line break without a paragraph, you will need to use two trailing spaces.
92
92
  Note that this line is separate, but within the same paragraph.
93
93
 
94
- - Unordered list can use asterisks
94
+ - Unordered list can use asterisks
95
95
 
96
- * Or minuses
96
+ * Or minuses
97
97
 
98
- - Or pluses
98
+ - Or pluses
99
99
 
100
100
  ## Links
101
101
 
@@ -211,12 +211,12 @@ Quote break.
211
211
  ## Checkboxes
212
212
 
213
213
  ```md
214
- - [ ] a todo item
215
- - [x] I've done this one
214
+ - [ ] a todo item
215
+ - [x] I've done this one
216
216
  ```
217
217
 
218
- - [ ] a todo item
219
- - [x] I've done this one
218
+ - [ ] a todo item
219
+ - [x] I've done this one
220
220
 
221
221
  ## Inline HTML
222
222
 
@@ -10,9 +10,9 @@ asSlides: true
10
10
 
11
11
  ## It can contain some lists
12
12
 
13
- - My first list item
14
- - A second list item
15
- - [Some link](https://github.com/AlbanCrepel/compiiile)
13
+ - My first list item
14
+ - A second list item
15
+ - [Some link](https://github.com/AlbanCrepel/compiiile)
16
16
 
17
17
  ---
18
18
 
@@ -35,9 +35,9 @@ npm install @compiiile/compiiile-pro # install as a project dependency with npm
35
35
 
36
36
  Once installed, 3 commands are available that act the same as the usual `compiiile` command:
37
37
 
38
- - `compiiile-pro dev`
39
- - `compiiile-pro build`
40
- - `compiiile-pro preview`
38
+ - `compiiile-pro dev`
39
+ - `compiiile-pro build`
40
+ - `compiiile-pro preview`
41
41
 
42
42
  ## License
43
43
 
@@ -98,12 +98,12 @@ You can become an affiliate and earn 20% on each sale by referring new customers
98
98
 
99
99
  Here is a list of features that the pro version adds:
100
100
 
101
- - add a button to copy code blocks and be able to specify the code block file name
102
- - add admonitions (or alerts) with different semantic colors
103
- - use any [Phosphor Icon](https://phosphoricons.com/) in your Markdown files or Vue components
104
- - add [MermaidJs](https://mermaid.js.org/#/) integration to write diagrams in Markdown, without compromising on style
105
- - add [Markmap](https://markmap.js.org/) integration to write mindmaps in Markdown from bullet-points lists
106
- - add [d2](https://d2lang.com/) integration to write diagrams
107
- - use ready-to-use components (for slides layouts, etc) in `mdx` files
101
+ - add a button to copy code blocks and be able to specify the code block file name
102
+ - add admonitions (or alerts) with different semantic colors
103
+ - use any [Phosphor Icon](https://phosphoricons.com/) in your Markdown files or Vue components
104
+ - add [MermaidJs](https://mermaid.js.org/#/) integration to write diagrams in Markdown, without compromising on style
105
+ - add [Markmap](https://markmap.js.org/) integration to write mindmaps in Markdown from bullet-points lists
106
+ - add [d2](https://d2lang.com/) integration to write diagrams
107
+ - use ready-to-use components (for slides layouts, etc) in `mdx` files
108
108
 
109
109
  See an overview of these features in the next page.
@@ -538,18 +538,18 @@ The `CGrid` component allows you to use a grid layout (very useful for slides):
538
538
  </CGrid>
539
539
  ```
540
540
 
541
- - The `template` prop works just like the `grid-template-columns` CSS property, you can omit the `fr` unit, it will be processed automatically.
542
- - `template="1 1"` will make 2 columns of equal width
543
- - `template="2 1"` will make 2 columns with the first one using 2/3 width
544
- - You can vertically align items with the `align` prop, working like the `align-items` CSS property.
545
- - You can specify the gap between components with the `gap` prop (defaults to `40px`)
541
+ - The `template` prop works just like the `grid-template-columns` CSS property, you can omit the `fr` unit, it will be processed automatically.
542
+ - `template="1 1"` will make 2 columns of equal width
543
+ - `template="2 1"` will make 2 columns with the first one using 2/3 width
544
+ - You can vertically align items with the `align` prop, working like the `align-items` CSS property.
545
+ - You can specify the gap between components with the `gap` prop (defaults to `40px`)
546
546
 
547
547
  ### CCard
548
548
 
549
549
  The `CCard` component can be used as a traditional card or a link.
550
550
 
551
- - The `title` and `description` slots can be used for traditional cards
552
- - To get it to work as a link, just provide a Markdown link as default slot, and specify a hint text if needed with the `hintText` prop
551
+ - The `title` and `description` slots can be used for traditional cards
552
+ - To get it to work as a link, just provide a Markdown link as default slot, and specify a hint text if needed with the `hintText` prop
553
553
 
554
554
  <CGrid gap="20px" template="1 1">
555
555
  <CCard hintText="Go to the specific page">
package/6-deploy.mdx ADDED
@@ -0,0 +1,42 @@
1
+ ---
2
+ title: "Deploy"
3
+ description: "Deploy a Compiiile project and self-host or put it online via a provider like Vercel, making your knowledge-base accessible on the web."
4
+ ---
5
+
6
+ # Deploy Compiiile :rocket:
7
+
8
+ You own your Markdown files, so unlike a proprietary solution, you can deploy Compiiile and make your knowledge-base accessible on the web freely.
9
+
10
+ Let's suppose you have a folder containing a bunch Markdown files, with sub-folders, without any config file (no `package.json` whatsoever).
11
+ It's a breeze to deploy it, so let's dive into it!
12
+
13
+ ## Self-host your knowledge-base :hammer:
14
+
15
+ ### Using Docker
16
+
17
+ A [ready-to-use Docker file is available on the repo](https://github.com/compiiile/compiiile/blob/master/Dockerfile) and you can
18
+ follow the [instructions on the README to build the files](./README.md#using-docker).
19
+
20
+ ### Build static files
21
+
22
+ Assuming you have Compiiile installed globally (`npm install -g @compiiile/compiiile`), you can run the `build` command with parameters on-the-fly to generate static files.
23
+
24
+ ```bash
25
+ compiiile build --title="Hello world!"
26
+ ```
27
+
28
+ You'll have all your static files generated in the `.compiiile/dist` folder, ready to be served on your server!
29
+
30
+ ## Deploy your Markdown files on Vercel :globe_with_meridians:
31
+
32
+ In your project's `Settings` tab, put these settings:
33
+ - Framework preset: `Other`
34
+ - Build command: `compiiile build --title="Hello world!"`
35
+ - Output directory: `.compiiile/dist`
36
+ - Install command: `npm install @compiiile/compiiile`
37
+
38
+ Wait... is this it? Well, yeah, it's as simple as that! Everytime you make a new deployment (via a push to the `main` branch of your repo or via the Vercel CLI),
39
+ you'll get your knowledge-base updated. Once again, without even config files! Isn't it beautiful? :open_mouth:
40
+
41
+ > [!TIP]
42
+ > Of course, something similar can be done using `Netlify`, `GitHub pages`, or whatever you use.
package/CHANGELOG.md CHANGED
@@ -6,20 +6,20 @@ v2 now uses Astro under the hood !
6
6
 
7
7
  **:fire: New features**:
8
8
 
9
- - :tada: Added MDX support
10
- - :zap: Added Hot Reload support
9
+ - :tada: Added MDX support
10
+ - :zap: Added Hot Reload support
11
11
 
12
12
  **:wrench: Fix**:
13
13
 
14
- - No more Markdown markup on search results
14
+ - No more Markdown markup on search results
15
15
 
16
16
  **:warning: Breaking changes**:
17
17
 
18
- - Config file should now use ESM syntax:
19
- The file should use `export default {}` instead of `module.exports = {}`
20
- - No more route hash:
21
- What was before `https://compiiile.me/#/c/markdown-preview` is now `https://compiiile.me/c/markdown-preview`
22
- - No more dynamic section hash on page scroll
23
- - Images size use a new syntax:
24
- The new syntax must be in the image's `alt` attribute, preceded by a `pipe`: `![Alt text|100px](imageUrl)` (the value can be in `px` or `%` and represents the image's width).
25
- If no margin must be applied, a special attribute can be added like so: `![Alt text|100px;no-margin](imageUrl)`
18
+ - Config file should now use ESM syntax:
19
+ The file should use `export default {}` instead of `module.exports = {}`
20
+ - No more route hash:
21
+ What was before `https://compiiile.me/#/c/markdown-preview` is now `https://compiiile.me/c/markdown-preview`
22
+ - No more dynamic section hash on page scroll
23
+ - Images size use a new syntax:
24
+ The new syntax must be in the image's `alt` attribute, preceded by a `pipe`: `![Alt text|100px](imageUrl)` (the value can be in `px` or `%` and represents the image's width).
25
+ If no margin must be applied, a special attribute can be added like so: `![Alt text|100px;no-margin](imageUrl)`
package/CONTRIBUTING.md CHANGED
@@ -10,8 +10,8 @@ Whether, we will always aim to keep the code base and features simple.
10
10
 
11
11
  Here is the current roadmap and feature ideas for incoming releases:
12
12
 
13
- - [ ] being able to resize the navbar
14
- - [ ] tag files with frontmatter and search files having specific tags
13
+ - [ ] being able to resize the navbar
14
+ - [ ] tag files with frontmatter and search files having specific tags
15
15
 
16
16
  If a fix needs to be done or your contributing idea is part of this roadmap, it will most likely be taken into account.
17
17
 
@@ -21,8 +21,8 @@ People should also understand that I am not working full-time on this project an
21
21
 
22
22
  You can launch a local version of the project by cloning the repository, installing the dependencies (with `yarn install`, and use these 3 commands):
23
23
 
24
- - `yarn dev`
25
- - `yarn build`
26
- - `yarn preview`
24
+ - `yarn dev`
25
+ - `yarn build`
26
+ - `yarn preview`
27
27
 
28
28
  Your code should also comply with the project's code style by running `yarn lint` and `yarn format`.
package/README.md CHANGED
@@ -20,26 +20,26 @@ That's what Compiiile does. And it does it hassle-free !
20
20
 
21
21
  ## Features
22
22
 
23
- - [x] 📦 **No config required, everything just works out of the box, without changing your files** (resolves images and
24
- relative links (cross-references), print-ready rendering, :sunny: light and :first_quarter_moon_with_face: dark themes)
25
- - [x] 🌱 Available everywhere with static files deployment: just host it somewhere and access it in any browser on your
26
- computer, phone or whatever you are using
27
- - [x] :link: Quick access to your files via the navbar and links to the previous and next file (with table of content
28
- generation)
29
- - [x] :tv: Display some files as slides
30
- - [x] :mag: **Full-text quick search with content preview**
31
- - [x] :zap: Hot-reload content preview as you edit it
32
- - [x] :tada: Supports MDX files: add your own components to your documentation
33
- - [x] :bulb: Can serve as knowledge base, and handles symlinks to reuse content
34
- - [x] :wrench: Customizable by env variables or config file, it's up to you
35
- - [x] :star2: You get it, it simply does the job, period.
23
+ - [x] 📦 **No config required, everything just works out of the box, without changing your files** (resolves images and
24
+ relative links (cross-references), print-ready rendering, :sunny: light and :first_quarter_moon_with_face: dark themes)
25
+ - [x] 🌱 Available everywhere with static files deployment: just host it somewhere and access it in any browser on your
26
+ computer, phone or whatever you are using
27
+ - [x] :link: Quick access to your files via the navbar and links to the previous and next file (with table of content
28
+ generation)
29
+ - [x] :tv: Display some files as slides
30
+ - [x] :mag: **Full-text quick search with content preview**
31
+ - [x] :zap: Hot-reload content preview as you edit it
32
+ - [x] :tada: Supports MDX files: add your own components to your documentation
33
+ - [x] :bulb: Can serve as knowledge base, and handles symlinks to reuse content
34
+ - [x] :wrench: Customizable by env variables or config file, it's up to you
35
+ - [x] :star2: You get it, it simply does the job, period.
36
36
 
37
37
  ### What Compiiile isn't
38
38
 
39
- - It's not a markdown editor, there are already plenty available, just choose the one that works best for you, even the
40
- simplest text editor will do.
41
- - It's not like VuePress, VitePress, Docusaurus or Notion. Compiiile's goal is to stay simple and stupidly easy without
42
- any configuration.
39
+ - It's not a markdown editor, there are already plenty available, just choose the one that works best for you, even the
40
+ simplest text editor will do.
41
+ - It's not like VuePress, VitePress, Docusaurus or Notion. Compiiile's goal is to stay simple and stupidly easy without
42
+ any configuration.
43
43
 
44
44
  > The goal is to help people rely purely on a **language** (_markdown_), not on _any_ platform.
45
45
 
@@ -112,9 +112,9 @@ Et voilà, you should be able to preview your files in your browser :tada:.
112
112
 
113
113
  Once installed, 3 commands are available to see your beautiful markdown files :eyes::
114
114
 
115
- - `compiiile dev`: creates a web server to check your markdown files (alias to only `compiiile`)
116
- - `compiiile build`: builds all the files for you to serve them production-ready
117
- - `compiiile preview`: preview your production-ready build
115
+ - `compiiile dev`: creates a web server to check your markdown files (alias to only `compiiile`)
116
+ - `compiiile build`: builds all the files for you to serve them production-ready
117
+ - `compiiile preview`: preview your production-ready build
118
118
 
119
119
  You can run the command you want in your terminal while being in the desired folder.
120
120
 
@@ -178,13 +178,13 @@ like: `https://compiiile.me/s/slides-preview?print-pdf`.
178
178
 
179
179
  Other frontmatter keys are handled:
180
180
 
181
- - `title`: set the title to be displayed in the navbar and for SEO
182
- - `description`: set the description for SEO
183
- - `textAlign`: possible values
184
- are [CSS text-align values](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align) (`left`, `center`, ...). This
185
- changes the default text alignment in slides. The default value is `center`.
186
- - `ignore` : Boolean value (`true` or `false`) to ignore the current file and exclude it from Compiiile (the file is not ignored by default).
187
- - `hidden` : Boolean value (`true` or `false`) to hide the file from the navbar and siblings links (the file is not hidden by default).
181
+ - `title`: set the title to be displayed in the navbar and for SEO
182
+ - `description`: set the description for SEO
183
+ - `textAlign`: possible values
184
+ are [CSS text-align values](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align) (`left`, `center`, ...). This
185
+ changes the default text alignment in slides. The default value is `center`.
186
+ - `ignore` : Boolean value (`true` or `false`) to ignore the current file and exclude it from Compiiile (the file is not ignored by default).
187
+ - `hidden` : Boolean value (`true` or `false`) to hide the file from the navbar and siblings links (the file is not hidden by default).
188
188
 
189
189
  > :bulb: You can override slides theme by passing it to a `theme` query parameter in your slide url (for example `/s/slides?theme=light`). See the `theme` config parameter below for valid values.
190
190
 
@@ -197,7 +197,7 @@ The home page of Compiiile (`/`) points to a `README.md` file located at the roo
197
197
  Here is the list of parameters that you can set to customize Compiiile (none are required):
198
198
 
199
199
  | Parameter | Type | Description |
200
- | ---------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------- |
200
+ |------------------------|------------|----------------------------------------------------------------------------------------------------------------------|
201
201
  | `title` | `string` | The title to display on the top-left of the User Interface |
202
202
  | `description` | `string` | The description that is rendered by default for the SEO |
203
203
  | `logo` | `string` | The relative path of the logo to display in the TopBar and as favicon |
@@ -211,6 +211,7 @@ Here is the list of parameters that you can set to customize Compiiile (none are
211
211
  | `noIndex` | `Boolean` | If set to `true`, the `robots.txt` file will disallow all routes, preventing indexation. Defaults to `false` |
212
212
  | `publicDir` | `string` | The folder name in which you can serve public files, defaults to `public` |
213
213
  | `vite.server.fs.allow` | `string[]` | Add local paths to vite's server fs allow list |
214
+ | `printReady` | `Boolean` | Add a `/print` page to display a full ready-to-print content (uses `@compiiile/compiiile-print`) |
214
215
 
215
216
  You can use these parameters in 2 ways:
216
217
 
@@ -338,15 +339,15 @@ you can simply put these 2 lines in your `.compiiileignore`:
338
339
 
339
340
  ## Common issues
340
341
 
341
- - Make sure that the absolute path to the folder where you are running Compiiile doesn't contain any special character
342
- as it could prevent the project initialization.
342
+ - Make sure that the absolute path to the folder where you are running Compiiile doesn't contain any special character
343
+ as it could prevent the project initialization.
343
344
 
344
345
  ## Special thanks
345
346
 
346
- - [Astro](https://github.com/withastro/astro) for enabling us developers to make lightweight websites
347
- - [fzf-for-js](https://github.com/ajitid/fzf-for-js) for the search feature
348
- - [reveal.js](https://revealjs.com/) for displaying markdown files as slides
349
- - [Vite](https://vitejs.dev/) for helping modern frontend developers keep their mental health sane :heart:
347
+ - [Astro](https://github.com/withastro/astro) for enabling us developers to make lightweight websites
348
+ - [fzf-for-js](https://github.com/ajitid/fzf-for-js) for the search feature
349
+ - [reveal.js](https://revealjs.com/) for displaying markdown files as slides
350
+ - [Vite](https://vitejs.dev/) for helping modern frontend developers keep their mental health sane :heart:
350
351
 
351
352
  ## Contributing
352
353
 
@@ -359,12 +360,12 @@ You can read more about it and the roadmap in the [dedicated contributing guide]
359
360
 
360
361
  You can add features to Compiiile by using the following projects:
361
362
 
362
- - [compiiile-pro](https://compiiile.me/c/3-pro-installation): Enhance your Markdown files, add diagrams, mindmaps, admonitions, and ready-made components
363
- - [compiiile-print](https://github.com/compiiile/compiiile-print): Add a print ready page containing all your Markdown files
363
+ - [compiiile-pro](https://compiiile.me/c/3-pro-installation): Enhance your Markdown files, add diagrams, mindmaps, admonitions, and ready-made components
364
+ - [compiiile-print](https://github.com/compiiile/compiiile-print): Add a print ready page containing all your Markdown files
364
365
 
365
366
  Here is a list of projects related to Compiiile developed by the community:
366
367
 
367
- - [compiiile-actions-cloudflare-pages](https://github.com/marketplace/actions/compiiile-cloudflare-pages): A simple GitHub action to deploy a Compiiile site to CloudFlare pages
368
+ - [compiiile-actions-cloudflare-pages](https://github.com/marketplace/actions/compiiile-cloudflare-pages): A simple GitHub action to deploy a Compiiile site to CloudFlare pages
368
369
 
369
370
  ## Support
370
371
 
package/bin/config.js CHANGED
@@ -7,17 +7,19 @@ import path from "node:path"
7
7
  import { copyFileSync, cpSync, existsSync } from "node:fs"
8
8
  import { fileURLToPath } from "node:url"
9
9
  import markdownConfig from "./vitePluginCompiiile/markdownConfig.js"
10
- import resolvePackagePath from "resolve-package-path"
11
- import requireg from "requireg"
12
10
  import sitemap from "@astrojs/sitemap"
13
11
  import { loadConfig } from "c12"
14
- const source = process.cwd()
15
- process.env.COMPIIILE_SOURCE = source
16
-
17
12
  import yargs from "yargs/yargs"
18
13
  import { hideBin } from "yargs/helpers"
19
14
 
20
- import { readFile } from "fs/promises"
15
+ import { readFile } from "node:fs/promises"
16
+ // Making sure fonts are accessible by vite's server
17
+ import { createRequire } from "node:module"
18
+ import { packageDirectory } from "pkg-dir"
19
+
20
+ const source = process.cwd()
21
+ process.env.COMPIIILE_SOURCE = source
22
+
21
23
  const packageJSON = JSON.parse(await readFile(fileURLToPath(new URL("../package.json", import.meta.url))))
22
24
 
23
25
  /*
@@ -92,6 +94,9 @@ const argv = yargs(hideBin(process.argv))
92
94
  .option("vite.server.fs.allow", {
93
95
  describe: "Add local paths to vite's server fs allow list"
94
96
  })
97
+ .option("printReady", {
98
+ describe: "Add a /print page to display a full ready-to-print content (uses @compiiile/compiiile-print)"
99
+ })
95
100
  .help()
96
101
  .version(packageJSON.version).argv
97
102
 
@@ -150,25 +155,20 @@ if (argv.logo) {
150
155
  }
151
156
  }
152
157
 
153
- // Making sure fonts are accessible by vite's server
154
- import { createRequire } from "node:module"
155
158
  const require = createRequire(import.meta.url)
156
159
  const pathName = require.resolve("@fontsource-variable/archivo")
157
- import { packageDirectory } from "pkg-dir"
160
+
158
161
  const viteServerFsAllowList = [source, fileURLToPath(new URL("../", import.meta.url)), path.resolve(pathName, "../../")]
159
162
  const packageDir = await packageDirectory()
160
163
  if (packageDir) {
161
164
  viteServerFsAllowList.push(packageDir)
162
165
  }
163
166
 
164
- const resolve = (mod) => {
165
- const resolvedModule = requireg.resolve("vue")
166
- const packagePath = resolvePackagePath(mod, resolvedModule)
167
- // Check to work on both Windows (using `\`) and UNIX systems (using `/`)
168
- return packagePath.slice(
169
- 0,
170
- packagePath.lastIndexOf("/") < 0 ? packagePath.lastIndexOf("\\") : packagePath.lastIndexOf("/")
171
- )
167
+ const localIntegrations = []
168
+
169
+ if(/true/i.test(argv.printReady)){
170
+ const compiiilePrintIntegration = (await import("@compiiile/compiiile-print")).default
171
+ localIntegrations.push(compiiilePrintIntegration())
172
172
  }
173
173
 
174
174
  const astroConfig = {
@@ -183,8 +183,38 @@ const astroConfig = {
183
183
  integrations: [
184
184
  vue({ appEntrypoint: "/src/app.js" }),
185
185
  ...(configFromFile.integrations ?? []),
186
+ ...(localIntegrations ?? []),
186
187
  mdx(),
187
- ...(process.env.VITE_COMPIIILE_SITE_URL ? [sitemap()] : [])
188
+ ...(process.env.VITE_COMPIIILE_SITE_URL ? [sitemap()] : []),
189
+ {
190
+ name: "include-dependencies",
191
+ hooks: {
192
+ "astro:build:setup": ({ vite }) => {
193
+ vite.ssr.noExternal.push(
194
+ "kleur",
195
+ "clsx",
196
+ "vue",
197
+ "@vue/compiler-dom",
198
+ "@vue/compiler-core",
199
+ "@vue/shared",
200
+ "@babel/parser",
201
+ "estree-walker",
202
+ "source-map-js",
203
+ "@vue/runtime-dom",
204
+ "@vue/runtime-core",
205
+ "@vue/reactivity",
206
+ "@vue/server-renderer",
207
+ "@vue/compiler-ssr",
208
+ "html-escaper",
209
+ "@oslojs/encoding",
210
+ "cssesc",
211
+ "fzf",
212
+ "@astrojs/internal-helpers",
213
+ "mrmime"
214
+ )
215
+ }
216
+ }
217
+ }
188
218
  ],
189
219
  ...(process.env.VITE_COMPIIILE_SITE_URL ? { site: process.env.VITE_COMPIIILE_SITE_URL } : {}),
190
220
  vite: {
@@ -192,22 +222,7 @@ const astroConfig = {
192
222
  resolve: {
193
223
  preserveSymlinks: true,
194
224
  alias: {
195
- "@source": source,
196
- // Adding aliases for Compiiile's build command to work when installed globally
197
- vue: resolve("vue"),
198
- "@vue/server-renderer": resolve("@vue/server-renderer"),
199
- "@vue/runtime-dom": resolve("@vue/runtime-dom"),
200
- "@vue/runtime-core": resolve("@vue/runtime-core"),
201
- kleur: resolve("kleur"),
202
- clsx: resolve("clsx"),
203
- "html-escaper": resolve("html-escaper"),
204
- ...(process.env.NODE_ENV === NODE_ENV_PRODUCTION ? { cssesc: resolve("cssesc") } : {}), // Not included in dev because of the 'module is not defined' error otherwise
205
- mrmime: resolve("mrmime"),
206
- "@vue/reactivity": resolve("@vue/reactivity"),
207
- "@vue/shared": resolve("@vue/shared"),
208
- fzf: resolve("fzf"),
209
- "@oslojs/encoding": resolve("@oslojs/encoding"),
210
- "@astrojs/internal-helpers": resolve("@astrojs/internal-helpers") + "/dist"
225
+ "@source": source
211
226
  }
212
227
  },
213
228
  server: {
@@ -99,7 +99,7 @@ export default class {
99
99
  if (isFilePathInIgnoredPatterns) {
100
100
  continue
101
101
  }
102
- } catch (e) {
102
+ } catch (_) {
103
103
  // No .compiiileignore file found at the root
104
104
  }
105
105
 
package/build.js CHANGED
@@ -1,16 +1,16 @@
1
1
  import { build } from "vite"
2
2
  import { unlinkSync } from "node:fs"
3
3
 
4
- const jsFileName = "style.es.js"
4
+ const fileName = "style"
5
5
  await build({
6
6
  build: {
7
7
  lib: {
8
8
  entry: new URL("./.compiiile/src/utils/styles.js", import.meta.url).pathname,
9
9
  name: "style",
10
10
  formats: ["es"],
11
- fileName: (_) => jsFileName
11
+ fileName
12
12
  }
13
13
  }
14
14
  })
15
15
 
16
- await unlinkSync(`./dist/${jsFileName}`)
16
+ await unlinkSync(`./dist/${fileName}.js`)