@eui/cli 22.0.0-alpha.9 → 22.0.0-rc.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 (72) hide show
  1. package/README.md +357 -88
  2. package/bin/eui-cli.js +26 -0
  3. package/bin/scripts/migrate.js +5 -0
  4. package/lib/app-utils/build.js +26 -0
  5. package/lib/app-utils/migrate.js +610 -0
  6. package/lib/app-utils/serve.js +32 -0
  7. package/lib/build.js +28 -7
  8. package/lib/cli.js +16 -2
  9. package/lib/config.js +10 -1
  10. package/lib/skeletons/_angular/base/mock/app/routes/{index.js → index.cjs} +1 -1
  11. package/lib/skeletons/_angular/base/mock/app/routes/{user_routes.js → user_routes.cjs} +1 -1
  12. package/lib/skeletons/_angular/base/mock/{server.js → server.cjs} +1 -1
  13. package/lib/skeletons/_angular/base/package.json +9 -13
  14. package/lib/skeletons/_angular/base/src/app/app-starter.service.ts +10 -1
  15. package/lib/skeletons/_angular/base/src/app/app.component.spec.ts +1 -1
  16. package/lib/skeletons/_angular/base/src/app/features/home/home.component.ts +0 -4
  17. package/lib/skeletons/_angular/base/src/config/global.ts +4 -1
  18. package/lib/skeletons/_angular/base/tsconfig.json +1 -2
  19. package/lib/skeletons/_angular/base-mobile/package.json +6 -19
  20. package/lib/skeletons/_angular/base-mobile/src/app/app-starter.service.ts +10 -1
  21. package/lib/skeletons/_angular/base-mobile/src/app/features/about/opensource-licences/opensource-licences.component.ts +0 -1
  22. package/lib/skeletons/_angular/base-mobile/src/config/global.ts +4 -1
  23. package/lib/skeletons/_angular/options/ecl-ec/angular.json +2 -2
  24. package/lib/skeletons/_angular/options/ecl-ec/src/app/app.component.html +2 -2
  25. package/lib/skeletons/_angular/options/ecl-ec/src/app/app.component.ts +4 -6
  26. package/lib/skeletons/_angular/options/ecl-ec/src/app/features/home/home.component.ts +0 -4
  27. package/lib/skeletons/_angular/options/ecl-ec/src/config/global.ts +4 -1
  28. package/lib/skeletons/_angular/options/ecl-eu/angular.json +2 -2
  29. package/lib/skeletons/_angular/options/ecl-eu/src/app/app.component.html +2 -2
  30. package/lib/skeletons/_angular/options/ecl-eu/src/app/app.component.ts +4 -6
  31. package/lib/skeletons/_angular/options/ecl-eu/src/app/features/home/home.component.ts +0 -4
  32. package/lib/skeletons/_angular/options/ecl-eu/src/config/global.ts +4 -1
  33. package/lib/skeletons/_angular/options/eds/src/app/app.component.html +35 -0
  34. package/lib/skeletons/_angular/options/eds/src/app/app.component.spec.ts +56 -0
  35. package/lib/skeletons/_angular/options/eds/src/app/app.component.ts +44 -0
  36. package/lib/skeletons/_angular/options/eds/src/index.html +21 -0
  37. package/lib/skeletons/_angular/options/pnpm/package.json +91 -48
  38. package/lib/skeletons/_react/base/README.md +65 -0
  39. package/lib/skeletons/_react/base/eslint.config.mjs +17 -0
  40. package/lib/skeletons/_react/base/gitignore_TO_REPLACE +34 -0
  41. package/lib/skeletons/_react/base/index.html +13 -0
  42. package/lib/skeletons/_react/base/mock/app/models/user.cjs +6 -0
  43. package/lib/skeletons/_react/base/mock/app/routes/index.cjs +5 -0
  44. package/lib/skeletons/_react/base/mock/app/routes/user_routes.cjs +44 -0
  45. package/lib/skeletons/_react/base/mock/db/db.json +10 -0
  46. package/lib/skeletons/_react/base/mock/server.cjs +23 -0
  47. package/lib/skeletons/_react/base/package.json +29 -0
  48. package/lib/skeletons/_react/base/public/.gitkeep +0 -0
  49. package/lib/skeletons/_react/base/src/App.tsx +73 -0
  50. package/lib/skeletons/_react/base/src/main.tsx +30 -0
  51. package/lib/skeletons/_react/base/src/pages/about.tsx +27 -0
  52. package/lib/skeletons/_react/base/src/pages/home.tsx +50 -0
  53. package/lib/skeletons/_react/base/src/routes.ts +18 -0
  54. package/lib/skeletons/_react/base/src/styles.css +37 -0
  55. package/lib/skeletons/_react/base/src/vite-env.d.ts +1 -0
  56. package/lib/skeletons/_react/base/tsconfig.app.json +18 -0
  57. package/lib/skeletons/_react/base/tsconfig.json +7 -0
  58. package/lib/skeletons/_react/base/tsconfig.node.json +15 -0
  59. package/lib/skeletons/_react/base/vite.config.ts +77 -0
  60. package/lib/skeletons/_react/options/pnpm/package.json +46 -0
  61. package/lib/skeletons/web-maven/pom.xml +2 -2
  62. package/lib/skeletons/web-spring-boot/myapp-web/pom.xml +4 -5
  63. package/lib/skeletons/web-spring-boot/myapp-web-rest/pom.xml +2 -4
  64. package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/security/FakeAuthenticationFilter.java +0 -2
  65. package/lib/skeletons/web-spring-boot/pom.xml +1 -1
  66. package/lib/utils/fs-extra.js +38 -0
  67. package/lib/utils/glob.js +144 -0
  68. package/lib/utils/rimraf.js +14 -0
  69. package/lib/utils.js +39 -15
  70. package/package.json +2 -7
  71. package/sonar-project.properties +0 -14
  72. /package/lib/skeletons/_angular/base/mock/app/models/{user.js → user.cjs} +0 -0
