@stonecrop/nuxt 0.16.2 → 0.16.3

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/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stonecrop/nuxt",
3
3
  "configKey": "stonecrop",
4
- "version": "0.16.2",
4
+ "version": "0.16.3",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "unknown"
package/dist/module.mjs CHANGED
@@ -1,53 +1,7 @@
1
- import { existsSync, realpathSync } from 'node:fs';
1
+ import { realpathSync, existsSync } from 'node:fs';
2
2
  import { readdir, readFile } from 'node:fs/promises';
3
3
  import { dirname, extname } from 'node:path';
4
- import { createResolver, defineNuxtModule, useLogger, addVitePlugin, addLayout, extendPages, addServerHandler, addComponent, addPlugin, addImportsDir } from '@nuxt/kit';
5
-
6
- function createSymlinkedPackagesPlugin(options) {
7
- const { rootDir, packages, logger } = options;
8
- return {
9
- name: "stonecrop-symlinked-packages",
10
- config() {
11
- const allowPaths = /* @__PURE__ */ new Set();
12
- const nuxtModulePath = `${rootDir}/node_modules/@stonecrop/nuxt`;
13
- try {
14
- if (existsSync(nuxtModulePath)) {
15
- const realNuxtModulePath = realpathSync(nuxtModulePath);
16
- if (realNuxtModulePath !== nuxtModulePath) {
17
- const monorepoRoot = dirname(realNuxtModulePath);
18
- allowPaths.add(monorepoRoot);
19
- logger?.(`@stonecrop/nuxt is symlinked, adding monorepo root: ${monorepoRoot}`);
20
- }
21
- }
22
- } catch (e) {
23
- logger?.(`Error checking @stonecrop/nuxt symlink: ${e instanceof Error ? e.message : String(e)}`);
24
- }
25
- for (const pkg of packages) {
26
- const pkgPath = `${rootDir}/node_modules/${pkg}`;
27
- try {
28
- if (existsSync(pkgPath)) {
29
- const realPath = realpathSync(pkgPath);
30
- if (realPath !== pkgPath) {
31
- allowPaths.add(realPath);
32
- logger?.(`Adding symlinked package to fs.allow: ${realPath}`);
33
- }
34
- }
35
- } catch {
36
- }
37
- }
38
- if (allowPaths.size > 0) {
39
- logger?.(`Vite fs.allow updated with ${allowPaths.size} path(s)`);
40
- return {
41
- server: {
42
- fs: {
43
- allow: [...allowPaths]
44
- }
45
- }
46
- };
47
- }
48
- }
49
- };
50
- }
4
+ import { createResolver, defineNuxtModule, useLogger, resolvePath, addLayout, extendPages, addServerHandler, addComponent, addPlugin, addImportsDir } from '@nuxt/kit';
51
5
 
52
6
  const { resolve } = createResolver(import.meta.url);
