Fix some node module nonsense idk

a6363affa7e9d9baa49798f68865c26d6bf78580

Tucker McKnight <tucker.mcknight@gmail.com> | Sun Sep 14 2025

Fix some node module nonsense idk

Also use import.meta.dirname instead of __dirname because that's
what's available when using es modules.
main.ts:31
Before
30
31
32
33
34
35
36
    return pathParts[pathParts.length - 1]
  })

  const vendor = `${__dirname}/vendor`
  const frontend = `${__dirname}/frontend`

  eleventyConfig.addPassthroughCopy({
    [vendor]: `${reposPath}/vendor`,
After
30
31
32
33
34
35
36
    return pathParts[pathParts.length - 1]
  })

  const vendor = `${import.meta.dirname}/vendor`
  const frontend = `${import.meta.dirname}/frontend`

  eleventyConfig.addPassthroughCopy({
    [vendor]: `${reposPath}/vendor`,
main.ts:210
Before
209
210
211
212
213
214
215
216
217
218

  eleventyConfig.addFilter("jsonStringify", data => JSON.stringify(data))

  const topLayoutPartial = fsImport.readFileSync(`${__dirname}/partial_templates/main_top.njk`).toString()
  const bottomLayoutPartial = fsImport.readFileSync(`${__dirname}/partial_templates/main_bottom.njk`).toString()

  // INDEX.NJK
  const indexTemplate = fsImport.readFileSync(`${__dirname}/templates/index.njk`).toString()
  eleventyConfig.addTemplate(
    'repos/index.njk',
    topLayoutPartial + indexTemplate + bottomLayoutPartial,
After
209
210
211
212
213
214
215
216
217
218

  eleventyConfig.addFilter("jsonStringify", data => JSON.stringify(data))

  const topLayoutPartial = fsImport.readFileSync(`${import.meta.dirname}/partial_templates/main_top.njk`).toString()
  const bottomLayoutPartial = fsImport.readFileSync(`${import.meta.dirname}/partial_templates/main_bottom.njk`).toString()

  // INDEX.NJK
  const indexTemplate = fsImport.readFileSync(`${import.meta.dirname}/templates/index.njk`).toString()
  eleventyConfig.addTemplate(
    'repos/index.njk',
    topLayoutPartial + indexTemplate + bottomLayoutPartial,
main.ts:224
Before
223
224
225
226
227
228
  )

  // BRANCHES.NJK
  const branchesTemplate = fsImport.readFileSync(`${__dirname}/templates/branches.njk`).toString()
  eleventyConfig.addTemplate(
    'repos/branches.njk',
    topLayoutPartial + branchesTemplate + bottomLayoutPartial,
After
223
224
225
226
227
228
  )

  // BRANCHES.NJK
  const branchesTemplate = fsImport.readFileSync(`${import.meta.dirname}/templates/branches.njk`).toString()
  eleventyConfig.addTemplate(
    'repos/branches.njk',
    topLayoutPartial + branchesTemplate + bottomLayoutPartial,
main.ts:250
Before
249
250
251
252
253
254
  )

  // FILE.NJK
  const fileTemplate = fsImport.readFileSync(`${__dirname}/templates/file.njk`).toString()
  const flatFilesData = flatFiles(reposData)
  eleventyConfig.addTemplate(
    'repos/file.njk',
After
249
250
251
252
253
254
  )

  // FILE.NJK
  const fileTemplate = fsImport.readFileSync(`${import.meta.dirname}/templates/file.njk`).toString()
  const flatFilesData = flatFiles(reposData)
  eleventyConfig.addTemplate(
    'repos/file.njk',
main.ts:278
Before
277
278
279
280
281
282
  )

  // FILES.NJK
  const filesTemplate = fsImport.readFileSync(`${__dirname}/templates/files.njk`).toString()
  eleventyConfig.addTemplate(
    'repos/files.njk',
    topLayoutPartial + filesTemplate + bottomLayoutPartial,
After
277
278
279
280
281
282
  )

  // FILES.NJK
  const filesTemplate = fsImport.readFileSync(`${import.meta.dirname}/templates/files.njk`).toString()
  eleventyConfig.addTemplate(
    'repos/files.njk',
    topLayoutPartial + filesTemplate + bottomLayoutPartial,
main.ts:304
Before
303
304
305
306
307
308
  )

  // REPO.NJK
  const repoTemplate = fsImport.readFileSync(`${__dirname}/templates/repo.njk`).toString()
  eleventyConfig.addTemplate(
    'repos/repo.njk',
    topLayoutPartial + repoTemplate + bottomLayoutPartial,
After
303
304
305
306
307
308
  )

  // REPO.NJK
  const repoTemplate = fsImport.readFileSync(`${import.meta.dirname}/templates/repo.njk`).toString()
  eleventyConfig.addTemplate(
    'repos/repo.njk',
    topLayoutPartial + repoTemplate + bottomLayoutPartial,
main.ts:330
Before
329
330
331
332
333
334
  )

  // PATCHES.NJK
  const patchesTemplate = fsImport.readFileSync(`${__dirname}/templates/patches.njk`).toString()
  const paginatedPatchesData = await paginatedPatches(reposData)
  eleventyConfig.addTemplate(
    `repos/patches.njk`,
After
329
330
331
332
333
334
  )

  // PATCHES.NJK
  const patchesTemplate = fsImport.readFileSync(`${import.meta.dirname}/templates/patches.njk`).toString()
  const paginatedPatchesData = await paginatedPatches(reposData)
  eleventyConfig.addTemplate(
    `repos/patches.njk`,
main.ts:358
Before
357
358
359
360
361
362
  )

  // PATCH.NJK
  const patchTemplate = fsImport.readFileSync(`${__dirname}/templates/patch.njk`).toString()
  const flatPatchesData = await flatPatches(reposConfiguration)
  eleventyConfig.addTemplate(
    `repos/patch.njk`,
After
357
358
359
360
361
362
  )

  // PATCH.NJK
  const patchTemplate = fsImport.readFileSync(`${import.meta.dirname}/templates/patch.njk`).toString()
  const flatPatchesData = await flatPatches(reposConfiguration)
  eleventyConfig.addTemplate(
    `repos/patch.njk`,
main.ts:387
Before
386
387
388
389
390
391
  )

  // FEED.NJK
  const feedTemplate = fsImport.readFileSync(`${__dirname}/templates/feed.njk`).toString()
  eleventyConfig.addTemplate(
    `repos/feed.njk`,
    feedTemplate,
After
386
387
388
389
390
391
  )

  // FEED.NJK
  const feedTemplate = fsImport.readFileSync(`${import.meta.dirname}/templates/feed.njk`).toString()
  eleventyConfig.addTemplate(
    `repos/feed.njk`,
    feedTemplate,
package.json:1
Before
0
1

2
3
{
  "name": "eleventy-plugin",
⁣
  "version": "1.0.0",
  "main": "dist/main.js",
  "scripts": {
After
0
1
2
3
4
{
  "name": "eleventy-plugin",
  "type": "module",
  "version": "1.0.0",
  "main": "dist/main.js",
  "scripts": {
tsconfig.json:3
Before
2
3
4
5
6
7
8
    "allowSyntheticDefaultImports": true,
    "rewriteRelativeImportExtensions": true,
    "noImplicitAny": false,
    "module": "nodenext",
    "target": "es2017",
    "lib": ["es2023", "dom"],
    "allowJs": true,
    "outDir": "dist"
After
2
3
4
5
6
7
8
    "allowSyntheticDefaultImports": true,
    "rewriteRelativeImportExtensions": true,
    "noImplicitAny": false,
    "module": "node18",
    "target": "es6",
    "lib": ["es2023", "dom"],
    "allowJs": true,
    "outDir": "dist"