@@ -0,0 +1,50 @@
1
+ import { EdsCard, EdsCardHeader, EdsCardLabel, EdsCardBody } from '@eui/eds-react/eds-card';
2
+ import { EdsButton } from '@eui/eds-react/eds-button';
3
+
4
+ /**
5
+ * The default landing page. A simple example composing a couple of `@eui/eds-react` components
6
+ * (`EdsCard`, `EdsButton`) inside the shell content area. Replace this with your own home page.
7
+ */
8
+ export function HomePage() {
9
+ return (
10
+ <div className="app-page">
11
+ <h1 className="app-page__title">Welcome to your eUI React app</h1>
12
+ <p className="app-page__intro">
13
+ This starter is powered by <strong>@eui/eds-react</strong> — the pure-React port of the
14
+ EU Design System components — with routing handled by React Router.
15
+ </p>
16
+
17
+ <div className="eds-u-d-flex eds-u-flex-wrap eds-u-flex-gap-l">
18
+ <EdsCard>
19
+ <EdsCardHeader>
20
+ <EdsCardLabel>Get started</EdsCardLabel>
21
+ </EdsCardHeader>
22
+ <EdsCardBody>
23
+ Edit <code>src/pages/home.tsx</code> to build your first page, then add routes in
24
+ <code> src/routes.ts</code> and <code>src/App.tsx</code>.
25
+ </EdsCardBody>
26
+ </EdsCard>
27
+
28
+ <EdsCard>
29
+ <EdsCardHeader>
30
+ <EdsCardLabel>Components</EdsCardLabel>
31
+ </EdsCardHeader>
32
+ <EdsCardBody>
33
+ Import any component from <code>@eui/eds-react</code> and its styles are already
34
+ loaded via the combined <code>styles.css</code> barrel in <code>main.tsx</code>.
35
+ </EdsCardBody>
36
+ </EdsCard>
37
+ </div>
38
+
39
+ <div className="eds-u-mt-l eds-u-d-flex eds-u-flex-gap-s">
40
+ <EdsButton
41
+ type="primary"
42
+ onClick={() => window.open('https://eui.ecdevops.eu', '_blank', 'noopener')}
43
+ >
44
+ eUI documentation
45
+ </EdsButton>
46
+ <EdsButton type="secondary">Secondary action</EdsButton>
47
+ </div>
48
+ </div>
49
+ );
50
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The app's navigation routes. The sidebar (in `App.tsx`) and the routed pages both derive from
3
+ * this single table, so adding a page is a one-line change here plus a `<Route>` in `App.tsx`.
4
+ * `icon` values are EDS icon names (see the sprite catalog in `@eui/eds-styles`).
5
+ */
6
+ export interface NavItem {
7
+ /** Router path (also the hash route). */
8
+ path: string;
9
+ /** Sidebar label. */
10
+ label: string;
11
+ /** EDS icon name shown in the sidebar. */
12
+ icon: string;
13
+ }
14
+
15
+ export const NAV_ITEMS: NavItem[] = [
16
+ { path: '/home', label: 'Home', icon: 'house' },
17
+ { path: '/about', label: 'About', icon: 'circle-info' },
18
+ ];
@@ -0,0 +1,37 @@
1
+ /*
2
+ * App-specific styles. The EDS design tokens (--eds-* custom properties) come from
3
+ * @eui/eds-styles (loaded in main.tsx) and are available anywhere under the `eui-21` scope set
4
+ * on <body> in index.html. Prefer the eds-u-* utility classes for layout; use this file only
5
+ * for app-level chrome.
6
+ */
7
+
8
+ html,
9
+ body,
10
+ #root {
11
+ height: 100%;
12
+ margin: 0;
13
+ }
14
+
15
+ .app-page {
16
+ padding: var(--eds-sp-l);
17
+ max-width: 960px;
18
+ }
19
+
20
+ .app-page__title {
21
+ font: var(--eds-f-heading-l);
22
+ color: var(--eds-c-foreground);
23
+ margin: 0 0 var(--eds-sp-s);
24
+ }
25
+
26
+ .app-page__intro {
27
+ font: var(--eds-f-paragraph-m);
28
+ color: var(--eds-c-foreground-subtle);
29
+ margin: 0 0 var(--eds-sp-l);
30
+ }
31
+
32
+ .app-page code {
33
+ font-family: monospace;
34
+ background: var(--eds-c-surface-elevation-sunken);
35
+ border-radius: var(--eds-br-xs);
36
+ padding: 0 var(--eds-sp-3xs);
37
+ }
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ES2022",
5
+ "moduleResolution": "bundler",
6
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
+ "jsx": "react-jsx",
8
+ "strict": true,
9
+ "skipLibCheck": true,
10
+ "noEmit": true,
11
+ "isolatedModules": true,
12
+ "verbatimModuleSyntax": true,
13
+ "noUnusedLocals": true,
14
+ "noUnusedParameters": true,
15
+ "noFallthroughCasesInSwitch": true
16
+ },
17
+ "include": ["src"]
18
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "files": [],
3
+ "references": [
4
+ { "path": "./tsconfig.app.json" },
5
+ { "path": "./tsconfig.node.json" }
6
+ ]
7
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ES2022",
5
+ "moduleResolution": "bundler",
6
+ "lib": ["ES2022"],
7
+ "strict": true,
8
+ "skipLibCheck": true,
9
+ "noEmit": true,
10
+ "isolatedModules": true,
11
+ "verbatimModuleSyntax": true,
12
+ "types": ["node"]
13
+ },
14
+ "include": ["vite.config.ts"]
15
+ }
@@ -0,0 +1,77 @@
1
+ import { defineConfig, type Plugin } from 'vite';
2
+ import { fileURLToPath } from 'node:url';
3
+ import { dirname, join, resolve } from 'node:path';
4
+ import { cpSync, createReadStream, existsSync, statSync } from 'node:fs';
5
+ import type { IncomingMessage, ServerResponse } from 'node:http';
6
+
7
+ const here = dirname(fileURLToPath(import.meta.url));
8
+ const outDir = resolve(here, 'dist');
9
+
10
+ // EDS design assets (icon sprites, fonts, the shared eds-components.json catalog) ship inside the
11
+ // installed `@eui/eds-styles` package. `EdsIcon` resolves sprites from
12
+ // `${assetsBase}/eds/icons/sprites/{set}.svg`, so the package's `dist/assets` folder is exposed
13
+ // under `/assets/eds` for both the dev server and the built output.
14
+ const edsStylesAssets = resolve(here, 'node_modules/@eui/eds-styles/dist/assets');
15
+
16
+ /**
17
+ * Serve + emit the EDS assets under `/assets/eds` so icon sprites resolve in dev and in the
18
+ * built bundle. Do NOT commit the sprite/font binaries into the app — they always come from the
19
+ * `@eui/eds-styles` package.
20
+ */
21
+ function edsAssetsPlugin(assetsDir: string): Plugin {
22
+ const mime: Record<string, string> = {
23
+ '.svg': 'image/svg+xml',
24
+ '.json': 'application/json',
25
+ '.woff2': 'font/woff2',
26
+ '.woff': 'font/woff',
27
+ };
28
+ return {
29
+ name: 'eds-assets',
30
+ configureServer(server) {
31
+ server.middlewares.use((req: IncomingMessage, res: ServerResponse, next: () => void) => {
32
+ const url = (req.url ?? '').split('?')[0];
33
+ const prefix = '/assets/eds/';
34
+ if (!url.startsWith(prefix)) {
35
+ return next();
36
+ }
37
+ const file = join(assetsDir, url.slice(prefix.length));
38
+ if (!existsSync(file) || !statSync(file).isFile()) {
39
+ return next();
40
+ }
41
+ const ext = file.slice(file.lastIndexOf('.'));
42
+ res.setHeader('Content-Type', mime[ext] ?? 'application/octet-stream');
43
+ createReadStream(file).pipe(res);
44
+ });
45
+ },
46
+ closeBundle() {
47
+ if (existsSync(assetsDir)) {
48
+ cpSync(assetsDir, join(outDir, 'assets', 'eds'), { recursive: true });
49
+ }
50
+ },
51
+ };
52
+ }
53
+
54
+ // Relative asset base (`./`) so the built app works under any deploy sub-path. JSX uses Vite's
55
+ // built-in esbuild automatic runtime (no @vitejs/plugin-react needed).
56
+ export default defineConfig({
57
+ root: here,
58
+ base: './',
59
+ publicDir: resolve(here, 'public'),
60
+ esbuild: { jsx: 'automatic' },
61
+ plugins: [edsAssetsPlugin(edsStylesAssets)],
62
+ build: {
63
+ outDir,
64
+ emptyOutDir: true,
65
+ },
66
+ server: {
67
+ port: 4200,
68
+ open: '/',
69
+ // Proxy API calls to the mock json-server (started in parallel via `npm start`).
70
+ proxy: {
71
+ '/api': {
72
+ target: 'http://localhost:3000',
73
+ changeOrigin: true,
74
+ },
75
+ },
76
+ },
77
+ });
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "eui-react-app",
3
+ "version": "22.0.0-rc.1",
4
+ "license": "EUPL-1.1",
5
+ "private": true,
6
+ "type": "module",
7
+ "scripts": {
8
+ "start-mock-server": "nodemon --watch ./mock ./mock/server.cjs",
9
+ "start-serve": "eui-cli serve-app",
10
+ "start": "npm-run-all --parallel start-mock-server start-serve",
11
+ "start-local": "eui-cli serve-app",
12
+ "build": "tsc -b && eui-cli build-app",
13
+ "preview": "vite preview",
14
+ "lint": "eslint src --ext .ts,.tsx",
15
+ "test": "vitest run"
16
+ },
17
+ "dependencies": {
18
+ "react": "19.3.0",
19
+ "react-dom": "19.3.0",
20
+ "react-router-dom": "7.18.4",
21
+ "luxon": "3.7.2",
22
+ "@eui/eds-styles": "22.0.0-rc.1",
23
+ "@eui/eds-react": "22.0.0-rc.1",
24
+ "@eui/eds-shared": "22.0.0-rc.1"
25
+ },
26
+ "devDependencies": {
27
+ "@eui/cli": "22.0.0-rc.1",
28
+ "typescript": "6.0.3",
29
+ "@types/react": "19.3.0",
30
+ "@types/react-dom": "19.3.0",
31
+ "@types/luxon": "3.7.2",
32
+ "vitest": "4.1.11",
33
+ "@vitest/ui": "4.1.11",
34
+ "@vitest/coverage-v8": "4.1.11",
35
+ "@vitest/coverage-istanbul": "4.1.11",
36
+ "eslint": "9.39.1",
37
+ "typescript-eslint": "8.63.0",
38
+ "@eslint/js": "9.39.1",
39
+ "npm-run-all": "4.1.5",
40
+ "json-server": "1.0.0-beta.3",
41
+ "nodemon": "3.1.11",
42
+ "lowdb": "1.0.0",
43
+ "body-parser": "1.20.3",
44
+ "express": "4.21.2"
45
+ }
46
+ }
@@ -11,7 +11,7 @@
11
11
  <dependency>