53
7
  const STONECROP_PACKAGES = [
@@ -79,6 +33,19 @@ const module$1 = defineNuxtModule({
79
33
  }
80
34
  }
81
35
  logger.log("Added Stonecrop packages to build.transpile for SSR CSS handling");
36
+ nuxt.options.imports = nuxt.options.imports || {};
37
+ nuxt.options.imports.transform = nuxt.options.imports.transform || {};
38
+ nuxt.options.imports.transform.exclude = nuxt.options.imports.transform.exclude || [];
39
+ const escapeRE = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
40
+ for (const pkg of STONECROP_PACKAGES) {
41
+ if (pkg === "@stonecrop/themes") continue;
42
+ try {
43
+ const distDir = dirname(realpathSync(await resolvePath(pkg)));
44
+ nuxt.options.imports.transform.exclude.push(new RegExp(`^${escapeRE(distDir)}`));
45
+ logger.log(`Excluded prebuilt dist from auto-import transform: ${distDir}`);
46
+ } catch {
47
+ }
48
+ }
82
49
  if (options.theme && !nuxt.options.css.includes(options.theme)) {
83
50
  nuxt.options.css.unshift(options.theme);
84
51
  logger.log(`Added Stonecrop theme to app CSS: ${options.theme}`);
@@ -94,12 +61,23 @@ const module$1 = defineNuxtModule({
94
61
  logger.log("Added Stonecrop packages to Nitro externals.inline for CSS bundling");
95
62
  });
96
63
  if (nuxt.options.dev) {
97
- const symlinkedPackagesPlugin = createSymlinkedPackagesPlugin({
98
- rootDir: nuxt.options.rootDir,
99
- packages: STONECROP_PACKAGES,
100
- logger: (msg) => logger.log(msg)
101
- });
102
- addVitePlugin(symlinkedPackagesPlugin);
64
+ const allowPaths = /* @__PURE__ */ new Set();
65
+ for (const pkg of ["@stonecrop/nuxt", ...STONECROP_PACKAGES]) {
66
+ const pkgPath = `${nuxt.options.rootDir}/node_modules/${pkg}`;
67
+ try {
68
+ const realPath = realpathSync(pkgPath);
69
+ if (realPath !== pkgPath) {
70
+ allowPaths.add(pkg === "@stonecrop/nuxt" ? dirname(realPath) : realPath);
71
+ }
72
+ } catch {
73
+ }
74
+ }
75
+ if (allowPaths.size > 0) {
76
+ nuxt.options.vite.server = nuxt.options.vite.server || {};
77
+ nuxt.options.vite.server.fs = nuxt.options.vite.server.fs || {};
78
+ nuxt.options.vite.server.fs.allow = [...nuxt.options.vite.server.fs.allow || [], ...allowPaths];
79
+ logger.log(`Vite fs.allow updated with ${allowPaths.size} symlinked package path(s)`);
80
+ }
103
81
  }
104
82
  const homepage = resolve("runtime/app/layouts/StonecropHome.vue");
105
83
  addLayout(homepage, "home");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stonecrop/nuxt",
3
- "version": "0.16.2",
3
+ "version": "0.16.3",
4
4
  "description": "Nuxt module for Stonecrop",
5
5
  "repository": {
6
6
  "type": "git",
@@ -45,18 +45,18 @@
45
45
  "pathe": "^2.0.3",
46
46
  "pinia": "^3.0.4",
47
47
  "prompts": "^2.4.2",
48
- "@stonecrop/aform": "0.16.2",
49
- "@stonecrop/casl-middleware": "0.16.2",
50
- "@stonecrop/atable": "0.16.2",
51
- "@stonecrop/code-editor": "0.16.2",
52
- "@stonecrop/desktop": "0.16.2",
53
- "@stonecrop/graphql-client": "0.16.2",
54
- "@stonecrop/node-editor": "0.16.2",
55
- "@stonecrop/graphql-middleware": "0.16.2",
56
- "@stonecrop/nuxt-grafserv": "0.16.2",
57
- "@stonecrop/schema": "0.16.2",
58
- "@stonecrop/stonecrop": "0.16.2",
59
- "@stonecrop/themes": "0.16.2"
48
+ "@stonecrop/aform": "0.16.3",
49
+ "@stonecrop/atable": "0.16.3",
50
+ "@stonecrop/casl-middleware": "0.16.3",
51
+ "@stonecrop/code-editor": "0.16.3",
52
+ "@stonecrop/graphql-client": "0.16.3",
53
+ "@stonecrop/desktop": "0.16.3",
54
+ "@stonecrop/node-editor": "0.16.3",
55
+ "@stonecrop/graphql-middleware": "0.16.3",
56
+ "@stonecrop/nuxt-grafserv": "0.16.3",
57
+ "@stonecrop/schema": "0.16.3",
58
+ "@stonecrop/stonecrop": "0.16.3",
59
+ "@stonecrop/themes": "0.16.3"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@eslint/js": "^10.0.1",