12
12
  <groupId>org.springframework</groupId>
13
13
  <artifactId>spring-webmvc</artifactId>
14
- <version>6.0.10</version>
14
+ <version>6.2.17</version>
15
15
  </dependency>
16
16
  <dependency>
17
17
  <groupId>eu.europa.ec.digit.uxatec.eui</groupId>
@@ -39,7 +39,7 @@
39
39
  <plugin>
40
40
  <groupId>org.apache.maven.plugins</groupId>
41
41
  <artifactId>maven-war-plugin</artifactId>
42
- <version>3.4.0</version>
42
+ <version>3.5.0</version>
43
43
  <configuration>
44
44
  <failOnMissingWebXml>false</failOnMissingWebXml>
45
45
  <webResources>
@@ -20,9 +20,8 @@
20
20
 
21
21
  <dependencies>
22
22
  <dependency>
23
- <groupId>javax.servlet</groupId>
24
- <artifactId>javax.servlet-api</artifactId>
25
- <version>4.0.1</version>
23
+ <groupId>jakarta.servlet</groupId>
24
+ <artifactId>jakarta.servlet-api</artifactId>
26
25
  <scope>provided</scope>
27
26
  </dependency>
28
27
  </dependencies>
@@ -32,7 +31,7 @@
32
31
  <plugin>
33
32
  <groupId>org.codehaus.mojo</groupId>
34
33
  <artifactId>exec-maven-plugin</artifactId>
35
- <version>3.1.0</version>
34
+ <version>3.7.0</version>
36
35
  <executions>
37
36
  <execution>
38
37
  <id>npm_package_install</id>
@@ -69,7 +68,7 @@
69
68
  <plugin>
70
69
  <groupId>org.apache.maven.plugins</groupId>
71
70
  <artifactId>maven-war-plugin</artifactId>
72
- <version>3.4.0</version>
71
+ <version>3.5.0</version>
73
72
  <configuration>
74
73
  <webResources>
75
74
  <resource>
@@ -22,7 +22,7 @@
22
22
  <dependency>
23
23
  <groupId>org.springdoc</groupId>
24
24
  <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
25
- <version>2.4.0</version>
25
+ <version>2.8.17</version>
26
26
  </dependency>
27
27
  <dependency>
28
28
  <groupId>org.springframework.boot</groupId>
@@ -53,12 +53,10 @@
53
53
  <dependency>
54
54
  <groupId>org.springframework.security</groupId>
55
55
  <artifactId>spring-security-web</artifactId>
56
- <version>6.4.4</version>
57
56
  </dependency>
58
57
  <dependency>
59
58
  <groupId>org.springframework.security</groupId>
60
59
  <artifactId>spring-security-config</artifactId>
61
- <version>6.4.4</version>
62
60
  </dependency>
63
61
  <dependency>
64
62
  <groupId>com.h2database</groupId>
@@ -68,7 +66,7 @@
68
66
  <dependency>
69
67
  <groupId>org.springdoc</groupId>
70
68
  <artifactId>springdoc-openapi-starter-common</artifactId>
71
- <version>2.8.5</version>
69
+ <version>2.8.17</version>
72
70
  </dependency>
73
71
  </dependencies>
74
72
 
@@ -1,6 +1,5 @@
1
1
  package @app.group.id@.@app.name@.security;
2
2
 
3
- import com.sun.security.auth.UserPrincipal;
4
3
  import org.springframework.security.core.Authentication;
5
4
  import org.springframework.security.core.GrantedAuthority;
6
5
  import org.springframework.security.core.authority.SimpleGrantedAuthority;
@@ -12,7 +11,6 @@ import jakarta.servlet.http.*;
12
11
  import java.io.BufferedReader;
13
12
  import java.io.IOException;
14
13
  import java.io.UnsupportedEncodingException;
15
- import java.security.AuthProvider;
16
14
  import java.security.Principal;
17
15
  import java.util.*;
18
16
 
@@ -13,7 +13,7 @@
13
13
  <parent>
14
14
  <groupId>org.springframework.boot</groupId>
15
15
  <artifactId>spring-boot-starter-parent</artifactId>
16
- <version>3.4.4</version>
16
+ <version>3.5.16</version>
17
17
  </parent>
18
18
 
19
19
  <properties>
@@ -0,0 +1,38 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Drop-in replacement for the `fs-extra` package (CJS).
5
+ * Uses Node 22+ built-ins only. Covered API: copySync, removeSync, moveSync.
6
+ */
7
+
8
+ const fs = require('fs');
9
+
10
+ const copySync = (src, dest, opts = {}) => {
11
+ fs.cpSync(src, dest, {
12
+ recursive: true,
13
+ force: opts.overwrite !== false,
14
+ errorOnExist: false,
15
+ });
16
+ };
17
+
18
+ const removeSync = (target) => {
19
+ fs.rmSync(target, { recursive: true, force: true });
20
+ };
21
+
22
+ const moveSync = (src, dest, opts = {}) => {
23
+ if (opts.overwrite !== false) {
24
+ fs.rmSync(dest, { recursive: true, force: true });
25
+ }
26
+ try {
27
+ fs.renameSync(src, dest);
28
+ } catch (e) {
29
+ if (e.code === 'EXDEV') {
30
+ fs.cpSync(src, dest, { recursive: true, force: true });
31
+ fs.rmSync(src, { recursive: true, force: true });
32
+ } else {
33
+ throw e;
34
+ }
35
+ }
36
+ };
37
+
38
+ module.exports = { copySync, removeSync, moveSync };
@@ -0,0 +1,144 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Drop-in replacement for the `glob` package (CJS).
5
+ * Uses Node built-in `fs` + recursive readdir; no third-party dependencies.
6
+ *
7
+ * Supported options: cwd, dot, follow, nodir (walk only yields files),
8
+ * ignore (array of glob patterns to prune).
9
+ */
10
+
11
+ const fs = require('fs');
12
+ const path = require('path');
13
+
14
+ // ---------------------------------------------------------------------------
15
+ // Pattern compiler
16
+ // ---------------------------------------------------------------------------
17
+
18
+ function segToRe(seg) {
19
+ let re = '';
20
+ for (const c of seg) {
21
+ if (c === '*') re += '[^/]*';
22
+ else if (c === '?') re += '[^/]';
23
+ else if (/[.+^${}()|[\]\\]/.test(c)) re += '\\' + c;
24
+ else re += c;
25
+ }
26
+ return re;
27
+ }
28
+
29
+ function compile(pattern) {
30
+ const p = pattern.replace(/\\/g, '/');
31
+ const parts = p.split('/');
32
+ let re = '^';
33
+ for (let i = 0; i < parts.length; i++) {
34
+ const part = parts[i];
35
+ const isLast = i === parts.length - 1;
36
+ if (part === '**') {
37
+ re += isLast ? '.*' : '(.*\\/)?';
38
+ } else {
39
+ re += segToRe(part);
40
+ if (!isLast) re += '\\/';
41
+ }
42
+ }
43
+ return new RegExp(re + '$');
44
+ }
45
+
46
+ // ---------------------------------------------------------------------------
47
+ // Directory pruning
48
+ // ---------------------------------------------------------------------------
49
+
50
+ function isPruned(relDir, ignorePatterns) {
51
+ if (!ignorePatterns.length) return false;
52
+ const probe = relDir ? relDir + '/x' : 'x';
53
+ return ignorePatterns.some(p => compile(p).test(probe));
54
+ }
55
+
56
+ // ---------------------------------------------------------------------------
57
+ // Recursive walk
58
+ // ---------------------------------------------------------------------------
59
+
60
+ function walk(absDir, baseDir, opts, out) {
61
+ let entries;
62
+ try {
63
+ entries = fs.readdirSync(absDir, { withFileTypes: true });
64
+ } catch {
65
+ return;
66
+ }
67
+
68
+ for (const e of entries) {
69
+ if (!opts.dot && e.name[0] === '.') continue;
70
+
71
+ const absPath = path.join(absDir, e.name);
72
+ const relPath = path.relative(baseDir, absPath).replace(/\\/g, '/');
73
+
74
+ let isDir = e.isDirectory();
75
+ if (!isDir && opts.follow && e.isSymbolicLink()) {
76
+ try { isDir = fs.statSync(absPath).isDirectory(); } catch { /* broken symlink */ }
77
+ }
78
+
79
+ if (isDir) {
80
+ if (!isPruned(relPath, opts.ignore)) walk(absPath, baseDir, opts, out);
81
+ } else if (!e.isSymbolicLink() || opts.follow) {
82
+ out.push(relPath);
83
+ }
84
+ }
85
+ }
86
+
87
+ // ---------------------------------------------------------------------------
88
+ // Public API
89
+ // ---------------------------------------------------------------------------
90
+
91
+ /**
92
+ * Synchronous glob — drop-in for `glob.sync` / `globSync`.
93
+ */
94
+ const globSync = (pattern, options = {}) => {
95
+ const normPattern = pattern.replace(/\\/g, '/');
96
+ const isAbs = path.isAbsolute(pattern);
97
+
98
+ let cwd, relPattern;
99
+ if (isAbs) {
100
+ const parts = normPattern.split('/');
101
+ let splitIdx = parts.findIndex(p => /[*?]/.test(p));
102
+ if (splitIdx === -1) splitIdx = parts.length;
103
+ cwd = parts.slice(0, splitIdx).join('/') || '/';
104
+ relPattern = parts.slice(splitIdx).join('/');
105
+ } else {
106
+ cwd = options.cwd ? path.resolve(options.cwd) : process.cwd();
107
+ relPattern = normPattern;
108
+ }
109
+
110
+ const dot = options.dot ?? false;
111
+ const follow = options.follow ?? false;
112
+ const ignore = Array.isArray(options.ignore) ? options.ignore : [];
113
+
114
+ const files = [];
115
+ walk(cwd, cwd, { dot, follow, ignore }, files);
116
+
117
+ if (!relPattern || relPattern === '**') {
118
+ return isAbs ? files.map(f => path.join(cwd, f)) : files;
119
+ }
120
+
121
+ const rx = compile(relPattern);
122
+ const matched = files.filter(f => rx.test(f));
123
+ return isAbs ? matched.map(f => path.join(cwd, f)) : matched;
124
+ };
125
+
126
+ /**
127
+ * Async glob with Node-style callback — drop-in for the `glob(pattern, opts, cb)` signature.
128
+ * Internally uses globSync; the callback is always called asynchronously.
129
+ */
130
+ const glob = (pattern, options, callback) => {
131
+ setImmediate(() => {
132
+ try {
133
+ const files = globSync(pattern, options);
134
+ callback(null, files);
135
+ } catch (err) {
136
+ callback(err, []);
137
+ }
138
+ });
139
+ };
140
+
141
+ glob.sync = globSync;
142
+
143
+ module.exports = glob;
144
+ module.exports.globSync = globSync;
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Drop-in replacement for the `rimraf` package (CJS).
5
+ * Uses Node 14.14+ `fs.rmSync` with recursive + force flags.
6
+ */
7
+
8
+ const fs = require('fs');
9
+
10
+ const nativeSync = (inputPath) => {
11
+ fs.rmSync(inputPath, { recursive: true, force: true });
12
+ };
13
+
14
+ module.exports = { nativeSync };